Bootstrap

API slider

createSlider

function

createSlider(props?): SliderWidget

Create a Slider with given config props

Parameters

props?: PropsConfig<SliderProps>

Returns

SliderWidget

a SliderWidget


getSliderDefaultConfig

function

getSliderDefaultConfig(): SliderProps

Retrieve a shallow copy of the default Slider config

Returns

SliderProps

the default Slider config


HandleDisplayOptions

interface

Options for displaying a handle in a slider component.

Properties
left

left: null | number

Left offset of the handle in %


top

top: null | number

Top offset of the handle in %


ProgressDisplayOptions

interface

Options for displaying progress in a slider component.

Properties
bottom

bottom: null | number

Bottom offset of the progress in %


height

height: number

Height of hte progress in %


left

left: null | number

Right offset of the progress in %


right

right: null | number

Left offset of the progress in %


top

top: null | number

Top offset of the progress in %


width

width: number

Width of the progress in %


Slider

function

Slider(props): Element

Slider component that integrates with a widget context and renders a slot structure.

Parameters

props: PropsWithChildren<Partial<SliderProps>>

The properties for the Slider component.

Returns

Element

The rendered Slider component.

The Slider component uses the useWidgetWithConfig hook to create a widget context with the provided configuration. It then applies the sliderDirective to a div element and renders the slot content using the Slot component.


SliderContext

interface

Represents the context for a Slider component. This type is an alias for WidgetSlotContext<SliderWidget>.

Extended by
Properties
api

api: object

all the api functions to interact with the widget


directives

directives: SliderDirectives

directives to be used on html elements in the template of the widget or in the slots


state

state: SliderState

the state of the widget


SliderDefaultSlotHandle

function

SliderDefaultSlotHandle(slotContext): Element

A functional component that renders a button element with a directive applied to it. The directive is provided through the slotContext parameter.

Parameters

slotContext: SliderSlotHandleContext

The context object containing the directives and item for the slider handle.

Returns

Element

A button element with the applied directive.


SliderDefaultSlotStructure

function

SliderDefaultSlotStructure(slotContext): Element

Renders the default slot structure for the Slider component.

Parameters

slotContext: SliderContext

The context object containing state and directives for the slider.

Returns

Element

The JSX element representing the default slot structure.


SliderDirectives

interface

Interface representing various directives used in the slider component.

Properties
clickableAreaDirective

clickableAreaDirective: Directive

Directive to apply to the slider clickable area, to directly move the handle to a given specific position


combinedHandleLabelDisplayDirective

combinedHandleLabelDisplayDirective: Directive

Directive to apply to the handle when combined label display is active


handleDirective

handleDirective: Directive<object>

Directive to apply to the slider handle if any

Type declaration
item

item: SliderHandle


handleEventsDirective

handleEventsDirective: Directive<object>

Directive to apply handle events handlers

Type declaration
item

item: object

item.id

id: number


handleLabelDisplayDirective

handleLabelDisplayDirective: Directive<object>

Directive to apply to the handle when combined label display is not active

Type declaration
index

index: number


maxLabelDirective

maxLabelDirective: Directive

Directive to get the maxLabel elementRef


minLabelDirective

minLabelDirective: Directive

Directive to get the minLabel elementRef


progressDisplayDirective

progressDisplayDirective: Directive<object>

Directive used to style the progress display for each handle

Type declaration
option

option: ProgressDisplayOptions


sliderDirective

sliderDirective: Directive

Directive to get the slider component elementRef


SliderHandle

interface

Represents a handle in a slider component.

Properties
ariaLabel

ariaLabel: string

ariaLabel of the handle


ariaValueText

ariaValueText: string

ariaValueText of the handle


id

id: number

Handle id


value

value: number

Value of the handle


SliderProps

interface

Represents the properties for the Slider component.

Properties
ariaLabelHandle

ariaLabelHandle: (value, sortedIndex, index) => string

Return the value for the 'aria-label' attribute for the handle

Parameters

value: number

value of the handle

sortedIndex: number

index of the handle in the sorted list

index: number

index of the handle in the original list

Returns

string

Default Value
(value: number) => '' + value

ariaValueText

ariaValueText: (value, sortedIndex, index) => string

Return the value for the 'aria-valuetext' attribute for the handle

Parameters

value: number

value of the handle

sortedIndex: number

index of the handle in the sorted list

index: number

index of the handle in the original list

Returns

string

Default Value
(value: number) => '' + value

className

className: string

CSS classes to be applied on the widget main container

Default Value

''


disabled

