Table of Contents

Class TwDateTimePicker

Namespace
TwBlazor.Components
Assembly
TwBlazor.dll

Represents a date and time picker component that allows users to select and edit date and time values, supporting both 12-hour and 24-hour formats.

public class TwDateTimePicker : TwBlazorTextInputComponentBase, IComponent, IHandleEvent, IHandleAfterRender, ITwComponent, ITwInputComponent
Inheritance
TwDateTimePicker
Implements
Inherited Members

Remarks

Use the TwDateTimePicker component to provide an interactive UI for selecting date and time values in Blazor applications. The component supports two-way binding for both the selected DateTime value and its string representation, and can be configured to display time in either 12-hour (AM/PM) or 24-hour format. The placeholder text can be customized to guide users when no value is selected.

Constructors

TwDateTimePicker()

public TwDateTimePicker()

Properties

Format

The .NET custom date/time format string used to display and parse SelectedDateTime. Leave unset to fall back to DefaultDateTimeFormat or DefaultDateTimeFormat12Hour depending on Is12HourFormat.

[Parameter]
public string? Format { get; set; }

Property Value

string

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

Remarks

Set this property to true to use 12-hour time representation (with AM/PM); otherwise, 24-hour format will be used. Has no effect when Format is explicitly set.

Placeholder

The placeholder text to display when no date is selected.

[Parameter]
public string Placeholder { get; set; }

Property Value

string

PreferNativePicker

Overrides automatic device detection for whether the browser's native datetime picker should be used instead of the custom popover. Leave unset (null) to auto-detect based on the client platform (iOS and Android use the native picker by default).

[Parameter]
public bool? PreferNativePicker { get; set; }

Property Value

bool?

SelectedDateTime

The selected DateTime value.

[Parameter]
public DateTime SelectedDateTime { get; set; }

Property Value

DateTime

SelectedDateTimeChanged

The selected bound DateTime value.

[Parameter]
public EventCallback<DateTime> SelectedDateTimeChanged { get; set; }

Property Value

EventCallback<DateTime>

Value

The string value displayed in the textbox to the user.

[Parameter]
public string? Value { get; set; }

Property Value

string

ValueChanged

The string bound value displayed in the textbox to the user.

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

Property Value

EventCallback<string>

Methods

BuildRenderTree(RenderTreeBuilder)

Renders the component to the supplied RenderTreeBuilder.

protected override void BuildRenderTree(RenderTreeBuilder __builder)

Parameters

__builder RenderTreeBuilder