Skip to content
v0.2.10

Slider

One value or an ordered range with native keyboard controls on a shared rail.

Preview
Volume

Use Slider

Slider is a named export of @flood-md/react. Connect the package once, then import what you use.

First time here? Connect Flood
Example import style
slider.tsxTSX
"use client";

import { FloodRoot, Slider } from "@flood-md/react";
import "@flood-md/react/styles.css";

export function Example() {
  return (
    <FloodRoot>
      <Slider label="Price range" name="price" defaultValue={[25, 75]} min={0} max={100} />
    </FloodRoot>
  );
}

Design notes

  • value/defaultValue contain one number or an ordered pair. onValueChange returns a new array. Values snap to min-based steps and thumbs cannot cross; Tab order stays stable. Supply thumbLabels to translate or explain each handle.
  • Horizontal only. Direction follows the host, including RTL. Native range inputs retain keyboard behavior; pointer selection chooses the nearest handle. Names submit one or two entries; uncontrolled reset restores defaults.
  • hideLabel preserves the accessible legend; showValue only controls the visible numeric readout. Read-only prevents edits while keeping focus. Use hint/message/error for meaning beyond color. Touch assistive technology needs device testing. Available in 0.2.5.

API reference

PropValuesDefault
legendSize · 0.2.10"label" | "section"—
hideLabel · 0.2.3boolean—
hintReactNode—
errorReactNode—
messageReactNode—
status"error" | "warning" | "success" | "info"—
labelstringRequired
valuereadonly number[]—
defaultValuereadonly number[][50]
onValueChange(value: number[]) => void—
minnumber0
maxnumber100
stepnumber1
thumbLabelsreadonly string[]—
showValuebooleantrue
readOnlybooleanfalse
controlSize"sm" | "md" | "lg" | "xl""md"
Native HTML propsOmit<FieldsetHTMLAttributes<HTMLFieldSetElement>, "legend" | "children" | "defaultValue" | "onChange">Forwarded
View TypeScript source