Slider

As defined by the W3C:

A slider is an input where the user selects a value from within a given range. Sliders typically have a slider thumb that can be moved along a bar, rail, or track to change the value of the slider.

An implementation of a range slider. Note that if the slider is in vertical orientation by default the component will get a height using the css var --fluent-slider-height, by default that equates to (10px * var(--thumb-size)) or 160px. Inline styles will override that height.

The <FluentSlider> uses the <FluentSliderLabel> component for the labels shown.

<FluentSlider> wraps the <fluent-slider> element, a web component implementation of a range slider leveraging the Fluent UI design system.

Examples

Toggle orientation

Example
Toggle orientation 0℃ 10℃ 90℃ 100℃

Selected value: 70

Download: 

Value is of type double

Example
-1℃ 1.5℃ 5℃ 6℃

Selected value: 3.5

Download: 

Vertical slider

Example
0℃ 10℃ 90℃ 100℃
Download: 

Labels

Example

Text labels

10℃ 90℃
Custom labels and rtl support
10 20 40 60 80
Download: 

Thumbs

Example

Custom thumb

0 10 20 30 40 50 60 70 80 90 100
Custom labels and thumb and hidden marks on labels
50
Download: 

States

Example
Disabled
0 10 20 30 40 50 60 70 80 90 100
Read Only
0 10 20 30 40 50 60 70 80 90 100
Download: 

Documentation

FluentSlider<TValue> Class

Inherits from FluentInputBase<TValue>.
There might be parameters and/or methods shown here that are inherited from the component's base type but are not applicable to this component.

TValue can be one of the following Type's:
  • int
  • long
  • short
  • float
  • double
  • decimal

Parameters

Name
Type
Default
Description
AriaLabelstring?
Gets or sets the text used on aria-label attribute.
Autofocusbool
False
Determines if the element should receive document focus on page load.
ChildContentRenderFragment?
Gets or sets the content to be rendered inside the component.
Disabledbool
False
Disables the form control, ensuring it doesn't participate in form submission.
DisplayNamestring?
Gets or sets the display name for this field.
This value is used when generating error messages when the input value fails to parse correctly.
Embeddedbool
False
Gets or sets if the derived component is embedded in another component.
If true, the ClassValue property will not include the EditContext's FieldCssClass.
FieldFieldIdentifier?
Gets or sets the FluentInputBase.FieldIdentifier that identifies the bound value.
If set, this parameter takes precedence over FluentInputBase.ValueExpression.
Immediatebool
False
Change the content of this input field when the user write text (based on 'OnInput' HTML event).
ImmediateDelayint
0
Gets or sets the delay, in milliseconds, before to raise the FluentInputBase.ValueChanged event.
Labelstring?
Gets or sets the text to label the input.
This is usually displayed just above the input
LabelTemplateRenderFragment?
Gets or sets the content to label the input component.
This is usually displayed just above the input
MaxTValue?
Gets or sets the slider's maximum value.
MinTValue?
Gets or sets the slider's minimal value.
ModeSliderMode?
Gets or sets the selection mode.
Namestring?
Gets or sets the name of the element.
Allows access by name from the associated form.
⚠️ This value needs to be set manually for SSR scenarios to work correctly.
OrientationOrientation?
Gets or sets the orientation of the slider. See Orientation
Placeholderstring?
Gets or sets the short hint displayed in the input before the user enters a value.
ReadOnlybool
False
When true, the control will be immutable by user interaction. readonly HTML attribute for more information.
Requiredbool
False
Gets or sets a value indicating whether the element needs to have a value.
StepTValue?
Gets or sets the slider's step value.
ValueTValue?
Gets or sets the value of the input. This should be used with two-way binding.
ValueExpressionExpression<Func<TValue>>?
Gets or sets an expression that identifies the bound value.

EventCallbacks

Name
Type
Description
ValueChangedEventCallback<TValue>
Gets or sets a callback that updates the bound value.

Methods

Name
Parameters
Type
Description
DisposeAsyncValueTask
FocusAsyncvoid
Exposes the elements FocusAsync(bool preventScroll) method.
FocusAsyncbool preventScroll
void
Exposes the elements FocusAsync(bool preventScroll) method.

FluentSliderLabel<TValue> Class

Parameters

Name
Type
Default
Description
ChildContentRenderFragment?
Gets or sets the content to be rendered inside the component.
Disabledbool?
Gets the disabled state of the label. This is controlled by the owning FluentSlider.
HideMarkbool?
Gets or sets a value indicating whether marks are hidden.
PositionTValue?
Gets or sets the value for this slider position.

Methods

Name
Parameters
Type
Description
DisposeAsyncValueTask
SingleValue
Horizontal
Vertical
An error has occurred. This application may no longer respond until reloaded. Reload 🗙