A slider component used to select a numeric value within a range.
- Element
-
igc-slider
- Slots
-
default— Renders slider labels. Their text replaces the numbers in the thumb and tick labels.
- CSS Parts
-
base— The base wrapper of the slider. -
ticks— The ticks container. -
tick-group— The tick group container. -
tick— The tick element. -
tick-label— The tick label element. -
tick-label-inner— The inner element of the tick label. -
thumbs— The thumbs container. -
thumb— The thumb element. -
focused— Added to the thumb part when the thumb has keyboard focus. -
thumb-label— The thumb tooltip label container. -
thumb-label-inner— The thumb tooltip label inner element. -
track— The track container. -
steps— The track steps element. -
inactive— The inactive element of the track. -
fill— The filled part of the track.
Properties
Section titled "Properties"disabled
Section titled "disabled"Inherited from: FormAssociatedMixin( EventEmitterMixin<IgcSliderComponentEventMap, typeof IgcSliderBaseComponent>( IgcSliderBaseComponent ) )
Whether the control is disabled. A disabled control is not validated, and the form does not submit its value.
disabled: boolean Defined in src/internals/mixins/forms/types.ts:35 , src/components/slider/slider-base.ts:225
discreteTrack
Section titled "discreteTrack"Inherited from: FormAssociatedMixin( EventEmitterMixin<IgcSliderComponentEventMap, typeof IgcSliderBaseComponent>( IgcSliderBaseComponent ) )
Whether the track shows the steps. It has no effect when step is 0.
discreteTrack: boolean = false Defined in src/components/slider/slider-base.ts:232
hidePrimaryLabels
Section titled "hidePrimaryLabels"Inherited from: FormAssociatedMixin( EventEmitterMixin<IgcSliderComponentEventMap, typeof IgcSliderBaseComponent>( IgcSliderBaseComponent ) )
Whether the labels of the primary ticks are hidden.
hidePrimaryLabels: boolean = false Defined in src/components/slider/slider-base.ts:289
hideSecondaryLabels
Section titled "hideSecondaryLabels"Inherited from: FormAssociatedMixin( EventEmitterMixin<IgcSliderComponentEventMap, typeof IgcSliderBaseComponent>( IgcSliderBaseComponent ) )
Whether the labels of the secondary ticks are hidden.
hideSecondaryLabels: boolean = false Defined in src/components/slider/slider-base.ts:296
hideTooltip
Section titled "hideTooltip"Inherited from: FormAssociatedMixin( EventEmitterMixin<IgcSliderComponentEventMap, typeof IgcSliderBaseComponent>( IgcSliderBaseComponent ) )
Whether the thumb tooltip is hidden.
hideTooltip: boolean = false Defined in src/components/slider/slider-base.ts:239
invalid
Section titled "invalid"Inherited from: FormAssociatedMixin( EventEmitterMixin<IgcSliderComponentEventMap, typeof IgcSliderBaseComponent>( IgcSliderBaseComponent ) )
Whether the control shows the invalid state. It changes only the visual state, not the validity.
invalid: boolean Defined in src/internals/mixins/forms/types.ts:43
locale
Section titled "locale"Inherited from: FormAssociatedMixin( EventEmitterMixin<IgcSliderComponentEventMap, typeof IgcSliderBaseComponent>( IgcSliderBaseComponent ) )
The locale used to format the thumb and tick label values in the slider.
locale: string = 'en' Defined in src/components/slider/slider-base.ts:303
Inherited from: FormAssociatedMixin( EventEmitterMixin<IgcSliderComponentEventMap, typeof IgcSliderBaseComponent>( IgcSliderBaseComponent ) )
The name of the control, submitted with the form data.
name: string Defined in src/internals/mixins/forms/types.ts:49
primaryTicks
Section titled "primaryTicks"Inherited from: FormAssociatedMixin( EventEmitterMixin<IgcSliderComponentEventMap, typeof IgcSliderBaseComponent>( IgcSliderBaseComponent ) )
The number of primary ticks. It defaults to 0 which means no primary ticks are displayed.
primaryTicks: number = 0 Defined in src/components/slider/slider-base.ts:266
secondaryTicks
Section titled "secondaryTicks"Inherited from: FormAssociatedMixin( EventEmitterMixin<IgcSliderComponentEventMap, typeof IgcSliderBaseComponent>( IgcSliderBaseComponent ) )
The number of secondary ticks between two primary ticks. Without primary ticks, it is the total number of ticks. The default 0 shows no secondary ticks.
secondaryTicks: number = 0 Defined in src/components/slider/slider-base.ts:274
tickLabelRotation
Section titled "tickLabelRotation"Inherited from: FormAssociatedMixin( EventEmitterMixin<IgcSliderComponentEventMap, typeof IgcSliderBaseComponent>( IgcSliderBaseComponent ) )
The degrees for the rotation of the tick labels. Defaults to 0.
tickLabelRotation: SliderTickLabelRotation = 0 Defined in src/components/slider/slider-base.ts:325
tickOrientation
Section titled "tickOrientation"Inherited from: FormAssociatedMixin( EventEmitterMixin<IgcSliderComponentEventMap, typeof IgcSliderBaseComponent>( IgcSliderBaseComponent ) )
Where the ticks are drawn: before the track (start), after it (end),
or on both sides (mirror).
tickOrientation: SliderTickOrientation = 'end' Defined in src/components/slider/slider-base.ts:282
Optional valueFormat
Section titled "valueFormat"Inherited from: FormAssociatedMixin( EventEmitterMixin<IgcSliderComponentEventMap, typeof IgcSliderBaseComponent>( IgcSliderBaseComponent ) )
String format used for the thumb and tick label values in the slider.
The {0} placeholder holds the formatted number.
valueFormat: string Defined in src/components/slider/slider-base.ts:311
Optional valueFormatOptions
Section titled "valueFormatOptions"Inherited from: FormAssociatedMixin( EventEmitterMixin<IgcSliderComponentEventMap, typeof IgcSliderBaseComponent>( IgcSliderBaseComponent ) )
Number format options used for the thumb and tick label values in the slider.
valueFormatOptions: NumberFormatOptions Defined in src/components/slider/slider-base.ts:318
styles
Section titled "styles"Inherited from: FormAssociatedMixin( EventEmitterMixin<IgcSliderComponentEventMap, typeof IgcSliderBaseComponent>( IgcSliderBaseComponent ) )
Array of styles to apply to the element. The styles should be defined using the css tag function, via constructible stylesheets, or imported from native CSS module scripts.
Note on Content Security Policy:
Element styles are implemented with <style> tags when the browser doesn't
support adopted StyleSheets. To use such <style> tags with the style-src
CSP directive, the style-src value must either include 'unsafe-inline' or
nonce-<base64-value> with <base64-value> replaced be a server-generated
nonce.
To provide a nonce to use on generated <style> elements, set
window.litNonce to a server-generated nonce in your page's HTML, before
loading application code:
``
styles: CSSResult[] Defined in src/components/slider/slider-base.ts:99
tagName
Section titled "tagName"The tagName read-only property of the Element interface returns the tag name of the element on which it's called.
tagName: "igc-slider" = 'igc-slider' Defined in src/components/slider/slider.ts:56
Accessors
Section titled "Accessors"defaultValue
Section titled "defaultValue"Inherited from: FormAssociatedMixin( EventEmitterMixin<IgcSliderComponentEventMap, typeof IgcSliderBaseComponent>( IgcSliderBaseComponent ) )
get defaultValue(): any Defined in src/internals/mixins/forms/types.ts:158
The default value of the control. A form reset restores the value to it.
While the value is unchanged since the start or the last form reset, a new
default also sets the value. The value attribute also sets it.
set defaultValue(value: unknown): void Defined in src/internals/mixins/forms/types.ts:158
Parameters
- value:
unknown
Returns void
Inherited from: FormAssociatedMixin( EventEmitterMixin<IgcSliderComponentEventMap, typeof IgcSliderBaseComponent>( IgcSliderBaseComponent ) )
The form that the control is associated with, or null.
get form(): HTMLFormElement | null Defined in src/internals/mixins/forms/types.ts:52
Returns HTMLFormElement | null
lowerBound
Section titled "lowerBound"Inherited from: FormAssociatedMixin( EventEmitterMixin<IgcSliderComponentEventMap, typeof IgcSliderBaseComponent>( IgcSliderBaseComponent ) )
get lowerBound(): any Defined in src/components/slider/slider-base.ts:191
The lower bound of the slider value. If not set, the min value is applied.
set lowerBound(value: number | null | undefined): void Defined in src/components/slider/slider-base.ts:191
Parameters
- value:
number | null | undefined
Returns void
Inherited from: FormAssociatedMixin( EventEmitterMixin<IgcSliderComponentEventMap, typeof IgcSliderBaseComponent>( IgcSliderBaseComponent ) )
get max(): any Defined in src/components/slider/slider-base.ts:178
The maximum value of the slider scale. Defaults to 100.
If max is less than min, the update keeps the previous max. The
update checks the values after all of them are set, so the order of the
attributes has no effect.
With slider labels in the default slot, max is always the number of
labels minus one.
If upperBound is greater than max, the slider uses max as the upper bound.
set max(value: number): void Defined in src/components/slider/slider-base.ts:178
Parameters
- value:
number
Returns void
Inherited from: FormAssociatedMixin( EventEmitterMixin<IgcSliderComponentEventMap, typeof IgcSliderBaseComponent>( IgcSliderBaseComponent ) )
get min(): any Defined in src/components/slider/slider-base.ts:156
The minimum value of the slider scale. Defaults to 0.
If min is greater than max, the update keeps the previous min. The
update checks the values after all of them are set, so the order of the
attributes has no effect.
With slider labels in the default slot, min is always 0.
If lowerBound is less than min, the slider uses min as the lower bound.
set min(value: number): void Defined in src/components/slider/slider-base.ts:156
Parameters
- value:
number
Returns void
Inherited from: FormAssociatedMixin( EventEmitterMixin<IgcSliderComponentEventMap, typeof IgcSliderBaseComponent>( IgcSliderBaseComponent ) )
get step(): any Defined in src/components/slider/slider-base.ts:252
The interval between two valid values, counted from min.
If set to 0 no stepping is implied and any value in the range is allowed. A negative step is not valid, so the previous step stays. With slider labels in the default slot, the step is always 1.
set step(value: number): void Defined in src/components/slider/slider-base.ts:252
Parameters
- value:
number
Returns void
upperBound
Section titled "upperBound"Inherited from: FormAssociatedMixin( EventEmitterMixin<IgcSliderComponentEventMap, typeof IgcSliderBaseComponent>( IgcSliderBaseComponent ) )
get upperBound(): any Defined in src/components/slider/slider-base.ts:208
The upper bound of the slider value. If not set, the max value is applied.
set upperBound(value: number | null | undefined): void Defined in src/components/slider/slider-base.ts:208
Parameters
- value:
number | null | undefined
Returns void
validationMessage
Section titled "validationMessage"Inherited from: FormAssociatedMixin( EventEmitterMixin<IgcSliderComponentEventMap, typeof IgcSliderBaseComponent>( IgcSliderBaseComponent ) )
The validation message of the control. It is empty when the control is valid.
get validationMessage(): string Defined in src/internals/mixins/forms/types.ts:61
Returns string
validity
Section titled "validity"Inherited from: FormAssociatedMixin( EventEmitterMixin<IgcSliderComponentEventMap, typeof IgcSliderBaseComponent>( IgcSliderBaseComponent ) )
The validity state of the control.
get validity(): ValidityState Defined in src/internals/mixins/forms/types.ts:55
Returns ValidityState
value
Section titled "value"get value(): any Defined in src/components/slider/slider.ts:77
The current value of the component.
set value(value: number): void Defined in src/components/slider/slider.ts:77
Parameters
- value:
number
Returns void
willValidate
Section titled "willValidate"Inherited from: FormAssociatedMixin( EventEmitterMixin<IgcSliderComponentEventMap, typeof IgcSliderBaseComponent>( IgcSliderBaseComponent ) )
Whether the control is a candidate for constraint validation.
get willValidate(): boolean Defined in src/internals/mixins/forms/types.ts:64
Returns boolean
Methods
Section titled "Methods"Inherited from: FormAssociatedMixin( EventEmitterMixin<IgcSliderComponentEventMap, typeof IgcSliderBaseComponent>( IgcSliderBaseComponent ) )
Removes focus from the thumb.
blur(): void Defined in src/components/slider/slider-base.ts:414
Returns void
checkValidity
Section titled "checkValidity"Inherited from: FormAssociatedMixin( EventEmitterMixin<IgcSliderComponentEventMap, typeof IgcSliderBaseComponent>( IgcSliderBaseComponent ) )
Checks validity and emits invalid when the control is invalid. Returns
true when the control is valid.
checkValidity(): boolean Defined in src/internals/mixins/forms/types.ts:134
Returns boolean
disconnectedCallback
Section titled "disconnectedCallback"Inherited from: FormAssociatedMixin( EventEmitterMixin<IgcSliderComponentEventMap, typeof IgcSliderBaseComponent>( IgcSliderBaseComponent ) )
Invoked when the component is removed from the document's DOM.
This callback is the main signal to the element that it may no longer be
used. disconnectedCallback() should ensure that nothing is holding a
reference to the element (such as event listeners added to nodes external
to the element), so that it is free to be garbage collected.
``
An element may be re-connected after being disconnected.
disconnectedCallback(): void Defined in src/components/slider/slider-base.ts:394
Returns void
focus
Section titled "focus"Inherited from: FormAssociatedMixin( EventEmitterMixin<IgcSliderComponentEventMap, typeof IgcSliderBaseComponent>( IgcSliderBaseComponent ) )
Sets focus on the thumb, or on the lower thumb of a range slider. A thumb that has the focus keeps it. A disabled slider does not take the focus.
focus(options: FocusOptions): void Defined in src/components/slider/slider-base.ts:405
Parameters
- options:
FocusOptions
Returns void
reportValidity
Section titled "reportValidity"Inherited from: FormAssociatedMixin( EventEmitterMixin<IgcSliderComponentEventMap, typeof IgcSliderBaseComponent>( IgcSliderBaseComponent ) )
Checks validity. As for a native control, an invalid control emits
invalid and takes the focus. It shows its own validation messages, not
the message of the browser. Returns true when the control is valid.
reportValidity(): boolean Defined in src/internals/mixins/forms/types.ts:141
Returns boolean
setCustomValidity
Section titled "setCustomValidity"Inherited from: FormAssociatedMixin( EventEmitterMixin<IgcSliderComponentEventMap, typeof IgcSliderBaseComponent>( IgcSliderBaseComponent ) )
Sets a custom validation message. The control is invalid while the message is not empty. An empty string removes the custom error.
setCustomValidity(message: string): void Defined in src/internals/mixins/forms/types.ts:147
Parameters
- message:
string
Returns void
stepDown
Section titled "stepDown"Decrements the value of the slider by stepDecrement * step, where stepDecrement defaults to 1.
stepDown(stepDecrement: number): void Defined in src/components/slider/slider.ts:134
Parameters
- stepDecrement:
numberOptional step decrement. If no parameter is passed, it defaults to 1.
Returns void
stepUp
Section titled "stepUp"Increments the value of the slider by stepIncrement * step, where stepIncrement defaults to 1.
stepUp(stepIncrement: number): void Defined in src/components/slider/slider.ts:126
Parameters
- stepIncrement:
numberOptional step increment. If no parameter is passed, it defaults to 1.