npm install @idyeah/diya
GitHub
Appearance
Color scheme

Slider

Get code

Three steps. The first two happen once per app.

Step 1: Install

Terminal, in your app’s folder
npm install @idyeah/diya

Once per app. Every component and pattern is in this one package.

Working in Claude Code or Cursor? Connect your editor once and it fetches this for you.

No app yet? npm create diya@latest sets up Next.js or Vite with the styles and provider already in place. Then skip to step 3.

Step 2: Add the styles and provider

Once, at your app’s root: app/layout.tsx in Next.js, src/main.tsx in Vite. DIYA Sans comes with it.

Root layout or entry
import '@idyeah/diya/styles.css'
import { DiyaProvider } from '@idyeah/diya'

<DiyaProvider theme="dark">
  {children}
</DiyaProvider>

theme="dark" matches the catalog as you’re viewing it. theme="system" follows each visitor’s light or dark setting instead.

Get theme

Your brand as one CSS file and a few props.

Brand
AaAaNeutral (DIYA default)
Font
DIYA Sans
Corners · Elevation
Soft · Soft
Control height · Fields
Default · Auto
Glass
Off
Motion
Match device
Status colors
DIYA defaults

Step 1: Save the theme file

diya-theme.css · 6 lines
/* diya-theme.css, made in the DIYA catalog.
   Import it after '@idyeah/diya/styles.css'. Public tokens only.
   Brand: Neutral (DIYA default). */

/* No color, corner or elevation changes: DIYA's defaults apply. */

Public tokens only: the names DIYA promises not to rename in 1.x.

Step 2: Import it after DIYA’s styles

Root layout or entry
import '@idyeah/diya/styles.css'
import './diya-theme.css'

Order matters. The theme goes second so it wins.

Type
Step
Options
State

Using Slider

A labeled slider with one handle, or two for a start and end with range; 0–100 unless min and max say otherwise.

A Markdown brief for Claude, Cursor or v0: install, setup, props and a complete example.

When to use

For a value where the rough position matters more than the exact number: volume, a price range.

An exact number? Text Input with type="number".

Accessibility

Native range inputs, each with its own accessible name; with formatValue, each handle also announces its formatted value, like "$40". Arrow keys and Page Up/Down move the handle.

Props

import { Slider } from '@idyeah/diya'Stable since 1.0.0

labelRequiredstring

Visible label above the slider; also names the inputs for assistive tech. Hide it with hideLabel.

disabledboolean

Prevents dragging and dims the slider.

Default false

formatValue(value: number) => string

Formats every number the slider shows (its values and marks) and what screen readers announce for each handle, such as (value) => '$' + value. Defaults to the plain number.

hideLabelboolean

Hides the visible label; the inputs keep it as their accessible name.

Default false

maxstring | number

Highest value; defaults to 100. Numeric strings work too.

Default 100

minstring | number

Lowest value; defaults to 0. Numeric strings work too, so react-hook-form's register() spreads cleanly.

Default 0

rangeboolean

Single mode (the default): one handle, leave unset or false. Range mode: two handles for a start and end; the handles cannot cross.

showMarksboolean

Shows a visible scale of five evenly spaced numbers from min to max under the track.

Default false

showValuesboolean

Shows the current numbers above the track (the minimum and the value, or start and end in range mode); defaults to true.

Default true

stepstring | number

Increment between values, greater than 0; defaults to 1. Numeric strings work too.

Default 1

When range={false} (the default)

defaultValuenumber

The starting value when uncontrolled; defaults to min, and a form reset returns to it.

onValueChange(value: number) => void

Called with the new value while dragging or on a track click.

valuenumber

The current value when controlled; out-of-range numbers are clamped. Pair it with onValueChange.

When range={true}

defaultValue[number, number]

The starting [start, end] when uncontrolled; defaults to [min, max], and a form reset returns to it.

onValueChange(value: [number, number]) => void

Called with the new [start, end] while dragging or on a track click.

value[number, number]

The current [start, end] when controlled, with start ≤ end. Pair it with onValueChange.

Also takes every native <input> attribute, such as name, id or data-*.