Class MudSlider<T>
- Namespace
- MudBlazor
- Assembly
- MudBlazor.dll
A component which allows users to select a value within a specified range.
public class MudSlider<T> : MudComponentBase, IComponent, IHandleEvent, IHandleAfterRender, IMudStateHasChanged where T : struct, INumber<T>
Type Parameters
T
The type of the value the slider represents.
- Inheritance
-
MudSlider<T>
- Implements
- Inherited Members
- Extension Methods
Constructors
MudSlider()
public MudSlider()
Properties
ChildContent
The option content rendered above the slider.
[Parameter]
[Category("Behavior")]
public RenderFragment? ChildContent { get; set; }
Property Value
Remarks
Typically used for displaying text. When the slider is vertical, content is displayed to the left of the slider.
Classname
protected string Classname { get; }
Property Value
Color
The color of this slider.
[Parameter]
[Category("Appearance")]
public Color Color { get; set; }
Property Value
Remarks
Defaults to Primary. Primary
, Secondary
and Tertiary
colors are supported.
Culture
The culture used to format the value label.
[Parameter]
[Category("Appearance")]
public CultureInfo Culture { get; set; }
Property Value
Remarks
Defaults to InvariantCulture. Only applied when ValueLabel is true
.
Disabled
Prevents the user from interacting with this slider.
[Parameter]
[Category("Behavior")]
public bool Disabled { get; set; }
Property Value
Remarks
Defaults to false
.
Immediate
Controls when the value is updated.
[Parameter]
[Category("Behavior")]
public bool Immediate { get; set; }
Property Value
Remarks
Defaults to true
.
When true
, dragging the slider changes Value (or NullableValue) immediately.
When false
, Value (or NullableValue) changes when releasing the handle.
Max
The maximum allowed value.
[Parameter]
[Category("Validation")]
public T Max { get; set; }
Property Value
- T
Remarks
Defaults to 100
. Must be greater than Min.
Min
The minimum allowed value.
[Parameter]
[Category("Validation")]
public T Min { get; set; }
Property Value
- T
Remarks
Defauls to 0
. Must be less than Max.
NullableValue
The nullable value of this slider.
[Parameter]
[Category("Data")]
public T? NullableValue { get; set; }
Property Value
- T?
Remarks
When this value changes, NullableValueChanged occurs.
NullableValueChanged
Occurs when NullableValue has changed.
[Parameter]
public EventCallback<T?> NullableValueChanged { get; set; }
Property Value
- EventCallback<T?>
Size
The size of this slider.
[Parameter]
[Category("Appearance")]
public Size Size { get; set; }
Property Value
Remarks
Defaults to Small.
Step
How much the value changes on each move.
[Parameter]
[Category("Validation")]
public T Step { get; set; }
Property Value
- T
Remarks
Defaults to 1
.
TickMarkLabels
The tick mark labels for each step.
[Parameter]
[Category("Appearance")]
public string[]? TickMarkLabels { get; set; }
Property Value
- string[]
Remarks
Defaults to null
. Only applies when TickMarks is true
.
TickMarks
Displays tick marks along the track.
[Parameter]
[Category("Appearance")]
public bool TickMarks { get; set; }
Property Value
Remarks
Defaults to false
.
Value
The value of this slider.
[Parameter]
[Category("Data")]
public T Value { get; set; }
Property Value
- T
Remarks
Defaults to 0
. When this value changes, ValueChanged occurs.
ValueChanged
Occurs when Value has changed.
[Parameter]
public EventCallback<T> ValueChanged { get; set; }
Property Value
ValueLabel
Displays the value over the slider thumb.
[Parameter]
[Category("Appearance")]
public bool ValueLabel { get; set; }
Property Value
Remarks
Defaults to false
.
ValueLabelContent
The custom content for value labels.
[Parameter]
[Category("Appearance")]
public RenderFragment<SliderContext<T>>? ValueLabelContent { get; set; }
Property Value
Remarks
Use the supplied context to access the current value.
Only applies when ValueLabel is true
and ValueLabelFormat is not set.
ValueLabelFormat
The format of the value label.
[Parameter]
[Category("Appearance")]
public string? ValueLabelFormat { get; set; }
Property Value
Remarks
Defaults to null
.
Only applies when ValueLabelContent is not set.
See: Standard Numeric Format Strings.
Variant
The display variant to use.
[Parameter]
[Category("Appearance")]
public Variant Variant { get; set; }
Property Value
Remarks
Defaults to Text.
Vertical
Displays this slider vertically.
[Parameter]
[Category("Appearance")]
public bool Vertical { get; set; }
Property Value
Remarks
Defaults to false
. When true
, the slider is displayed like a horizontal slider, but rotated 90° counterclockwise.
Methods
BuildRenderTree(RenderTreeBuilder)
protected override void BuildRenderTree(RenderTreeBuilder __builder)
Parameters
__builder
RenderTreeBuilder
OnParametersSet()
protected override void OnParametersSet()