Table of Contents

Class MudPicker<T>

Namespace
MudBlazor
Assembly
MudBlazor.dll

Represents a common form component for selecting date, time, and color values.

public class MudPicker<T> : MudFormComponent<T, string>, IComponent, IHandleEvent, IHandleAfterRender, IMudStateHasChanged, IFormComponent, IDisposable

Type Parameters

T

The type of value being chosen.

Inheritance
MudPicker<T>
Implements
Derived
Inherited Members
Extension Methods

Constructors

MudPicker()

Creates a new instance.

public MudPicker()
See Also

MudPicker(Converter<T, string>)

protected MudPicker(Converter<T, string> converter)

Parameters

converter Converter<T, string>
See Also

Fields

_inputReference

protected MudTextField<string> _inputReference

Field Value

MudTextField<string>
See Also

_keyInterceptor

protected IKeyInterceptor _keyInterceptor

Field Value

IKeyInterceptor
See Also

_mask

protected IMask _mask

Field Value

IMask
See Also

Properties

ActionsClass

The CSS classes applied to the action buttons container.

[Parameter]
[Category("Picker appearance")]
public string ActionsClass { get; set; }

Property Value

string

Remarks

Multiple classes must be separated by a space.

See Also

ActionsClassname

protected string ActionsClassname { get; }

Property Value

string
See Also

Adornment

The location of the AdornmentIcon for the input.

[Parameter]
[Category("Behavior")]
public Adornment Adornment { get; set; }

Property Value

Adornment

Remarks

Defaults to End.

See Also

AdornmentAriaLabel

The aria-label for the adornment.

[Parameter]
[Category("Appearance")]
public string AdornmentAriaLabel { get; set; }

Property Value

string

Remarks

Defaults to null.

See Also

AdornmentColor

The color of the AdornmentIcon.

[Parameter]
[Category("Appearance")]
public Color AdornmentColor { get; set; }

Property Value

Color

Remarks

Defaults to Default.

See Also

AdornmentIcon

The icon shown next to the text input.

[Parameter]
[Category("Behavior")]
public string AdornmentIcon { get; set; }

Property Value

string

Remarks

Defaults to Event.

See Also

AnchorOrigin

The location the popover opens, relative to its container.

[Parameter]
[Category("Appearance")]
public Origin AnchorOrigin { get; set; }

Property Value

Origin

Remarks

Defaults to TopLeft.

See Also

Clearable

Displays the Clear icon button.

[Parameter]
[Category("Behavior")]
public bool Clearable { get; set; }

Property Value

bool

Remarks

Defaults to false.
When true, an icon is displayed which, when clicked, clears the Text and Value. Use the ClearIcon property to control the Clear button icon.

See Also

Color

The color of the toolbar, selected, and active values.

[Parameter]
[Category("Picker appearance")]
public Color Color { get; set; }

Property Value

Color

Remarks

Defaults to Primary.

See Also

Disabled

Prevents the user from interacting with this button.

[Parameter]
[Category("Behavior")]
public bool Disabled { get; set; }

Property Value

bool

Remarks

Defaults to false.

See Also

Editable

Allows the value to be edited.

[Parameter]
[Category("Behavior")]
public bool Editable { get; set; }

Property Value

bool

Remarks

Defaults to false.

See Also

Elevation

The size of the drop shadow.

[Parameter]
[Category("Picker appearance")]
public int Elevation { get; set; }

Property Value

int

Remarks

Defaults to 8.
A higher number creates a heavier drop shadow. Use a value of 0 for no shadow.

See Also

HelperText

The text displayed below the text field.

[Parameter]
[Category("Behavior")]
public string HelperText { get; set; }

Property Value

string

Remarks

This property is typically used to help the user understand what kind of input is allowed. The HelperTextOnFocus property controls when this text is visible.

See Also

HelperTextOnFocus

Displays the HelperText only when this input has focus.

[Parameter]
[Category("Behavior")]
public bool HelperTextOnFocus { get; set; }

Property Value

bool

Remarks

Defaults to false.

See Also

IconSize

The size of the icon in the input field.

[Parameter]
[Category("Appearance")]
public Size IconSize { get; set; }

Property Value

Size

Remarks

Defaults to Medium.

See Also

ImmediateText

