Flutter docs
Default skin

Slider

A Slider component for displaying current value and intervals in range.

When to use

Used to input a value within a specified range.

Examples

Basic

Basic slider. When range is true, display as dual thumb mode. When disable is true, the slider will not be interactable.

Slider with icon

You can add an icon beside the slider to make it meaningful.

Event

The onChange callback function will fire when the user changes the slider's value. The onChangeComplete callback function will fire when mouseup or keyup fired.

Vertical

The vertical Slider.

Reverse

Using reverse to render slider reversely.

Multiple handles

Multiple handles combination.

Disabled per handle

Set disabled to an array to individually disable specific handles in range mode. Disabled handles act as movement boundaries that other handles cannot cross.

Slider with InputNumber

Synchronize with InputNumber component.

Customize tooltip

Use tooltip.formatter to format content of Tooltip. If tooltip.formatter is null, hide it.

Graduated slider

Using marks property to mark a graduated slider, use value or defaultValue to specify the position of thumb. When included is false, means that different thumbs are coordinative. when step is null, valid points will only be marks, min and max.

Control visibility of Tooltip

When tooltip.open is true, ToolTip will always show, if set to false the ToolTip will not show, even if dragging or hovering.

Draggable track

Make range track draggable by setting range.draggableTrack.

Dynamic edit nodes

Click to add a node, drag out or press the key to delete the node.

Custom semantic dom styling

You can customize the semantic dom style of Sliders by passing objects/functions through classNames and styles.

API

Slider are exported from @ceebee/ui/client.

Slider

PropertyDescriptionTypeDefaultVersion
classNamesCustomize class for each semantic structure inside the component. Supports object or function.Record<SemanticDOM, string> | (info: { props })=> Record<SemanticDOM, string>-—
defaultValueThe default value of the slider. When range is false, use number, otherwise, use \[number, number]number | \[number, number]0 | \[0, 0]—
disabledIf true, the slider will not be interactive. This prop can also be an array to disable specific handles in range mode, e.g. [true, false, true] disables first and third handles. When any rendered handle is disabled, editable mode will be disabledboolean | boolean[]false—
keyboardSupport using keyboard to move handlersbooleantrue5.2.0+
dotsWhether the thumb can only be dragged to tick marksbooleanfalse—
includedTakes effect when marks is not null. True means containment and false means coordinativebooleantrue—
marksTick marks of Slider. The type of key must be number, and must be in closed interval \[min, max]. Each mark can declare its own styleobject{ number: ReactNode } | { number: { style: CSSProperties, label: ReactNode } }—
maxThe maximum value the slider can slide tonumber100—
minThe minimum value the slider can slide tonumber0—
orientationOrientationhorizontal | verticalhorizontal—
rangeEnable dual thumb mode for range selectionbooleanfalse—
reverseReverse the componentbooleanfalse—
stepThe granularity the slider can step through values. Must be greater than 0, and be divisible by (max - min). When step is null and marks exist, valid points will only be marks, min and maxnumber | null1—
stylesCustomize inline style for each semantic structure inside the component. Supports object or function.Record<SemanticDOM, CSSProperties> | (info: { props })=> Record<SemanticDOM, CSSProperties>-—
tooltipThe tooltip related propstooltip-4.23.0
valueThe value of slider. When range is false, use number, otherwise, use \[number, number]number | \[number, number]-—
verticalIf true, the slider will be vertical. Simultaneously existing with orientation, orientation takes prioritybooleanfalse—
onChangeCompleteFire when mouseup or keyup is fired(value) => void-—
onChangeCallback function that is fired when the user changes the slider's value(value) => void-—
handleStyleStyle of the slider handle, please use styles.handle insteadCSSProperties--
onAfterChangeCallback fired when mouseup or keyup is fired, please use onChangeComplete instead(value) => void--
railStyleStyle of the slider rail, please use styles.rail insteadCSSProperties--
trackStyleStyle of the slider track, please use styles.track insteadCSSProperties--

range

PropertyDescriptionTypeDefaultVersion
draggableTrackWhether range track can be draggedbooleanfalse-
editableDynamic edit nodes. Cannot be used with draggableTrackbooleanfalse5.20.0
minCountThe minimum count of nodesnumber05.20.0
maxCountThe maximum count of nodesnumber-5.20.0

tooltip

PropertyDescriptionTypeDefaultVersion
autoAdjustOverflowWhether to automatically adjust the popup positionbooleantrue5.8.0
openIf true, Tooltip will always be visible; if false, it will never be visible, even when dragging or hoveringboolean-4.23.0
placementSet Tooltip display position. Ref Tooltipstring-4.23.0
getPopupContainerThe DOM container of the Tooltip. The default behavior is to create a div element in the body(triggerNode) => HTMLElement() => document.body4.23.0
formatterSlider will pass its value to formatter, display its value in Tooltip, and hide the Tooltip when the returned value is nullvalue => ReactNode | nullIDENTITY4.23.0
blur()Remove focus———
focus()Get focus———