Table of Contents

Class TwTimePickerBody

Namespace
TwBlazor.Components.TimePicker
Assembly
TwBlazor.dll
public class TwTimePickerBody : TwBlazorComponentBase, IComponent, IHandleEvent, IHandleAfterRender, ITwComponent
Inheritance
TwTimePickerBody
Implements
Inherited Members

Constructors

TwTimePickerBody()

public TwTimePickerBody()

Properties

Is12HourFormat

Gets or sets a value indicating whether the time should be displayed in 12-hour format.

[Parameter]
public bool Is12HourFormat { get; set; }

Property Value

bool

OnDone

Raised when the "Done" button is pressed. Only shown when ShowActions is set.

[Parameter]
public EventCallback OnDone { get; set; }

Property Value

EventCallback

OnHourDecreased

Event callback invoked when the hour decrement button is clicked.

[Parameter]
public EventCallback OnHourDecreased { get; set; }

Property Value

EventCallback

OnHourIncreased

Event callback invoked when the hour increment button is clicked.

[Parameter]
public EventCallback OnHourIncreased { get; set; }

Property Value

EventCallback

OnHourValueChanged

Event callback invoked when the hour input value changes.

[Parameter]
public EventCallback<string> OnHourValueChanged { get; set; }

Property Value

EventCallback<string>

OnMinuteDecreased

Event callback invoked when the minute decrement button is clicked.

[Parameter]
public EventCallback OnMinuteDecreased { get; set; }

Property Value

EventCallback

OnMinuteIncreased

Event callback invoked when the minute increment button is clicked.

[Parameter]
public EventCallback OnMinuteIncreased { get; set; }

Property Value

EventCallback

OnMinuteValueChanged

Event callback invoked when the minute input value changes.

[Parameter]
public EventCallback<string> OnMinuteValueChanged { get; set; }

Property Value

EventCallback<string>

SelectedTime

The selected time value to display.

[Parameter]
public TimeOnly SelectedTime { get; set; }

Property Value

TimeOnly

SelectedTimeChanged

Event callback invoked when the selected time changes.

[Parameter]
public EventCallback<TimeOnly> SelectedTimeChanged { get; set; }

Property Value

EventCallback<TimeOnly>

ShowActions

Gets or sets whether the "Now" and "Done" buttons are shown under the time.

[Parameter]
public bool ShowActions { get; set; }

Property Value

bool

Remarks

"Now" sets the current time, rounded down to Step. "Done" raises OnDone, for the picker that owns the panel to close it.

Step

Gets or sets the step, in minutes, that the step buttons and Arrow Up/Arrow Down move the time by. Steps under an hour move the minute field; steps of an hour or more (e.g. 120 for two hours) move the hour field and show the minutes as fixed text. Must divide an hour or, for whole hours, a day. Defaults to 1.

[Parameter]
public int Step { get; set; }

Property Value

int

Variant

Gets or sets the visual variant (Default, Outlined, Filled) of the hour/minute number inputs. Callers (TwTimePicker and friends) pass their own resolved effectiveVariant down explicitly. Left null (e.g. if this component is ever used standalone), TwBlazor.Components.TimePicker.TwTimePickerBody.effectiveVariant falls back to the global DefaultInputVariant instead of silently rendering as an unstyled Default - a non-nullable Variant parameter caused exactly that bug once before on TwDateTimePicker.

[Parameter]
public InputVariant? Variant { get; set; }

Property Value

InputVariant?

Methods

BuildRenderTree(RenderTreeBuilder)

Renders the component to the supplied RenderTreeBuilder.

protected override void BuildRenderTree(RenderTreeBuilder __builder)

Parameters

__builder RenderTreeBuilder

OnParametersSet()

Invoked when the component's parameters have been set. Ensures that the component has a unique identifier by generating one if none is provided.

protected override void OnParametersSet()

Remarks

If the component's identifier is not set, a unique ID is generated based on the component's type name (with a 'Tw' prefix removed if present) and a GUID. This helps ensure that each component instance can be uniquely identified, which is useful for scenarios such as associating labels with form elements or targeting elements in client-side scripts.