Skip to main content
NetScriptdocs Search docs ⌘K v0.0.9
Browse documentation

Slider

One or two native ranges with keyboard steps and bounded values.

All components · Theme builder · Implementation source

Live preview

Open live slider preview

Install

Shell
netscript ui:add slider

Usage and examples

The preview runs this JSX with the installed components. Import any composed primitives from your UI directory.

TypeScript
import { useState } from 'preact/hooks';
import { Slider } from '@app/components/ui/slider.tsx';

export function Example() {
  const [value, setValue] = useState('standard');
  const [open, setOpen] = useState(false);
  const [notice, report] = useState('');
  return (<><div><Slider label="Discount" /></div><p role="status">{notice}</p></>);
}

Props

Generated from native deno doc --json --private over the shipped implementation. Compound component props retain their owning interface; native attributes pass through where declared.

OwnerPropTypeOptionalDescription
SliderPropslabelstringNo
SliderPropslabels[object Object]Yes
SliderPropsnamestringYes
SliderPropsminnumberYes
SliderPropsmaxnumberYes
SliderPropsstepnumberYes
SliderPropsthumbs1 | 2Yes
SliderPropsvalues[object Object]Yes
SliderPropsdefaultValues[object Object]Yes
SliderPropsonValuesChange(values: [object Object]) => voidYes
SliderPropsorientation"horizontal" | "vertical"Yes
SliderPropsstate"rest" | "hover" | "focus" | "disabled"Yes
SliderPropsdisabledbooleanYes
SliderPropsvaluebooleanYes
SliderPropsclassstringYes
TypeScript
SliderProps extends Omit<JSX.HTMLAttributes<HTMLDivElement>, "class" | "onChange">

Keyboard

KeyAction
Arrow keysIncrement or decrement
Home/EndMinimum or maximum

Tokens

Semantic contract roles: material/track, primary/default, surface/card.

CSS custom properties referenced directly: --ns-card, --ns-control-height, --ns-fg, --ns-font-data, --ns-muted, --ns-primary, --ns-radius-full, --ns-ring, --ns-space-1, --ns-space-10, --ns-space-2, --ns-space-4, --ns-text-small.

Contract and compatibility

Accessibility pattern: WAI-ARIA guidance

  • Native controls own keyboard/form behavior. Transient focus/hover is CSS/native; data-state also supports deliberate preview. Client visual/controlled updates require an island.
  • value is the design value-label visibility boolean; numeric positions use values/defaultValues. One/two native range inputs keep shared min/max geometry and clamp crossing requests.
  • Coincident upper-half thumbs put the lower native input on top; at the lower half the upper input stays on top, so pointer users can separate endpoint thumbs.

Design contract values marked planned are not implementation props. The props above describe what ships today.

Search all documentation

Type a term to search the documentation.