API reference: @salmonui/inputs/slider
Slidercomponent
import { Slider } from '@salmonui/inputs/slider';function Slider<T extends SliderValue = number>(props: SliderProps<T>): ReactNode;
Slider: single or two-thumb range on native range inputs,
ticks, value labels, limits, vertical orientation and RTL mirroring.
ref is the root element.
Props: SliderProps
| Name | Signature | Description |
|---|---|---|
valueoptional | readonly value?: T | undefined; | Controlled value: a number (or |
defaultValueoptional | readonly defaultValue?: T | undefined; | Default |
onValueChangeoptional | readonly onValueChange?: ((value: SliderValueOf<T>, details: SliderChangeDetails) => void) | undefined; | While the value changes; at most once per animation frame during a drag. |
onValueCommitoptional | readonly onValueCommit?: ((value: SliderValueOf<T>, details: SliderChangeDetails) => void) | undefined; | When a drag ends (pointerup) or a key is released. |
minoptional | readonly min?: number | undefined; | Default 0. |
maxoptional | readonly max?: number | undefined; | Default 100. |
stepoptional | readonly step?: number | undefined; | Default 1. |
pageStepoptional | readonly pageStep?: number | undefined; | PageUp / PageDown distance. Default a tenth of the range rounded to |
valuesoptional | readonly values?: readonly SliderScalar[] | undefined; | Discrete entries; the value is an entry and |
minStepsBetweenThumbsoptional | readonly minStepsBetweenThumbs?: number | undefined; | Smallest distance between the thumbs of a range, in steps. Default 0. |
filloptional | readonly fill?: boolean | undefined; | Fills the track from |
orientationoptional | readonly orientation?: 'horizontal' | 'vertical' | undefined; | |
ticksoptional | readonly ticks?: SliderTicks | undefined; | |
renderTickoptional | readonly renderTick?: ((ctx: SliderTickContext) => ReactNode) | undefined; | Tick content; default the label of major ticks. |
valueLabeloptional | readonly valueLabel?: SliderValueLabel | undefined; | |
formatOptionsoptional | readonly formatOptions?: Intl.NumberFormatOptions | undefined; |
|
localeoptional | readonly locale?: string | undefined; | Formatting locale. Default |
limitsoptional | readonly limits?: SliderLimits | undefined; | |
nameoptional | readonly name?: string | undefined; | |
formoptional | readonly form?: string | undefined; | |
disabledoptional | readonly disabled?: boolean | undefined; | |
readOnlyoptional | readonly readOnly?: boolean | undefined; | Focusable, announced, but not changeable. |
localeTextoptional | readonly localeText?: SliderLocaleText | undefined; | |
idoptional | readonly id?: string | undefined; | |
diroptional | readonly dir?: 'ltr' | 'rtl' | 'auto' | undefined; | |
classNameoptional | readonly className?: string | undefined; | |
styleoptional | readonly style?: CSSProperties | undefined; | |
classNamesoptional | readonly classNames?: {
readonly label?: string;
readonly control?: string;
readonly track?: string;
readonly range?: string;
readonly thumb?: string;
readonly valueLabel?: string;
readonly ticks?: string;
readonly tick?: string;
readonly description?: string;
readonly error?: string;
} | undefined; | Part classes: |
refoptional | readonly ref?: Ref<HTMLDivElement> | undefined; | The root element. |
labeloptionalinherited | label?: ReactNode; | |
descriptionoptionalinherited | description?: ReactNode; | |
errorMessageoptionalinherited | errorMessage?: ((ctx: { readonly errors: readonly string[]; }) => ReactNode) | ReactNode; | Error text (or a function of the errors) shown while the field is invalid. |
invalidoptionalinherited | invalid?: boolean; | Forces the error state. |
validationoptionalinherited | validation?: FieldValidation; | Rules in the Data Grid vocabulary. |
validateOnoptionalinherited | validateOn?: ValidateOn; | When errors appear; default the |
sizeoptionalinherited | size?: FieldSize; | Metric set. Default |