# Slider

Adjust a value with a pointer, touch or keyboard.

Access: free. Category: Forms. Kind: primitive.

## When to use

- Use it when a product interface needs adjust a value with a pointer, touch or keyboard.
- Choose it when the host application can supply the required state and keep business logic outside the presentation component.

## Alternatives

- Choose form-field instead when a labeled email field with validation and help text is the actual interface need, rather than slider.

## Setup for agents

Use React 19 and TypeScript. Initialize shadcn for your framework, then merge this exact entry into components.json:

```json
{
  "registries": {
    "@tidal-pro": {
      "url": "https://tidalui.com/r/pro/{name}.json",
      "headers": {
        "Authorization": "Bearer ${TIDALUI_TOKEN}"
      }
    }
  }
}
```

The namespace must be named **@tidal-pro** because transitive Pro dependencies use that namespace. Obtain an agent key from your active Pro account at https://tidalui.com/account. Keep TIDALUI_TOKEN in your local environment, never in components.json, client code, Git or logs.

```sh
export TIDALUI_TOKEN='your-private-agent-key'
npx shadcn@latest add @tidal-pro/waitlist-form
npx shadcn@latest add https://tidalui.com/r/tidal-button.json
```

Free command: `npx shadcn@latest add https://tidalui.com/r/<name>.json`.
Pro command: `npx shadcn@latest add @tidal-pro/<name>`.

Import the base stylesheet and every stylesheet listed on the installed item's metadata. For example:

```tsx
import "./components/ui/tidal.css";
import "./components/ui/hero-section.css";
// Place installed components inside this wrapper:
<div className="tidal-scope" data-theme="dark">...</div>
```

Omit data-theme for the default light theme. Put the attribute on the same tidal-scope element for dark mode. Every component installs the shared free tidal-base dependency. After upgrading, run `npx shadcn@latest add https://tidalui.com/r/tidal-base.json --overwrite` to receive current tokens. Review local modifications before overwriting.

