DwsDateTimePicker
API ReferenceDisabled
Disabled turns the field and its button off.
Show Code
DateTimePicker.razor
<DwsDateTimePicker Name="DisabledPicker" Label="Disabled" Disabled="true" Value="@_stateDateTime" />DateTimePicker.razor.cs
private readonly DateTime _stateDateTime = DateTime.Today.AddHours(16).AddMinutes(45);Read-only
Readonly shows the value without a popup or typing.
Show Code
DateTimePicker.razor
<DwsDateTimePicker Name="ReadonlyPicker" Label="Readonly" Readonly="true" Value="@_stateDateTime" Tooltip="Visible but not editable" />DateTimePicker.razor.cs
private readonly DateTime _stateDateTime = DateTime.Today.AddHours(16).AddMinutes(45);Interface-Description
| Name | Typ | Default | Description |
|---|---|---|---|
| IsOpen | bool | false | Whether the popup is open (read-only). |
| Name | Typ | Parameters | Description |
|---|---|---|---|
| OpenAsync | Task | Opens the popup and moves focus into the month grid. Does nothing when the popup is not available (disabled, readonly, OnlyEditable). | |
| CloseAsync | Task | Closes the popup. |
| Name | Typ | Default | Description |
|---|---|---|---|
| Value | DateTime? | null | The chosen date and time, two-way bindable via @bind-Value. With TimeZone set it is an instant in UTC (Unspecified is read as UTC, Local is converted) and the picker raises UTC values. A value from the parent that is not available is corrected by ValidationFallback, which raises ValueChanged and OnInvalidValue. |
| DefaultValue | DateTime? | null | Seeds an empty Value once, when the picker first renders (raising ValueChanged), e.g. DateTime.Now. Without it the field starts empty and the popup opens at the current date and time. |
| MinDateTime | DateTime? | null | Earliest selectable date and time (same kind as Value). Ignored, with a warning logged once, when it is after MaxDateTime. |
| MaxDateTime | DateTime? | null | Latest selectable date and time (same kind as Value). |
| MinTime | TimeOnly? | null | Start of the daily time window, e.g. 09:00. With MaxTime earlier than MinTime the window runs over midnight. |
| MaxTime | TimeOnly? | null | End of the daily time window (inclusive), e.g. 17:00. |
| IsDateDisabled | Func<DateOnly, bool>? | null | Returns true for days that cannot be chosen, e.g. weekends or holidays. An exception is logged once and the day treated as available. |
| IsDateTimeDisabled | Func<DateTime, bool>? | null | Returns true for single date-times that cannot be chosen, e.g. a lunch break. Called with the wall-clock time (in TimeZone when set) for every time the popup offers, so keep it cheap. |
| ValidationFallback | DwsDateValidationFallback | DwsDateValidationFallback.Clamp | What happens to a value that is not available: Clamp moves it to the nearest available time (within a year), RejectKeepPrevious keeps the last available value, RejectClearToNull clears it. |
| Format | string? | null ("g") | .NET date and time format for showing the value and reading typed input, e.g. "MM/dd/yyyy HH:mm". Input in the culture's general formats is accepted too. An invalid format falls back to "g" (logged once). |
| MinuteStep | int | 5 | Interval of the popup's minute list, 1 to 60 (otherwise 5, logged once). Typed input may still use any minute. |
| TimeZone | TimeZoneInfo? | null | Zone the value is shown and edited in, two-way bindable via @bind-TimeZone. Value, MinDateTime and MaxDateTime are then instants (UTC); restrictions apply to the zone's wall-clock time, and times skipped by daylight saving cannot be picked. |
| TimeZones | IReadOnlyList<TimeZoneInfo>? | null | Zones offered in the popup to switch TimeZone. No list, no selector. |
| ShowTimeZone | bool | true | Shows the name of TimeZone under the field. |
| ShowWeekNumbers | bool | false | Shows the week number in front of every week of the calendar, by the current culture's rule (ISO 8601 weeks where the week starts on Monday and week 1 is the first with four days; otherwise the culture's own rule). The numbers are row headers: not focusable and not clickable. |
| Label | string | string.Empty | Floating label of the field. |
| IconLabel | string | string.Empty | Icon class in front of the label, e.g. Icons.BS.Calendar. |
| Behavior | DwsPickerBehavior | DwsPickerBehavior.EditableDialog | EditableDialog: type or use the popup (button, Alt+ArrowDown). OnlyDialog: the field opens the popup and cannot be typed in. OnlyEditable: typing only. |
| Readonly | bool | false | Shows the value without typing or popup. |
| Hidden | bool | false | Hides the field while keeping the component and its value. |
| Autofocus | bool | false | Focuses the field when it renders. |
| Tooltip | string | string.Empty | Tooltip text of the field. |
| 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 | Colours border and label for INFO, WARNING or ERROR; ERROR also marks the field aria-invalid. |
| Haptic | DwsHapticFeedback | DwsHapticFeedback.Selection | Tactile feedback for a tap on a day, an hour, a minute or Now / Today in the popup, while the app has haptics switched on (IDwsHapticService). Clear and Done play a light tap unless this is None. Played inside the tap, so it works on iOS too. |
| DateOnlyMode | bool | false | A date without a time: the popup has no hour and minute lists, and picking a day commits it and closes the popup. |
| CompactSheet | bool | true | Below 576 px of window width the popup docks to the bottom of the screen at full width, with finger-sized days. |
| ApplyValidationFallback | bool | true | Set to false for a host that validates the value itself: the popup still greys out and refuses what is not available, but a typed value is left to the host. |
| InputAttributes | IReadOnlyDictionary<string, object>? | null | Extra attributes for the text field itself, for example data-* or aria-*. AdditionalAttributes go to the root element; attributes the picker sets itself win. |
| ValueExpression | Expression<Func<DateTime?>>? | null | The bound field, set by @bind-Value. Under static SSR the picker is the browser's datetime-local input named after it (Model.Appointment). |
| Name | Typ | Description |
|---|---|---|
| ValueChanged | EventCallback<DateTime?> | Raised when the value changes: typed, picked, cleared or corrected. |
| OnInvalidValue | EventCallback<DateTime> | Raised with the refused value whenever ValidationFallback had to step in. |
| TimeZoneChanged | EventCallback<TimeZoneInfo?> | Raised when a zone is picked in the popup. |
| OnBlur | EventCallback<DateTime?> | Raised with the current value when the text field loses focus. |
| OnPopupToggled | EventCallback<bool> | Raised with true when the popup opens and false when it closes. |
| 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. |
