GitHubGitHub
← All components
Forms / component

Slider

A styled native range input with a filled track and live value readout.

DefaultFormatted valueDisabled
64%
<Slider bind:value min={0} max={100} formatValue={(v) => `${v}%`} />

Installation

pnpm add @chanrg/4ui

Import the stylesheet once, at the root of your app:

import '@chanrg/4ui/styles.css';

Usage

import { Slider } from '@chanrg/4ui';<Slider bind:value min={0} max={100} formatValue={(v) => `${v}%`} />

API reference

Props

PropTypeDefaultDescription
valuenumber ($bindable)0Current value.
min / max / stepnumber0 / 100 / 1Range.
formatValue(value) => stringString(value)Readout formatter.
showValuebooleantrueShow the readout.

CSS variables

VariableDescription
--4ui-surfacePrimary component surface.
--4ui-textPrimary foreground color.
--4ui-borderDefault control and panel border.

Accessibility

  • Native range input: arrows, Home/End, and screen-reader value reporting built in.

Dependencies

No runtime component dependencies.