# Slider

> A Radix slider for picking a number, or a range with two thumbs, on a continuous scale.

## Facts

- **Product**: Crew OS
- **Family**: Forms
- **Global**: `window.DigitalCrew.Slider`
- **Source**: `digitalcrew-orchestrator: components/ui/slider.tsx`
- **Import in the app**: `import { Slider } from "@/components/ui/slider";`
- **Live preview**: /design/components/slider/preview.html
- **Page**: /design/components/slider

## Guidelines

**Use it for** limits and thresholds where the exact value matters less than the position: daily sending limit, company size range, lead score cut-off. Always show the current value as text next to the label.

**What you provide**: Radix slider props, `value`/`onValueChange` or `defaultValue` as an array (one entry per thumb), `min` (default 0), `max` (default 100), `step`, `orientation`, `disabled`, and an `aria-label` or a visible [`Label`](/design/components/label.md). Without a value it renders two thumbs at `min` and `max`.

**Anatomy**: the track is 6px (`h-1.5`), full width, `rounded-full`, `bg-muted`; the filled range is `bg-primary`. Thumbs are 16px circles, `bg-white` with a 1px `border-primary` and `shadow-sm`; hover and keyboard focus add a 4px `ring-ring/50` (the colour and shadow transition). Vertical sliders are at least 176px tall (`min-h-44`). Disabled sliders drop to 50% opacity.

**Don't** use a slider for values the user must type precisely (use an input), or for fewer than four discrete options (use a toggle group).

## API

```ts
declare function Slider({ className, defaultValue, value, min, max, ...props }: React.ComponentProps<typeof SliderPrimitive.Root>): any;
export { Slider };
```

## Example

```html
<div id="root" class="p-6"></div>
<script>
(function () {
  var h = React.createElement, DC = window.DigitalCrew, I = DC.Icons;
  function App() {
    var a = React.useState([40]), b = React.useState([50, 500]);
    return h("div", { className: "grid max-w-md gap-7" },
      h("div", { className: "grid gap-3" },
        h("div", { className: "flex items-center justify-between text-sm" }, h(DC.Label, null, "Daily sending limit"), h("span", { className: "text-muted-foreground tabular-nums" }, a[0][0] + " emails")),
        h(DC.Slider, { value: a[0], onValueChange: a[1], min: 10, max: 100, step: 5, "aria-label": "Daily sending limit" })),
      h("div", { className: "grid gap-3" },
        h("div", { className: "flex items-center justify-between text-sm" }, h(DC.Label, null, "Company size"), h("span", { className: "text-muted-foreground tabular-nums" }, b[0][0] + "–" + b[0][1] + " employees")),
        h(DC.Slider, { value: b[0], onValueChange: b[1], min: 1, max: 1000, step: 10, "aria-label": "Company size" })));
  }
  ReactDOM.createRoot(document.getElementById("root")).render(h(DC.TooltipProvider, { delayDuration: 80 }, h(App)));
})();
</script>
```

## More in Forms

- [Calendar](/design/components/calendar.md): A month grid (react-day-picker 10) in the app's tokens: today and the selection in `primary`, outside days muted.
- [Checkbox](/design/components/checkbox.md): A 16px square check for independent on/off choices and row selection; the box fills in 150ms, then the tick draws in over 350ms (`.t-check`).
- [DateTimePicker](/design/components/date-time-picker.md): A date-and-time field in the app's own widget, instead of the browser's `datetime-local`; works in ISO strings.
- [Form](/design/components/form.md): Form fields wired to react-hook-form: each field gets a label, a control, an optional hint and an error message, with ids and ARIA linked for you.
- [Input](/design/components/input.md): The single-line text field: 36px tall, `input` border, `radius-md`, transparent over its ground (dark themes fill it with `input` at 30%).
- [Label](/design/components/label.md): The accessible field label (Radix Label): 14px medium, `leading-none`, 8px gap for an inline icon or `HelpTooltip`.
- [PhoneInput](/design/components/phone-input.md): An international phone field: `react-phone-number-input` with Max's `Input` and a searchable country picker that shows flags.
- [RadioGroup](/design/components/radio-group.md): One choice from a short, visible list (Radix RadioGroup): 16px rings in `primary`, 10px dot.
- [SecretInput](/design/components/secret-input.md): A field for API keys and tokens: masked by default with a reveal toggle, monospace, opted out of autofill.
- [Select](/design/components/select.md): A native-feeling single choice from a list (Radix Select): 36px trigger (`size="sm"`: 32px) with a chevron; the list opens in 250ms from 97% (`.t-dropdown`).
- [Switch](/design/components/switch.md): The on/off control for settings that apply immediately (Radix Switch): a 32 × 18px pill, `input` track off, `primary` on, 16px thumb with a double-bounce (`.t-toggle`, 350ms thumb, 150ms track).
- [Textarea](/design/components/textarea.md): The multi-line field; it grows with its content (`field-sizing: content`) from a 64px minimum.
- [TimezoneSelector](/design/components/timezone-selector.md): A searchable combobox (a `Popover` holding a `Command` list) over every IANA time zone the browser knows.
- [TypedOptionPicker](/design/components/typed-option-picker.md): A searchable, grouped picker for long option lists (Popover + Command), in single and multi versions.
