Class MudPicker<T>
- Namespace
- MudBlazor
- Assembly
- MudBlazor.dll
A component for selecting date, time, and color values.
public class MudPicker<T> : MudFormComponent<T, string>, IComponent, IHandleEvent, IHandleAfterRender, IMudStateHasChanged, IFormComponent, IAsyncDisposable
Type Parameters
T
The type of value being chosen.
- Inheritance
-
MudPicker<T>
- Implements
- Derived
- Inherited Members
- Extension Methods
Constructors
MudPicker()
public MudPicker()
MudPicker(Converter<T, string>)
protected MudPicker(Converter<T, string> converter)
Parameters
Fields
_inputReference
protected MudTextField<string>? _inputReference
Field Value
_mask
protected IMask? _mask
Field Value
Properties
ActionsClass
The CSS classes applied to the action buttons container.
[Parameter]
[Category("Picker appearance")]
public string? ActionsClass { get; set; }
Property Value
Remarks
Multiple classes must be separated by a space.
ActionsClassname
protected string ActionsClassname { get; }
Property Value
Adornment
The location of the AdornmentIcon for the input.
[Parameter]
[Category("Behavior")]
public Adornment Adornment { get; set; }
Property Value
Remarks
Defaults to End.
AdornmentAriaLabel
The aria-label
for the adornment.
[Parameter]
[Category("Appearance")]
public string? AdornmentAriaLabel { get; set; }
Property Value
Remarks
Defaults to null
.
AdornmentColor
The color of the AdornmentIcon.
[Parameter]
[Category("Appearance")]
public Color AdornmentColor { get; set; }
Property Value
Remarks
Defaults to Default.
AdornmentIcon
The icon shown next to the text input.
[Parameter]
[Category("Behavior")]
public string AdornmentIcon { get; set; }
Property Value
Remarks
Defaults to Event.
AnchorOrigin
The location the popover opens, relative to its container.
[Parameter]
[Category("Appearance")]
public Origin AnchorOrigin { get; set; }
Property Value
Remarks
Defaults to BottomLeft.
Clearable
Displays the Clear icon button.
[Parameter]
[Category("Behavior")]
public bool Clearable { get; set; }
Property Value
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.
Color
The color of the toolbar, selected, and active values.
[Parameter]
[Category("Picker appearance")]
public Color Color { get; set; }
Property Value
Remarks
Defaults to Primary.
Disabled
Prevents the user from interacting with this button.
[Parameter]
[Category("Behavior")]
public bool Disabled { get; set; }
Property Value
Remarks
Defaults to false
.
Editable
Allows the value to be edited.
[Parameter]
[Category("Behavior")]
public bool Editable { get; set; }
Property Value
Remarks
Defaults to false
.
Elevation
The size of the drop shadow.
[Parameter]
[Category("Picker appearance")]
public int? Elevation { get; set; }
Property Value
- int?
Remarks
Defaults to 8
for inline pickers; otherwise 0
.
A higher number creates a heavier drop shadow. Use a value of 0
for no shadow.
HelperText
The text displayed below the text field.
[Parameter]
[Category("Behavior")]
public string? HelperText { get; set; }
Property Value
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.
HelperTextOnFocus
Displays the HelperText only when this input has focus.
[Parameter]
[Category("Behavior")]
public bool HelperTextOnFocus { get; set; }
Property Value
Remarks
Defaults to false
.
IconSize
The size of the icon in the input field.
[Parameter]
[Category("Appearance")]
public Size IconSize { get; set; }
Property Value
Remarks
Defaults to Medium.
ImmediateText
[Parameter]
[Category("Behavior")]
public bool ImmediateText { get; set; }
Property Value
Remarks
Defaults to false
.
When false
, Text is only updated when pressing Enter
or upon loss of focus.
InputContent
protected virtual RenderFragment? InputContent { get; }
Property Value
Label
The label for this input.
[Parameter]
[Category("Behavior")]
public string? Label { get; set; }
Property Value
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.
Margin
Applies vertical spacing.
[Parameter]
[Category("Appearance")]
public Margin Margin { get; set; }
Property Value
Mask
The mask to apply to input values when Editable is true
.
[Parameter]
[Category("Behavior")]
public IMask? Mask { get; set; }
Property Value
OnClick
Occurs when the text input has been clicked.
[Parameter]
public EventCallback<MouseEventArgs> OnClick { get; set; }
Property Value
Open
protected bool Open { get; set; }
Property Value
Orientation
The orientation of the picker when PickerVariant is Static.
[Parameter]
[Category("Picker appearance")]
public Orientation Orientation { get; set; }
Property Value
Remarks
Defaults to Portrait.
OverflowBehavior
The behavior of the popover when it overflows its container.
[Parameter]
[Category("Appearance")]
public OverflowBehavior OverflowBehavior { get; set; }
Property Value
Remarks
Defaults to FlipOnOpen.
PickerActions
The custom action buttons to display.
[Parameter]
[Category("Picker behavior")]
public RenderFragment<MudPicker<T>>? PickerActions { get; set; }
Property Value
PickerClassname
protected string PickerClassname { get; }
Property Value
PickerClosed
Occurs when this picker has closed.
[Parameter]
public EventCallback PickerClosed { get; set; }
Property Value
PickerContainerClassname
protected string PickerContainerClassname { get; }
Property Value
PickerContent
Gets the content to be rendered inside the picker. Override this property to provide custom content for the picker.
protected virtual RenderFragment? PickerContent { get; }
Property Value
PickerInlineClassname
protected string PickerInlineClassname { get; }
Property Value
PickerInputClassname
protected string PickerInputClassname { get; }
Property Value
PickerOpened
Occurs when this picker has opened.
[Parameter]
public EventCallback PickerOpened { get; set; }
Property Value
PickerPaperClassname
protected string PickerPaperClassname { get; }
Property Value
PickerPaperStylename
protected string PickerPaperStylename { get; }
Property Value
PickerVariant
The display variant for this picker.
[Parameter]
[Category("Behavior")]
public PickerVariant PickerVariant { get; set; }
Property Value
Remarks
Placeholder
The text displayed in the input if no value is specified.
[Parameter]
[Category("Behavior")]
public string? Placeholder { get; set; }
Property Value
Remarks
This property is typically used to give the user a hint as to what kind of input is expected.
PopoverClassname
protected string PopoverClassname { get; }
Property Value
ReadOnly
Prevents the input from being changed by the user.
[Parameter]
[Category("Behavior")]
public bool ReadOnly { get; set; }
Property Value
Remarks
Defaults to false
.
When true
, the user can copy text in the control, but cannot change the value.
RelativeWidth
Determines the width of the Popover dropdown in relation the parent container.
[Parameter]
[Category("Appearance")]
public DropdownWidth RelativeWidth { get; set; }
Property Value
Remarks
Defaults to Ignore.
When Relative, restricts the max-width of the component to the width of the parent container
When Adaptive, restricts the min-width of the component to the width of the parent container
Render
protected virtual RenderFragment? Render { get; }
Property Value
Rounded
Shows rounded corners.
[Parameter]
[Category("Picker appearance")]
public bool Rounded { get; set; }
Property Value
Remarks
Defaults to false
.
Can be overridden by Rounded.
When true
, the border-radius
style is set to the theme's default value.
ShowToolbar
Shows the toolbar.
[Parameter]
[Category("Picker appearance")]
public bool ShowToolbar { get; set; }
Property Value
Remarks
Defaults to true
.
Square
Disables rounded corners.
[Parameter]
[Category("Picker appearance")]
public bool Square { get; set; }
Property Value
Remarks
Defaults to false
.
Can be overridden by Rounded.
Text
The currently selected value, as a string.
[Parameter]
[Category("Data")]
public string? Text { get; set; }
Property Value
TextChanged
Occurs when Text has changed.
[Parameter]
public EventCallback<string> TextChanged { get; set; }
Property Value
ToolbarClass
The CSS classes for the toolbar when ShowToolbar is true
.
[Parameter]
[Category("Picker appearance")]
public string? ToolbarClass { get; set; }
Property Value
Remarks
Multiple classes must be separated by spaces.
TransformOrigin
The direction the popover opens, relative to its container.
[Parameter]
[Category("Appearance")]
public Origin TransformOrigin { get; set; }
Property Value
Remarks
Defaults to TopLeft.
Underline
Shows an underline under the input text.
[Parameter]
[Category("Appearance")]
public bool Underline { get; set; }
Property Value
Remarks
Defaults to true
.
Variant
The display variant of the text input.
[Parameter]
[Category("Appearance")]
public Variant Variant { get; set; }
Property Value
Remarks
Defaults to Text.
Methods
BlurAsync()
Releases focus for the input.
public virtual ValueTask BlurAsync()
Returns
BuildRenderTree(RenderTreeBuilder)
protected override void BuildRenderTree(RenderTreeBuilder __builder)
Parameters
__builder
RenderTreeBuilder
ClearAsync(bool)
Hides this picker.
public virtual Task ClearAsync(bool close = true)
Parameters
close
boolWhen
true
, the picker will be closed if PickerVariant is not Static.
Returns
CloseAsync(bool)
Closes this picker.
public Task CloseAsync(bool submit = true)
Parameters
submit
boolWhen
true
, the value is committed.
Returns
DisposeAsyncCore()
Called to dispose this instance.
protected override ValueTask DisposeAsyncCore()
Returns
FocusAsync()
Focuses the input.
public virtual ValueTask FocusAsync()
Returns
GetDisabledState()
protected bool GetDisabledState()
Returns
GetReadOnlyState()
protected bool GetReadOnlyState()
Returns
OnAfterRenderAsync(bool)
protected override Task OnAfterRenderAsync(bool firstRender)
Parameters
firstRender
bool
Returns
OnClosedAsync()
protected virtual Task OnClosedAsync()
Returns
OnHandleKeyDownAsync(KeyboardEventArgs)
protected virtual Task OnHandleKeyDownAsync(KeyboardEventArgs args)
Parameters
args
KeyboardEventArgs
Returns
OnInitialized()
protected override void OnInitialized()
OnOpenedAsync()
protected virtual Task OnOpenedAsync()
Returns
OnPickerClosedAsync()
protected virtual Task OnPickerClosedAsync()
Returns
OnPickerOpenedAsync()
protected virtual Task OnPickerOpenedAsync()
Returns
OpenAsync()
Displays this picker.
public Task OpenAsync()
Returns
ResetValueAsync()
protected override Task ResetValueAsync()
Returns
SelectAsync()
Selects the input content.
public virtual ValueTask SelectAsync()
Returns
SelectRangeAsync(int, int)
Selects a portion of the input content.
public virtual ValueTask SelectRangeAsync(int pos1, int pos2)
Parameters
pos1
intThe index of the first character to select.
pos2
intThe index of the last character to select.
Returns
SetTextAsync(string?, bool)
protected Task SetTextAsync(string? value, bool callback)
Parameters
Returns
StringValueChangedAsync(string?)
Occurs when the string value has changed.
protected virtual Task StringValueChangedAsync(string? value)
Parameters
value
string
Returns
SubmitAsync()
protected virtual Task SubmitAsync()
Returns
ToggleOpenAsync()
Opens or closes this picker.
public Task ToggleOpenAsync()
Returns
ToggleStateAsync()
protected Task ToggleStateAsync()