Skip to content
Agent UI
PrimitivesSlider

Slider

Native range input with min, max and step controls.

Slider ships with a full API table, a copyable example, and accessibility notes.

tsx
Creativity40%

Installation

Install the package once, then import Slider from its direct entry point or from the root.

bash
pnpm add @agent-ui/react
tsx
import { Slider } from "@agent-ui/react/slider";

Tailwind CSS v4 users: add @source "../node_modules/@agent-ui/react/src" to the global stylesheet so the library utilities are generated.

Usage

The example below is the same code that renders the preview. Copy it, swap in your own handlers, and ship.

tsx
import { Slider } from "@agent-ui/react";
 
<Slider min={0} max={100} defaultValue={40} aria-label="Creativity" />

API reference

Every prop Slider accepts, its type, default, and behaviour.

API reference for this component
NameTypeDefaultDescription
minnumber—Minimum value.
maxnumber—Maximum value.
stepnumber—Value increment.

Accessibility

Uses a native range input. Label the control with aria-label or a visible label.
Use it with the rest of the library

Slider composes with MessageList, ChatShell, useChat, and the provider compose blocks. Browse the full reference or see all components in the gallery.

3 lines · copy-ready