Updates Text immediately upon typing when Editable is true.

[Parameter]
[Category("Behavior")]
public bool ImmediateText { get; set; }

Property Value

bool

Remarks

Defaults to false.
When false, Text is only updated when pressing Enter or upon loss of focus.

See Also

InputContent

protected virtual RenderFragment InputContent { get; }

Property Value

RenderFragment
See Also

Label

The label for this input.

[Parameter]
[Category("Behavior")]
public string Label { get; set; }

Property Value

string

Remarks

If no value is specified, the label will be displayed in the input. Otherwise, it will be scaled down to the top of the input.

See Also

Margin

Applies vertical spacing.

[Parameter]
[Category("Appearance")]
public Margin Margin { get; set; }

Property Value

Margin
See Also

Mask

The mask to apply to input values when Editable is true.

[Parameter]
[Category("Behavior")]
public IMask Mask { get; set; }

Property Value

IMask
See Also

OnClick

Occurs when the text input has been clicked.

[Parameter]
public EventCallback<MouseEventArgs> OnClick { get; set; }

Property Value

EventCallback<MouseEventArgs>
See Also

Open

protected bool Open { get; set; }

Property Value

bool
See Also

Orientation

The orientation of the picker when PickerVariant is Static.

[Parameter]
[Category("Picker appearance")]
public Orientation Orientation { get; set; }

Property Value

Orientation

Remarks

Defaults to Portrait.

See Also

OverflowBehavior

The behavior of the popover when it overflows its container.

[Parameter]
[Category("Appearance")]
public OverflowBehavior OverflowBehavior { get; set; }

Property Value

OverflowBehavior

Remarks

Defaults to FlipOnOpen.

See Also

PickerActions

The custom action buttons to display.

[Parameter]
[Category("Picker behavior")]
public RenderFragment<MudPicker<T>> PickerActions { get; set; }

Property Value

RenderFragment<MudPicker<T>>
See Also

PickerClassname

protected string PickerClassname { get; }

Property Value

string
See Also

PickerClosed

Occurs when this picker has closed.

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

Property Value

EventCallback
See Also

PickerContainerClassname

protected string PickerContainerClassname { get; }

Property Value

string
See Also

PickerContent

protected virtual RenderFragment PickerContent { get; }

Property Value

RenderFragment
See Also

PickerInlineClassname

protected string PickerInlineClassname { get; }

Property Value

string
See Also

PickerInputClassname

protected string PickerInputClassname { get; }

Property Value

string
See Also

PickerOpened

Occurs when this picker has opened.

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

Property Value

EventCallback
See Also

PickerPaperClassname

protected string PickerPaperClassname { get; }

Property Value

string
See Also

PickerPaperStylename

protected string PickerPaperStylename { get; }

Property Value

string
See Also

PickerVariant

The display variant for this picker.

[Parameter]
[Category("Behavior")]
public PickerVariant PickerVariant { get; set; }

Property Value

PickerVariant

Remarks

Defaults to Inline.
Other values are Dialog and Static.

See Also

Placeholder

The text displayed in the input if no value is specified.

[Parameter]
[Category("Behavior")]
public string Placeholder { get; set; }

Property Value

string

Remarks

This property is typically used to give the user a hint as to what kind of input is expected.

See Also

ReadOnly

Prevents the input from being changed by the user.

[Parameter]
[Category("Behavior")]
public bool ReadOnly { get; set; }

Property Value

bool

Remarks

Defaults to false.
When true, the user can copy text in the control, but cannot change the value.

See Also

Render

protected virtual RenderFragment Render { get; }

Property Value

RenderFragment
See Also

Rounded

Shows rounded corners.

[Parameter]
[Category("Picker appearance")]
public bool Rounded { get; set; }

Property Value

bool

Remarks

Defaults to false.
When true, the border-radius style is set to the theme's default value.

See Also

ShowToolbar

Shows the toolbar.

[Parameter]
[Category("Picker appearance")]
public bool ShowToolbar { get; set; }

Property Value

bool

Remarks

Defaults to true.

See Also

Square

Disables rounded corners.

[Parameter]
[Category("Picker appearance")]
public bool Square { get; set; }

Property Value

bool

Remarks

Defaults to false.

See Also