disabled: boolean

If true slider value cannot be changed and the slider cannot be focused

Default Value

false


handle

handle: SlotContent<SliderSlotHandleContext>

Slot to change the handlers


label

label: SlotContent<SliderSlotLabelContext>

Slot to change the default labels of the slider

Default Value
({value}: SliderSlotLabelContext) => '' + value

max

max: number

Maximum value that can be assigned to the slider

Default Value

100


min

min: number

Minimum value that can be assigned to the slider

Default Value

0


onValuesChange

onValuesChange: (values) => void

An event emitted when slider values are changed

Event payload equals to the updated slider values

Parameters

values: number[]

Returns

void

Default Value
() => {}

readonly

readonly: boolean

If true slider value cannot be changed but the slider is still focusable

Default Value

false


rtl

rtl: boolean

It true slider display is inversed

Default Value

false


showMinMaxLabels

showMinMaxLabels: boolean

If true the min and max labels are displayed on the slider

Default Value

true


showValueLabels

showValueLabels: boolean

If true the value labels are displayed on the slider

Default Value

true


stepSize

stepSize: number

Unit value between slider steps

Default Value

1


structure

structure: SlotContent<SliderContext>

Slot to change the default display of the slider


values

values: number[]

Current slider values

Default Value

[0]


vertical

vertical: boolean

If true is vertically positioned otherwise it is horizontal

Default Value

false


SliderSlotHandleContext

interface

Represents the context for a slider slot handle. This type extends the SliderContext and includes an additional item property of type SliderHandle.

Properties
api

api: object

all the api functions to interact with the widget


directives

directives: SliderDirectives

directives to be used on html elements in the template of the widget or in the slots


item

item: SliderHandle

the handle context


state

state: SliderState

the state of the widget


SliderSlotLabelContext

interface

Represents the context for a slider slot label, extending the base SliderContext with an additional value property.

Properties
api

api: object

all the api functions to interact with the widget


directives

directives: SliderDirectives

directives to be used on html elements in the template of the widget or in the slots


state

state: SliderState

the state of the widget


value

value: number

the value of the handle the label is attached to


SliderState

interface

Represents the state of a slider component.

Properties
className

className: string

CSS classes to be applied on the widget main container

Default Value

''


combinedLabelDisplay

combinedLabelDisplay: boolean

If true, the label when the handles are close is visible


combinedLabelPositionLeft

combinedLabelPositionLeft: number

Combined label left offset in %


combinedLabelPositionTop

combinedLabelPositionTop: number

Combined label top offset in %


disabled

disabled: boolean

If true slider value cannot be changed and the slider cannot be focused

Default Value

false


handle

handle: SlotContent<SliderSlotHandleContext>

Slot to change the handlers


handleDisplayOptions

handleDisplayOptions: HandleDisplayOptions[]

Array of objects representing handle display options


interactive

interactive: boolean

Check if the slider is interactive, meaning it is not disabled or readonly


label

label: SlotContent<SliderSlotLabelContext>

Slot to change the default labels of the slider

Default Value
({value}: SliderSlotLabelContext) => '' + value

max

max: number

Maximum value that can be assigned to the slider

Default Value

100


maxValueLabelDisplay

maxValueLabelDisplay: boolean

If true, the maximum label will be visible


min

min: number

Minimum value that can be assigned to the slider

Default Value

0


minValueLabelDisplay

minValueLabelDisplay: boolean

If true, the minimum label will be visible


progressDisplayOptions

progressDisplayOptions: ProgressDisplayOptions[]

Array of objects representing progress display options


readonly

readonly: boolean

If true slider value cannot be changed but the slider is still focusable

Default Value

false


rtl

rtl: boolean

It true slider display is inversed

Default Value

false


showMinMaxLabels

showMinMaxLabels: boolean

If true the min and max labels are displayed on the slider

Default Value

true


showValueLabels

showValueLabels: boolean

If true the value labels are displayed on the slider

Default Value

true


sortedHandles

sortedHandles: SliderHandle[]

Array of the sorted handles to display


sortedValues

sortedValues: number[]

Sorted slider values


stepSize

stepSize: number

Unit value between slider steps

Default Value

1


structure

structure: SlotContent<SliderContext>

Slot to change the default display of the slider


values

values: number[]

Current slider values

Default Value

[0]


vertical

vertical: boolean

If true is vertically positioned otherwise it is horizontal

Default Value

false


SliderWidget

type alias

SliderWidget: Widget<SliderProps, SliderState, object, SliderDirectives>

Represents a slider widget component.