DwsTimePicker
API ReferenceDisabled and read-only
Disabled and Readonly keep the value visible but block changes and the dialog. A read-only field can still be focused and copied.
Show Code
TimePicker.razor
<DwsTimePicker Name='TimePickerDemo_State_Disabled' Label='Disabled' Width='220' IconLabel='@Icons.BS.Clock' Disabled='true' Value='@_stateTime' />
<DwsTimePicker Name='TimePickerDemo_State_Readonly' Label='Read-only' Width='220' IconLabel='@Icons.BS.ClockHistory' Readonly='true' Value='@_stateTime' />TimePicker.razor.cs
private TimeOnly? _stateTime = new(21, 0);Interface-Description
| Name | Typ | Default | Description |
|---|---|---|---|
| IsValid | bool | true | Whether the current entry is valid. |
| ValidationMessage | string? | null | Message of the current validation error, or null. |
| IsDialogOpen | bool | false | Whether the dialog is open. |
| Name | Typ | Parameters | Description |
|---|---|---|---|
| OpenDialogAsync | Task | Opens the dialog, unless the picker is disabled, read-only or OnlyEditable. | |
| CloseDialogAsync | Task | Closes the dialog without changing the value. |
| Name | Typ | Default | Description |
|---|---|---|---|
| Value | TimeOnly? | null | The selected time, or null when empty. Supports two-way binding via @bind-Value. Setting it from code never raises ValueChanged; with ValueChanged bound the picker shows what the parent passes back. A value the constraints reject is shown, marked invalid and logged once. |
| DefaultToCurrentTime | bool | false | Fills an empty picker with the current time (browser clock, or TimeZone's when set), rounded down to MinuteStep and moved to the next allowed time, and raises ValueChanged. Interactive render modes only. |
| MinTime | TimeOnly? | null | Earliest selectable time (inclusive). A MinTime after MaxTime spans midnight (22:00..06:00). |
| MaxTime | TimeOnly? | null | Latest selectable time (inclusive). |
| DisabledTimes | IEnumerable<DwsTimeRange>? | null | Ranges that cannot be selected, e.g. a lunch break. Start included, end excluded; an end before the start spans midnight. |
| IsTimeDisabled | Func<TimeOnly, bool>? | null | Returns true for a time that cannot be selected, e.g. booked slots. |
| Validator | Func<TimeOnly, string?>? | null | Custom validation after the built-in checks: return a message to reject the time, null to accept it. Runs when a time is typed or applied; the dialog does not grey out what it rejects. |
| ShowValidationMessage | bool | true | Shows the validation message under the field. |
| Format | string? | null | Time format for display and input (HH:mm, hh:mm tt, HH:mm:ss, ...). An h adds an AM/PM column, an s a seconds column. Default: the culture's short time pattern; an invalid format falls back to it and is logged once. |
| InputFormats | IReadOnlyList<string>? | null | Further formats accepted when typing, tried after Format. 9, 930, 0930, 9:30, 9.30 and 9:30 pm are always accepted. |
| Culture | CultureInfo? | null | Culture for formatting and parsing. Default: the current language's culture. |
| MinuteStep | int | 1 | Minute interval of the dialog (1-60). Invalid values fall back to 1 and are logged once. |
| SecondStep | int | 1 | Second interval of the dialog's seconds column (1-60). Invalid values fall back to 1. |
| TimeZone | TimeZoneInfo? | null | The zone the field shows and edits. Bindable with @bind-TimeZone when TimeZones offers a choice. Without ValueTimeZone the value is in this zone and nothing is converted. |
| ValueTimeZone | TimeZoneInfo? | null | The zone Value is stored in (e.g. UTC). When it differs from TimeZone the value is converted for display and back on selection. Constraints apply in this zone. |
| TimeZoneReferenceDate | DateOnly? | null | Date the zone conversion is made for (daylight saving time). Default: today in the value's zone. |
| TimeZones | IReadOnlyList<TimeZoneInfo>? | null | Zones the user can pick from in the dialog; the select is shown when the list is not empty. The choice is applied with the time. |
| ShowTimeZone | bool | false | Shows the shown zone's UTC offset inside the field. |
| Label | string | string.Empty | Floating label of the field. |
| IconLabel | string | string.Empty | Icon class shown before the label. |
| Placeholder | string? | null | Placeholder of the empty, focused field. Default: the effective format. |
| Tooltip | string | string.Empty | Tooltip of the input field. |
| DialogTooltip | string | string.Empty | Tooltip of the dialog, separate from the field's. |
| TooltipPosition | DwsTooltipPosition | DwsTooltipPosition.Top | Kept so existing markup still compiles: the tooltip is the browser's native title, which has no position. |
| Highlight | DwsHighlightType | DwsHighlightType.NONE | Marks the field as INFO, WARNING or ERROR. A failed validation uses the error look on its own. |
| Width | int? | null | Width in px. Default: the width of the container. |
| DialogTemplate | RenderFragment<DwsTimePickerDialogContext>? | null | Replaces the dialog's columns. The context offers Value, InitialTime, IsAllowed, Format, GetSlots, SelectAsync and CloseAsync. |
| Behavior | DwsPickerBehavior | DwsPickerBehavior.EditableDialog | EditableDialog: typing, plus the dialog from the clock button or a double click. OnlyDialog: the field opens the dialog on click, Enter, Space or Alt+Down. OnlyEditable: typing only. |
| Readonly | bool | false | Shows the value but blocks typing and the dialog. |
| Hidden | bool | false | Hides the picker while keeping it rendered (Visible removes it). |
| Autofocus | bool | false | Focuses the field when it renders. |
| Haptic | DwsHapticFeedback | DwsHapticFeedback.Selection | Tactile feedback for a tap on an hour, a minute, a second, AM / PM or Now in the dialog, while the app has haptics switched on (IDwsHapticService). Clear and Apply play a light tap unless this is None. Played inside the tap, so it works on iOS too. |
| InputAttributes | IReadOnlyDictionary<string, object>? | null | Further attributes of the text field itself (data-*, aria-*), for a component that composes the picker. The picker's own attributes win. |
| ValueExpression | Expression<Func<TimeOnly?>>? | null | The bound field, set by @bind-Value. Under static SSR the picker is the browser's time input named after it (Model.Start). |
| Name | Typ | Description |
|---|---|---|
| ValueChanged | EventCallback<TimeOnly?> | Raised with the new time after an accepted user change. Used by @bind-Value. |
| OnTimeChanged | EventCallback<TimeOnly?> | Raised after every accepted user change; stays free when @bind-Value is used. |
| OnValidation | EventCallback<DwsTimePickerValidationResult> | Raised whenever a user entry is validated, with Error (None, InvalidFormat, OutOfRange, DisabledTime, Custom), Message, Text and Time. |
| TimeZoneChanged | EventCallback<TimeZoneInfo?> | Raised when the user applies a time in another zone. Used by @bind-TimeZone. |
| OnDialogOpen | EventCallback | Raised when the dialog opens. |
| OnDialogClose | EventCallback | Raised when the dialog closes - applied, cancelled, Escape or a click outside. |
| OnBlur | EventCallback<TimeOnly?> | Raised with the current value when the field loses focus. |
| OnInputKeyDown | EventCallback<KeyboardEventArgs> | A key pressed in the text field. Wired only while bound, so typing costs no round trip otherwise. |
| Name | Typ | Default | Description |
|---|---|---|---|
| Element | ElementReference | The associated web component. May be null if accessed before the component is rendered. | |
| ComponentGuid | Guid | Unique identifier for the component. | |
| TypeString | string | The name of the component type, obtained from reflection. | |
| Authorized_RegisterEnabled | bool | false | Indicates whether this component is enabled through a permission registry. |
| Authorized_RegisterSelected | bool | false | Indicates whether this component is selected in permission selection mode. |
| GetInitializedState | bool | false | Returns whether the component is initialized. |
| GetRenderModeState | DwsRenderMode | Returns the current render mode. | |
| GetComponentState | DwsComponentStateType | Returns the current component state. | |
| GetIsInteractiveState | bool | false | Returns whether the component is interactive. |
| GetIsPrerenderingState | bool | false | Returns whether the component is prerendering. |
| GetComponentLoadingState | bool | false | Returns whether the component is loading. |
| IsFormBusy | bool | false | Whether the DwsForm (or DwsFormBusyRegion) around the component is locked because its submit handler is running. The state itself is the cascaded FormBusyState (IDwsFormBusyState). |
| Name | Typ | Parameters | Description |
|---|---|---|---|
| DebugInfo | void | Logs debug information about the component. | |
| UpdateState | void | Updates the component's state and triggers StateHasChanged. | |
| UpdateStateAsync | Task | Asynchronously updates the component's state and triggers StateHasChanged. | |
| Dispose | void | Disposes the component and releases resources. | |
| FocusAsync | ValueTask | bool containedInScrollableList | Sets focus to the component's element. |
| Name | Typ | Default | Description |
|---|---|---|---|
| Name | string | Required unique identifier for the component within its container. | |
| Visible | bool | true | Determines if the component is visible in the UI. |
| Disabled | bool | false | Disables the form control, ensuring it doesn't participate in form submission. |
| ComponentNameSpace | string | The namespace for permission-based access control. | |
| PermissionKey | string? | null | A stable key that takes the place of Name in the generated permission namespace (Page.PermissionKey): the stored permission survives a rename, and components that share a key share one permission entry. Null: keyed by Name. Read once, when the component registers; an explicit ComponentNameSpace wins. |
| Class | string | Optional CSS class names. | |
| Style | string | Optional in-line styles. | |
| Tag | object | An optional user-defined object to store any additional data with the component. | |
| BackReference | DwsReference | A reference to the enclosing component. | |
| ID | string | The HTML ID attribute for the component. | |
| AdditionalAttributes | Dictionary<string, object> | Additional HTML attributes for the component's root element. | |
| IgnorePermissionChecks | bool | false | Bypasses all permission checks for this component. |
| IgnorePermissionSelection | bool | false | Ignore permission selection mode for this component. |
| IgnoreFormBusy | bool | false | Takes the component out of the submit lock of the DwsForm (or DwsFormBusyRegion) around it: IsFormBusy stays false for it. |
| Name | Typ | Description |
|---|---|---|
| OnInitializedCallbackStarted | EventCallback | Callback when OnInitialized starts. |
| OnInitializedCallback | EventCallback | Callback during OnInitialized. |
| OnInitializedCallbackCompleted | EventCallback | Callback when OnInitialized completes. |
| OnInitializedAsyncCallbackStarted | EventCallback | Callback when OnInitializedAsync starts. |
| OnInitializedAsyncCallback | EventCallback | Callback during OnInitializedAsync. |
| OnInitializedAsyncCallbackCompleted | EventCallback | Callback when OnInitializedAsync completes. |
| OnIsComponentLoadingChanged | EventCallback<bool> | Callback when IsComponentLoading changes. |
| OnCurrentRenderModeChanged | EventCallback<DwsRenderMode> | Callback when CurrentRenderMode changes. |
| OnComponentStateChanged | EventCallback<DwsComponentStateType> | Callback when ComponentState changes. |