Text

The currently selected value, as a string.

[Parameter]
[Category("Data")]
public string Text { get; set; }

Property Value

string
See Also

TextChanged

Occurs when Text has changed.

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

Property Value

EventCallback<string>
See Also

ToolbarClass

The CSS classes for the toolbar when ShowToolbar is true.

[Parameter]
[Category("Picker appearance")]
public string ToolbarClass { get; set; }

Property Value

string

Remarks

Multiple classes must be separated by spaces.

See Also

TransformOrigin

The direction the popover opens, relative to its container.

[Parameter]
[Category("Appearance")]
public Origin TransformOrigin { get; set; }

Property Value

Origin

Remarks

Defaults to TopLeft.

See Also

Underline

Shows an underline under the input text.

[Parameter]
[Category("Appearance")]
public bool Underline { get; set; }

Property Value

bool

Remarks

Defaults to true.

See Also

Variant

The display variant of the text input.

[Parameter]
[Category("Appearance")]
public Variant Variant { get; set; }

Property Value

Variant

Remarks

Defaults to Text.

See Also

Methods

BlurAsync()

Releases focus for the input.

public virtual ValueTask BlurAsync()

Returns

ValueTask
See Also

BuildRenderTree(RenderTreeBuilder)

protected override void BuildRenderTree(RenderTreeBuilder __builder)

Parameters

__builder RenderTreeBuilder
See Also

ClearAsync(bool)

Hides this picker.

public virtual Task ClearAsync(bool close = true)

Parameters

close bool

When true, the picker will be closed if PickerVariant is not Static.

Returns

Task
See Also

CloseAsync(bool)

Closes this picker.

public Task CloseAsync(bool submit = true)

Parameters

submit bool

When true, the value is committed.

Returns

Task
See Also

Dispose(bool)

protected override void Dispose(bool disposing)

Parameters

disposing bool
See Also

FocusAsync()

Focuses the input.

public virtual ValueTask FocusAsync()

Returns

ValueTask
See Also

GetDisabledState()

protected bool GetDisabledState()

Returns

bool
See Also

GetReadOnlyState()

protected bool GetReadOnlyState()

Returns

bool
See Also

OnAfterRenderAsync(bool)

protected override Task OnAfterRenderAsync(bool firstRender)

Parameters

firstRender bool

Returns

Task
See Also

OnClosedAsync()

protected virtual Task OnClosedAsync()

Returns

Task
See Also

OnHandleKeyDownAsync(KeyboardEventArgs)

protected virtual Task OnHandleKeyDownAsync(KeyboardEventArgs args)

Parameters

args KeyboardEventArgs

Returns

Task
See Also

OnInitialized()

protected override void OnInitialized()
See Also

OnOpenedAsync()

protected virtual Task OnOpenedAsync()

Returns

Task
See Also

OnPickerClosedAsync()

protected virtual Task OnPickerClosedAsync()

Returns

Task
See Also

OnPickerOpenedAsync()

protected virtual Task OnPickerOpenedAsync()

Returns

Task
See Also

OpenAsync()

Displays this picker.

public Task OpenAsync()

Returns

Task
See Also

ResetValueAsync()

protected override Task ResetValueAsync()

Returns

Task
See Also

SelectAsync()

Selects the input content.

public virtual ValueTask SelectAsync()

Returns

ValueTask
See Also

SelectRangeAsync(int, int)

Selects a portion of the input content.

public virtual ValueTask SelectRangeAsync(int pos1, int pos2)

Parameters

pos1 int

The index of the first character to select.

pos2 int

The index of the last character to select.

Returns

ValueTask
See Also

SetTextAsync(string, bool)

protected Task SetTextAsync(string value, bool callback)

Parameters

value string
callback bool

Returns

Task
See Also

StringValueChangedAsync(string)

Occurs when the string value has changed.

protected virtual Task StringValueChangedAsync(string value)

Parameters

value string

Returns

Task
See Also

SubmitAsync()

protected virtual Task SubmitAsync()

Returns

Task
See Also

ToggleOpenAsync()

Opens or closes this picker.

public Task ToggleOpenAsync()

Returns

Task
See Also

ToggleStateAsync()

protected Task ToggleStateAsync()

Returns

Task
See Also

See Also