View as Markdown

API reference: @salmonui/inputs/slider

SliderPropsinterface

import type { SliderProps } from '@salmonui/inputs/slider';
interface SliderProps<T extends SliderValue = number> extends FieldCommonProps {
    readonly value?: T | undefined;
    readonly defaultValue?: T | undefined;
    readonly onValueChange?: ((value: SliderValueOf<T>, details: SliderChangeDetails) => void) | undefined;
    readonly onValueCommit?: ((value: SliderValueOf<T>, details: SliderChangeDetails) => void) | undefined;
    readonly min?: number | undefined;
    readonly max?: number | undefined;
    readonly step?: number | undefined;
    readonly pageStep?: number | undefined;
    readonly values?: readonly SliderScalar[] | undefined;
    readonly minStepsBetweenThumbs?: number | undefined;
    readonly fill?: boolean | undefined;
    readonly orientation?: 'horizontal' | 'vertical' | undefined;
    readonly ticks?: SliderTicks | undefined;
    readonly renderTick?: ((ctx: SliderTickContext) => ReactNode) | undefined;
    readonly valueLabel?: SliderValueLabel | undefined;
    readonly formatOptions?: Intl.NumberFormatOptions | undefined;
    readonly locale?: string | undefined;
    readonly limits?: SliderLimits | undefined;
    readonly name?: string | undefined;
    readonly form?: string | undefined;
    readonly disabled?: boolean | undefined;
    readonly readOnly?: boolean | undefined;
    readonly localeText?: SliderLocaleText | undefined;
    readonly id?: string | undefined;
    readonly dir?: 'ltr' | 'rtl' | 'auto' | undefined;
    readonly className?: string | undefined;
    readonly style?: CSSProperties | undefined;
    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;
    readonly ref?: Ref<HTMLDivElement> | undefined;
}
SliderProps members (36, 7 inherited)
NameSignatureDescription
valueoptionalreadonly value?: T | undefined;

Controlled value: a number (or values entry), or [start, end] for two thumbs.

defaultValueoptionalreadonly defaultValue?: T | undefined;

Default min ([min, max] for a range is chosen by passing a tuple).

onValueChangeoptionalreadonly onValueChange?: ((value: SliderValueOf<T>, details: SliderChangeDetails) => void) | undefined;

While the value changes; at most once per animation frame during a drag.

onValueCommitoptionalreadonly onValueCommit?: ((value: SliderValueOf<T>, details: SliderChangeDetails) => void) | undefined;

When a drag ends (pointerup) or a key is released.

minoptionalreadonly min?: number | undefined;

Default 0.

maxoptionalreadonly max?: number | undefined;

Default 100.

stepoptionalreadonly step?: number | undefined;

Default 1.

pageStepoptionalreadonly pageStep?: number | undefined;

PageUp / PageDown distance. Default a tenth of the range rounded to step (at least step).

valuesoptionalreadonly values?: readonly SliderScalar[] | undefined;

Discrete entries; the value is an entry and min / max / step are ignored.

minStepsBetweenThumbsoptionalreadonly minStepsBetweenThumbs?: number | undefined;

Smallest distance between the thumbs of a range, in steps. Default 0.

filloptionalreadonly fill?: boolean | undefined;

Fills the track from min to the thumb. A range always fills between its thumbs.

orientationoptionalreadonly orientation?: 'horizontal' | 'vertical' | undefined;
ticksoptionalreadonly ticks?: SliderTicks | undefined;
renderTickoptionalreadonly renderTick?: ((ctx: SliderTickContext) => ReactNode) | undefined;

Tick content; default the label of major ticks.

valueLabeloptionalreadonly valueLabel?: SliderValueLabel | undefined;
formatOptionsoptionalreadonly formatOptions?: Intl.NumberFormatOptions | undefined;

Intl.NumberFormat options of aria-valuetext and the default labels.

localeoptionalreadonly locale?: string | undefined;

Formatting locale. Default 'en-US'; the host locale is never read.

limitsoptionalreadonly limits?: SliderLimits | undefined;
nameoptionalreadonly name?: string | undefined;
formoptionalreadonly form?: string | undefined;
disabledoptionalreadonly disabled?: boolean | undefined;
readOnlyoptionalreadonly readOnly?: boolean | undefined;

Focusable, announced, but not changeable.

localeTextoptionalreadonly localeText?: SliderLocaleText | undefined;
idoptionalreadonly id?: string | undefined;
diroptionalreadonly dir?: 'ltr' | 'rtl' | 'auto' | undefined;
classNameoptionalreadonly className?: string | undefined;
styleoptionalreadonly style?: CSSProperties | undefined;
classNamesoptionalreadonly 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: root is className.

refoptionalreadonly ref?: Ref<HTMLDivElement> | undefined;

The root element.

labeloptionalinheritedlabel?: ReactNode;
descriptionoptionalinheriteddescription?: ReactNode;
errorMessageoptionalinheritederrorMessage?: ((ctx: { readonly errors: readonly string[]; }) => ReactNode) | ReactNode;

Error text (or a function of the errors) shown while the field is invalid.

invalidoptionalinheritedinvalid?: boolean;

Forces the error state.

validationoptionalinheritedvalidation?: FieldValidation;

Rules in the Data Grid vocabulary.

validateOnoptionalinheritedvalidateOn?: ValidateOn;

When errors appear; default the Form's, else 'blur'.

sizeoptionalinheritedsize?: FieldSize;

Metric set. Default 'md'.