Vite: Use React + TypeScript. Map @/* to ./src/* in paths and Vite resolve.alias. Import tidal.css and each component stylesheet in your application entry.

Next.js 15 App Router: Next.js App Router: import tidal.css and component CSS in app/layout.tsx. Interactive examples belong in a client component with "use client". Map @/* to ./* or ./src/* to match your project.

TypeScript 6: use paths without baseUrl:

```json
{
  "compilerOptions": {
    "paths": {
      "@/*": [
        "./src/*"
      ]
    }
  }
}
```

Pro registry requests are server/CLI-only. Use the same-origin account interface in a browser; cross-origin Authorization preflights are intentionally unsupported.


## Install Slider

```sh
npx shadcn@latest add https://tidalui.com/r/slider.json
```

Stylesheets: `components/ui/tidal.css`, `components/ui/slider.css`.

## Minimal example

```tsx
import"./components/ui/tidal.css";
import"./components/ui/slider.css";
import{TidalSlider}from"./components/ui/slider";
export default()=><div className="tidal-scope"><TidalSlider label={"Demo"} onValueChange={() => {}} value={[1]}/></div>;
```

## Structured props

- `TidalSliderDigits.text: string`: Required text value accepted by this exported component.
- `TidalSlider.label: string`: Required label value accepted by this exported component.
- `TidalSlider.onValueChange: (value: TidalSliderValue) => void`: Callback invoked when the value change interaction is proposed.
- `TidalSlider.value: TidalSliderValue`: Required value value accepted by this exported component.
- `TidalSlider.description?: string | undefined`: Optional description value accepted by this exported component.
- `TidalSlider.error?: string | undefined`: Optional error value accepted by this exported component.
- `TidalSlider.formatValue?: ((value: number) => string) | undefined` (default String): Optional format value value accepted by this exported component.
- `TidalSlider.marks?: Array<{ value: number; label?: string; }> | undefined` (default []): Optional marks value accepted by this exported component.
- `TidalSlider.onValueCommit?: ((value: TidalSliderValue) => void) | undefined`: Callback invoked when the value commit interaction is proposed.
- `TidalSlider.readOnly?: boolean | undefined` (default false): Optional read only value accepted by this exported component.
- `TidalSlider.rootClassName?: string | undefined` (default ""): Optional root class name value accepted by this exported component.
- `TidalSlider.showValue?: boolean | undefined` (default true): Optional show value value accepted by this exported component.
- `TidalSlider.thumbLabels?: [string] | [string, string] | undefined`: Optional thumb labels value accepted by this exported component.

## Complete usage example

[Source](https://tidalui.com/examples/slider.tsx) | [Manifest](https://tidalui.com/examples/slider.json). Install the listed additional dependencies. Consumer fixture: TypeScript pass; Vite pass. This fixture check is distinct from the actual shadcn install receipt.

```tsx
import "./components/ui/tidal.css";

import { useEffect, useLayoutEffect, useRef, useState, type CSSProperties } from "react";

import { ArrowUpRight, Check, RotateCcw } from "lucide-react";

import { TidalSlider, TidalSliderDigits, type TidalSliderValue } from "./components/ui/slider";

import { TidalButton } from "./components/ui/tidal-button";

import "./components/ui/slider.css";



const tidalExampleStyles = ".tidal-scope .slider-specimen {\n  width: 100%;\n  max-width: 720px;\n  padding: 28px;\n  border: 1px solid var(--t-border);\n  border-radius: var(--t-radius-card);\n  background: var(--t-surface);\n  box-shadow:\n    0 2px 3px #00000004,\n    0 18px 35px -30px #00000040;\n}\n.tidal-scope .slider-specimen > h3 {\n  font-size: 29px;\n  font-weight: 500;\n  line-height: 1.15;\n  letter-spacing: -1.1px;\n  margin: 15px 0 24px;\n}\n.tidal-scope .slider-specimen > h3 em {\n  font:\n    italic 37px/1.15 \"Instrument Serif\",\n    Georgia,\n    serif;\n  letter-spacing: -0.8px;\n}\n.tidal-scope .slider-demo-stage {\n  padding: 7px;\n  margin: 0 -7px;\n  overflow: hidden;\n  transition: height 420ms var(--t-ease-out);\n}\n.tidal-scope .slider-demo-content {\n  display: flow-root;\n}\n.tidal-scope .slider-demo-layout {\n  display: grid;\n  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);\n  gap: 30px;\n  align-items: center;\n}\n.tidal-scope .slider-demo-clock {\n  position: relative;\n  min-width: 0;\n  border-radius: 12px;\n  background: var(--t-ink);\n  color: var(--t-surface);\n  padding: 18px;\n  box-shadow:\n    inset 0 1px 0 #ffffff12,\n    0 12px 18px -12px #0000004a;\n  animation: slider-scene-enter 620ms var(--t-ease-out) both;\n}\n.tidal-scope .slider-demo-clock-head {\n  display: flex;\n  justify-content: space-between;\n  gap: 8px;\n  font-size: 11px;\n  letter-spacing: 1.25px;\n  opacity: 0.7;\n}\n.tidal-scope .slider-demo-instrument {\n  position: relative;\n  width: 100%;\n  max-width: 230px;\n  aspect-ratio: 1;\n  margin: 8px auto -7px;\n}\n.tidal-scope .slider-demo-instrument svg {\n  display: block;\n  width: 100%;\n  height: 100%;\n  overflow: visible;\n}\n.tidal-scope .slider-clock-track,\n.tidal-scope .slider-clock-arc {\n  fill: none;\n  stroke: currentColor;\n  stroke-width: 8;\n  stroke-linecap: round;\n}\n.tidal-scope .slider-clock-track {\n  opacity: 0.18;\n}\n.tidal-scope .slider-clock-arc {\n  transition:\n    stroke-dasharray 420ms var(--t-ease-out),\n    stroke-dashoffset 420ms var(--t-ease-out);\n}\n.tidal-scope .slider-clock-tick {\n  stroke: currentColor;\n  stroke-width: 1;\n  opacity: 0.3;\n}\n.tidal-scope .slider-clock-tick[data-major] {\n  opacity: 0.65;\n}\n.tidal-scope .slider-clock-hand {\n  transform-origin: 110px 110px;\n  transition: transform 420ms var(--t-ease-out);\n}\n.tidal-scope .slider-clock-hand circle:first-child {\n  fill: var(--t-surface);\n}\n.tidal-scope .slider-clock-hand circle:last-child {\n  fill: var(--t-ink);\n}\n.tidal-scope .slider-demo-clock-value {\n  position: absolute;\n  inset: 0;\n  display: flex;\n  flex-direction: column;\n  align-items: center;\n  justify-content: center;\n  gap: 9px;\n  pointer-events: none;\n}\n.tidal-scope .slider-demo-clock-value > span[aria-hidden] {\n  display: flex;\n  gap: 4px;\n  align-items: baseline;\n  font-size: 46px;\n  line-height: 1.2;\n  font-weight: 500;\n  letter-spacing: -2px;\n}\n.tidal-scope .slider-demo-clock-value small {\n  font-size: 18px;\n  font-weight: 400;\n  letter-spacing: 0;\n  opacity: 0.6;\n}\n.tidal-scope .slider-demo-clock-value > span:last-child {\n  font-size: 11px;\n  letter-spacing: 1.4px;\n  opacity: 0.7;\n}\n.tidal-scope .slider-demo-clock-limits {\n  position: absolute;\n  left: 15%;\n  right: 15%;\n  bottom: 21%;\n  display: flex;\n  justify-content: space-between;\n  font-size: 11px;\n  opacity: 0.55;\n  font-variant-numeric: tabular-nums;\n}\n.tidal-scope .slider-demo-summary {\n  display: flex;\n  justify-content: space-between;\n  gap: 8px;\n  font-size: 11px;\n  font-variant-numeric: tabular-nums;\n  padding: 11px 0 9px;\n  border-top: 1px solid #80808055;\n}\n.tidal-scope .slider-demo-break-rail {\n  display: flex;\n  gap: 3px;\n  height: 3px;\n  overflow: hidden;\n  border-radius: 9px;\n}\n.tidal-scope .slider-demo-break-rail span {\n  display: block;\n  background: currentColor;\n  transition: width 420ms var(--t-ease-out);\n}\n.tidal-scope .slider-demo-break-rail span:last-child {\n  opacity: 0.3;\n}\n.tidal-scope .slider-demo-clock > p {\n  font-size: 11px;\n  line-height: 1.6;\n  opacity: 0.65;\n  margin: 9px 0 0;\n}\n.tidal-scope .slider-demo-layout form {\n  min-width: 0;\n}\n.tidal-scope .slider-demo-controls-caption {\n  display: block;\n  font-size: 11px;\n  letter-spacing: 1.3px;\n  color: var(--t-muted);\n  margin-bottom: 25px;\n}\n.tidal-scope\n  .slider-demo-layout\n  form\n  > .tidal-slider-field\n  + .tidal-slider-field {\n  margin-top: 25px;\n}\n.tidal-scope .slider-demo-actions {\n  display: flex;\n  gap: 8px;\n  margin-top: 25px;\n}\n.tidal-scope .slider-demo-actions .tidal-button {\n  flex: 1;\n  min-width: 0;\n  font-size: 11px;\n  padding: 0 10px;\n  outline-offset: -5px;\n}\n.tidal-scope .slider-demo-actions .tidal-button:focus-visible {\n  outline-color: currentColor;\n}\n.tidal-scope .slider-demo-status {\n  display: block;\n  font-size: 11px;\n  line-height: 1.5;\n  margin-top: 10px;\n  color: var(--t-muted);\n}\n.tidal-scope .slider-demo-note {\n  font-size: 11px;\n  color: var(--t-muted);\n  line-height: 1.65;\n  margin: 22px 0 0;\n}\n.tidal-scope .slider-demo-complete {\n  text-align: center;\n  padding: 16px 5px 22px;\n  animation: slider-scene-enter 420ms var(--t-ease-out) both;\n}\n.tidal-scope .slider-demo-complete > span {\n  display: flex;\n  width: 44px;\n  height: 44px;\n  background: var(--t-ink);\n  color: var(--t-surface);\n  border-radius: 50%;\n  align-items: center;\n  justify-content: center;\n  margin: 0 auto 15px;\n}\n.tidal-scope .slider-demo-complete h4 {\n  font-size: 22px;\n  font-weight: 500;\n  letter-spacing: -0.7px;\n  outline-offset: -5px;\n}\n.tidal-scope .slider-demo-complete p {\n  font-size: 11px;\n  color: var(--t-muted);\n  margin-top: 9px;\n}\n.tidal-scope .slider-specimen[data-phase=\"saved\"] .slider-demo-layout {\n  grid-template-columns: minmax(0, 1fr);\n}\n.tidal-scope .slider-specimen[data-phase=\"saved\"] .slider-demo-clock {\n  max-width: 290px;\n  width: 100%;\n  margin-inline: auto;\n}\n.tidal-scope .slider-demo-saved-actions {\n  justify-content: center;\n}\n.tidal-scope .slider-demo-saved-actions .tidal-button {\n  flex: 0 1 auto;\n  padding: 0 16px;\n}\n.tidal-scope .slider-demo-saved-actions .tidal-button:last-child {\n  width: 44px;\n  padding: 0;\n}\n.tidal-scope .slider-demo-sr {\n  position: absolute;\n  width: 1px;\n  height: 1px;\n  padding: 0;\n  margin: -1px;\n  overflow: hidden;\n  clip-path: inset(50%);\n  white-space: nowrap;\n  border: 0;\n}\n@keyframes slider-scene-enter {\n  from {\n    opacity: 0;\n    transform: translateY(8px);\n  }\n  to {\n    opacity: 1;\n    transform: translateY(0);\n  }\n}\n@media (max-width: 600px) {\n  .tidal-scope .slider-specimen {\n    padding: 18px;\n  }\n  .tidal-scope .slider-specimen > h3 {\n    font-size: 25px;\n    margin-bottom: 19px;\n  }\n  .tidal-scope .slider-specimen > h3 em {\n    font-size: 32px;\n  }\n  .tidal-scope .slider-demo-layout {\n    grid-template-columns: 1fr;\n    gap: 20px;\n  }\n  .tidal-scope .slider-demo-clock {\n    padding: 14px;\n  }\n  .tidal-scope .slider-demo-instrument {\n    max-width: 174px;\n    margin: 0 auto -7px;\n  }\n  .tidal-scope .slider-demo-clock-value > span[aria-hidden] {\n    font-size: 39px;\n  }\n  .tidal-scope .slider-demo-controls-caption {\n    display: none;\n  }\n  .tidal-scope\n    .slider-demo-layout\n    form\n    > .tidal-slider-field\n    + .tidal-slider-field {\n    margin-top: 14px;\n  }\n  .tidal-scope .slider-demo-actions {\n    margin-top: 15px;\n  }\n  .tidal-scope .slider-demo-note {\n    font-size: 11px;\n    margin-top: 16px;\n  }\n}\n@media (prefers-reduced-motion: reduce) {\n  .tidal-scope .slider-specimen * {\n    transition: none !important;\n    animation: none !important;\n  }\n  .tidal-scope .slider-demo-clock,\n  .tidal-scope .slider-demo-complete {\n    transform: none;\n  }\n}\n\n.tidal-scope .slider-demo-clock > p {\n  color: inherit;\n}\n@media (max-width: 600px) {\n  .tidal-scope .slider-demo-clock {\n    display: grid;\n    grid-template-columns: 124px minmax(0, 1fr);\n    gap: 7px 13px;\n    align-items: center;\n  }\n  .tidal-scope .slider-demo-clock-head {\n    grid-column: 1/-1;\n    margin-bottom: 3px;\n  }\n  .tidal-scope .slider-demo-instrument {\n    grid-row: 2/5;\n    width: 124px;\n    max-width: none;\n    margin: 0;\n  }\n  .tidal-scope .slider-demo-summary {\n    grid-column: 2;\n    display: flex;\n    flex-direction: column;\n    justify-content: center;\n    border: 0;\n    gap: 5px;\n    font-size: 11px;\n    padding: 0;\n  }\n  .tidal-scope .slider-demo-break-rail {\n    grid-column: 2;\n  }\n  .tidal-scope .slider-demo-clock > p {\n    grid-column: 2;\n    font-size: 11px;\n    margin: 0;\n  }\n  .tidal-scope .slider-demo-clock-value > span[aria-hidden] {\n    font-size: 26px;\n    letter-spacing: -0.5px;\n  }\n  .tidal-scope .slider-demo-clock-value small {\n    font-size: 12px;\n  }\n  .tidal-scope .slider-demo-clock-value > span:last-child {\n    font-size: 11px;\n    letter-spacing: 0.5px;\n  }\n}\n\n@media (max-width: 600px) {\n  .tidal-scope .slider-specimen {\n    padding: 16px;\n  }\n  .tidal-scope .slider-specimen > h3 {\n    margin-bottom: 15px;\n  }\n  .tidal-scope .slider-demo-layout {\n    gap: 16px;\n  }\n  .tidal-scope .slider-demo-clock {\n    grid-template-columns: 116px minmax(0, 1fr);\n  }\n  .tidal-scope .slider-demo-instrument {\n    width: 116px;\n  }\n  .tidal-scope\n    .slider-demo-layout\n    form\n    > .tidal-slider-field\n    + .tidal-slider-field {\n    margin-top: 10px;\n  }\n  .tidal-scope .slider-demo-actions {\n    margin-top: 12px;\n  }\n}";

function time(value: number) {
  const h = Math.floor(value),
    m = Math.round((value - h) * 60);
  return `${String(h).padStart(2, "0")}:${String(m).padStart(2, "0")}`;
}

export function SliderDemo() {
  const [window, setWindow] = useState<TidalSliderValue>([9, 15]),
    [breaks, setBreaks] = useState<TidalSliderValue>([30]);
  const [phase, setPhase] = useState<"editing" | "saving" | "saved">("editing"),
    [height, setHeight] = useState<number>();
  const content = useRef<HTMLDivElement>(null),
    range = useRef<HTMLSpanElement>(null),
    title = useRef<HTMLHeadingElement>(null),
    restore = useRef(false),
    timer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);
  const focusOwner = useRef<HTMLElement | null>(null);
  const start = window[0],
    end = window[1] ?? window[0],
    duration = end - start,
    minutes = Math.max(0, duration * 60 - breaks[0]);
  const circumference = 2 * Math.PI * 82,
    trackLength = (circumference * 2) / 3,
    offset = ((start - 8) / 10) * trackLength,
    length = (duration / 10) * trackLength;
  const focusTime = `${Math.floor(minutes / 60)}:${String(minutes % 60).padStart(2, "0")}`;
  useEffect(() => () => clearTimeout(timer.current), []);
  useLayoutEffect(() => {
    const active = document.activeElement;
    const canMoveFocus =
      active === document.body || active === focusOwner.current;
    if (phase === "saved" && canMoveFocus) {
      title.current?.focus({ preventScroll: true });
      focusOwner.current = null;
    } else if (phase === "editing" && restore.current) {
      restore.current = false;
      const thumb =
        range.current?.querySelector<HTMLElement>('[role="slider"]');
      if (canMoveFocus && thumb?.getClientRects().length)
        thumb.focus({ preventScroll: true });
      else if (canMoveFocus) {
        const previousFocus = document.activeElement;
        focusOwner.current = null;
        const frame = requestAnimationFrame(() => {
          if (document.activeElement === previousFocus)
            range.current
              ?.querySelector<HTMLElement>('[role="slider"]')
              ?.focus({ preventScroll: true });
        });
        return () => cancelAnimationFrame(frame);
      }
      focusOwner.current = null;
    }
  }, [phase]);
  useLayoutEffect(() => {
    const node = content.current;
    if (!node) return;
    const measure = () => {
      const css = getComputedStyle(node.parentElement!);
      setHeight(
        node.offsetHeight +
          Number.parseFloat(css.paddingTop) +
          Number.parseFloat(css.paddingBottom),
      );
    };
    measure();
    const ro = new ResizeObserver(measure);
    ro.observe(node);
    return () => ro.disconnect();
  }, []);
  function edit() {
    clearTimeout(timer.current);
    focusOwner.current =
      document.activeElement instanceof HTMLElement
        ? document.activeElement
        : null;
    restore.current = true;
    setPhase("editing");
    if (phase === "editing") {
      restore.current = false;
      range.current
        ?.querySelector<HTMLElement>('[role="slider"]')
        ?.focus({ preventScroll: true });
    }
  }
  function reset() {
    setWindow([9, 15]);
    setBreaks([30]);
    edit();
  }
  return (
    <div className="slider-specimen" data-phase={phase}>
      <div className="slider-demo-stage" style={{ height }}>
        <div ref={content} className="slider-demo-content">
          {phase === "saved" ? (
            <div className="slider-demo-complete">
              <span aria-hidden="true">
                <Check size={20} />
              </span>
              <h4 ref={title} tabIndex={-1}>
                Focus session saved
              </h4>
              <p>Kept in this sample only. Your calendar is unchanged.</p>
            </div>
          ) : null}
          <div className="slider-demo-layout">
            <section
              className="slider-demo-clock"
              aria-label="Sample focus plan"
              style={{ "--slider-focus-minutes": minutes } as CSSProperties}
            >
              <div className="slider-demo-clock-head">
                <span>THE FOCUS WINDOW</span>
                <span>D / 028</span>
              </div>
              <div className="slider-demo-instrument">
                <svg viewBox="0 0 220 220" aria-hidden="true">
                  <circle
                    className="slider-clock-track"
                    cx="110"
                    cy="110"
                    r="82"
                    strokeDasharray={`${trackLength} ${circumference}`}
                    transform="rotate(150 110 110)"
                  />
                  <circle
                    className="slider-clock-arc"
                    cx="110"
                    cy="110"
                    r="82"
                    strokeDasharray={`${length} ${circumference}`}
                    strokeDashoffset={-offset}
                    transform="rotate(150 110 110)"
                  />
                  {Array.from({ length: 21 }, (_, i) => {
                    const angle = ((150 + i * 12) * Math.PI) / 180;
                    return (
                      <line
                        key={i}
                        className="slider-clock-tick"
                        data-major={i % 4 === 0 || undefined}
                        x1={110 + Math.cos(angle) * 98}
                        y1={110 + Math.sin(angle) * 98}
                        x2={110 + Math.cos(angle) * (i % 4 === 0 ? 104 : 101)}
                        y2={110 + Math.sin(angle) * (i % 4 === 0 ? 104 : 101)}
                      />
                    );
                  })}
                  {[start, end].map((v, i) => {
                    return (
                      <g
                        key={i}
                        className="slider-clock-hand"
                        style={{
                          transform: `rotate(${150 + ((v - 8) / 10) * 240}deg)`,
                        }}
                      >
                        <circle cx="192" cy="110" r="6" />
                        <circle cx="192" cy="110" r="2" />
                      </g>
                    );
                  })}
                </svg>
                <div className="slider-demo-clock-value">
                  <span className="slider-demo-sr">
                    {Math.floor(minutes / 60)}{" "}
                    {Math.floor(minutes / 60) === 1 ? "hour" : "hours"} and{" "}
                    {minutes % 60} {minutes % 60 === 1 ? "minute" : "minutes"}{" "}
                    of sample focus
                  </span>
                  <span aria-hidden="true">
                    <TidalSliderDigits text={focusTime} />
                    <small>h</small>
                  </span>
                  <span>FOCUS · HOURS : MINUTES</span>
                </div>
                <div className="slider-demo-clock-limits" aria-hidden="true">
                  <span>08</span>
                  <span>18</span>
                </div>
              </div>
              <div className="slider-demo-summary">
                <span>
                  {time(start)} – {time(end)}
                </span>
                <span>{minutes} min focus</span>
              </div>
              <div className="slider-demo-break-rail" aria-hidden="true">
                <span
                  style={{ width: `${(minutes / (duration * 60)) * 100}%` }}
                />
                <span
                  style={{ width: `${(breaks[0] / (duration * 60)) * 100}%` }}
                />
              </div>
              <p>{breaks[0]} minutes left for breaks.</p>
            </section>
            {phase !== "saved" ? (
              <form
                onSubmit={(event) => {
                  event.preventDefault();
                  focusOwner.current =
                    (event.nativeEvent as SubmitEvent).submitter instanceof
                    HTMLElement
                      ? (event.nativeEvent as SubmitEvent).submitter
                      : document.activeElement instanceof HTMLElement
                        ? document.activeElement
                        : null;
                  setPhase("saving");
                  timer.current = setTimeout(() => setPhase("saved"), 550);
                }}
              >
                <span className="slider-demo-controls-caption">
                  MAKE ROOM FOR YOUR BEST WORK
                </span>
                <TidalSlider
                  ref={range}
                  label="Focus window"
                  thumbLabels={["Start time", "End time"]}
                  value={window}
                  onValueChange={setWindow}
                  min={8}
                  max={18}
                  step={0.5}
                  minStepsBetweenThumbs={2}
                  formatValue={time}
                  name="focus-window"
                  disabled={phase === "saving"}
                  marks={[
                    { value: 8, label: "08" },
                    { value: 10, label: "10" },
                    { value: 12, label: "12" },
                    { value: 14, label: "14" },
                    { value: 16, label: "16" },
                    { value: 18, label: "18" },
                  ]}
                  description="Choose one hour or more. Half-hour steps."
                />
                <TidalSlider
                  label="Break budget"
                  value={breaks}
                  onValueChange={setBreaks}
                  min={0}
                  max={60}
                  step={5}
                  formatValue={(v) => `${v} min`}
                  name="break-minutes"
                  disabled={phase === "saving"}
                  description="Taken out of your selected window."
                />
                <div className="slider-demo-actions">
                  <TidalButton
                    type="button"
                    variant="secondary"
                    onClick={phase === "saving" ? edit : reset}
                  >
                    {phase === "saving" ? "Cancel sample" : "Reset sample"}
                  </TidalButton>
                  <TidalButton type="submit" loading={phase === "saving"}>
                    {phase === "saving" ? "Setting space" : "Set sample"}
                    {phase === "editing" ? <ArrowUpRight size={13} /> : null}
                  </TidalButton>
                </div>
                {phase === "saving" ? (
                  <span className="slider-demo-status" role="status">
                    Setting this local sample…
                  </span>
                ) : null}
              </form>
            ) : null}
          </div>
          {phase === "saved" ? (
            <div className="slider-demo-actions slider-demo-saved-actions">
              <TidalButton variant="secondary" onClick={edit}>
                Adjust sample
              </TidalButton>
              <TidalButton
                variant="secondary"
                onClick={reset}
                aria-label="Reset original plan"
              >
                <RotateCcw size={14} />
              </TidalButton>
            </div>
          ) : null}
        </div>
      </div>
      <p className="slider-demo-note">
        Fictional day plan. No calendar changes, reminders or storage.
      </p>
    </div>
  );
}

export default function AgentExample() {
  return (
    <div className="tidal-scope" data-theme="light" dir="ltr">
      <style>{tidalExampleStyles}</style>
      <SliderDemo />
    </div>
  );
}

```

## Gotchas

- Keep field state, validation results, submission, and persistence in the host form workflow.

## Theme and accessibility

{"tokens":["--t-accent","--t-border","--t-border-strong","--t-canvas","--t-danger","--t-display","--t-ease-out","--t-ease-spring","--t-faint","--t-font","--t-ink","--t-line","--t-muted","--t-primary","--t-primary-contrast","--t-radius-card","--t-radius-control","--t-radius-overlay","--t-radius-panel","--t-ring","--t-shadow-lg","--t-shadow-soft","--t-slider-bubble-shift","--t-soft","--t-subtle","--t-surface","--t-wash"],"darkMode":true}

{"keyboard":["Tab and Shift+Tab follow the component's native focus order.","Arrow-key behavior follows the exported composite-control implementation."],"aria":"The component wires labels and relationships from consumer-provided visible text or ARIA props; preserve those labels in production.","notes":"Verify focus visibility, text alternatives, contrast, and reduced motion in the final composition."}

Required visible label, controlled value:TidalSliderValue ([number] or [number,number]), onValueChange and optional onValueCommit. Initialize with useState<TidalSliderValue>([9,15]); consumers own state, reset and request handling. A single value renders one thumb, an ordered pair renders two; thumb order is preserved with optional nonnegative integer minStepsBetweenThumbs (default0). Radix Slider1.5 owns pointer capture, track clicking, Arrow keys, Page keys, Shift+Arrow, RTL interaction. Tidal submits actual-unit values through named hidden inputs (a pair uses name[]). Home/End moves the focused thumb to its admissible bound, including neighbouring-thumb gap constraints; caller onKeyDown runs first and preventDefault/composition is honored. name/form/native root span attributes and root ref supported; ref targets the track root, query role=slider to focus a thumb. Keyboard and gesture callbacks propose values; consumers may reject proposals and must validate commit values before requests. Horizontal only. min/max default0/100; nonfinite bounds fall back; positive finite step defaults1, malformed step falls back1. Integer-scaled native units preserve decimal gaps and offset step grids; maximum rounds down to its last step. Values must be on the min-based grid. Reversed/equal/unsafe-precision bounds, impossible gap, nonfinite/out-of-bounds/off-grid/unordered values or wrong array length disable the whole slider and expose linked configuration feedback without mutating caller state. Safe fallback geometry is decorative for invalid configuration. disabled/readOnly disables all interaction; disabled or invalid named form inputs are disabled and excluded. Read-only values remain submitted. Optional description/error compose with external aria-describedby; each thumb has localized thumbLabels, aria-valuetext from formatValue and linked invalid feedback. showValue defaults true. marks are decorative bounded unique ticks, capped11; labels compact on narrow tracks, not actions. className/style target Radix track root; rootClassName targets the field. Pointer callbacks compose; reduced motion removes grip scaling, bubbles/digit transitions, track travel. Exports TidalSliderDigits as decorative helper requiring accessible text separately. No momentum, elastic overshoot, network work, wrapper form, storage or scheduling is introduced. Free MIT family; import scoped tidal.css and slider.css.
