Exposure Slider

An iOS-style exposure slider where a horizontal row of notch marks scrolls under a fixed center point as the user drags, with a circular progress ring that shows the current signed value. Dragging snaps to the nearest notch and reports values through onChange.

Exposure Slider
LIVE · running in a sandboxed iframe
Installed with plain shadcn add · no workarounds · theme neutral (none shipped)
See how it was built

Installation

pnpm dlx shadcn@latest add @smoothui/exposure-slider

Requires @smoothui in the registries of your components.json (shadcn adds official directory namespaces automatically).

Usage

usage.tsx
import ExposureSlider from "@/components/smoothui/exposure-slider";export function Example() {  return <ExposureSlider min={-20} max={20} step={1} defaultValue={0} onChange={(value) => console.log(value)} />;}
  • Picking a continuous or stepped numeric value within a signed range, such as exposure, brightness, or EV compensation in photo or camera-style UIs.
  • Settings screens that need a tactile, dial-like control with immediate visual feedback of the value and its sign.
  • Creative tools or image editors where a compact, centered ticker with a progress ring fits the layout better than a standard range input.
  • Demos and marketing pages that need a polished iOS-like control; avoid it where a plain form input or keyboard-first control is required.

Examples

Default exposure control

Renders the slider with the default range of -20 to 20 in steps of 1, starting at 0, and shows the progress ring.

default-exposure-control.tsx
import ExposureSlider from "@/components/smoothui/exposure-slider";export default function DefaultExample() {  return <ExposureSlider />;}

Controlled-looking usage with onChange

Reads the value reported by onChange into local state and displays it beside the slider.

controlled-looking-usage-with-onchange.tsx
import { useState } from "react";import ExposureSlider from "@/components/smoothui/exposure-slider";export default function ExposureWithReadout() {  const [value, setValue] = useState(0);  return (    <div className="flex flex-col items-center gap-2">      <p className="text-sm">EV {value > 0 ? `+${value}` : value}</p>      <ExposureSlider min={-3} max={3} step={1} defaultValue={0} onChange={setValue} />    </div>  );}

Custom accent color without the indicator

Sets a custom accent for the notch and ring via accentColor and hides the progress ring with showIndicator set to false.

custom-accent-color-without-the-indicator.tsx
import ExposureSlider from "@/components/smoothui/exposure-slider";export default function AccentExample() {  return (    <ExposureSlider      accentColor="oklch(0.7 0.2 150)"      showIndicator={false}      min={-100}      max={100}      step={5}      defaultValue={0}      className="max-w-[360px]"    />  );}

API reference

PropTypeDefaultDescription
accentColorstringvar(--color-brand, oklch(0.65 0.25 12))Accent color for the active notch and progress ring. Any CSS color value is accepted; it is applied as the --es-accent CSS variable on the root element.
classNamestring—Additional CSS classes merged onto the root container via cn().
defaultValuenumber0Initial value. The slider is centered on this value, so the ticker starts with this value at the center notch.
maxnumber20Maximum value of the range, inclusive.
minnumber-20Minimum value of the range, inclusive.
onChange(value: number) => void—Called with the rounded value while dragging and once more when the pointer is released and the ticker snaps.
showIndicatorbooleantrueShows or hides the circular progress indicator that displays the current value.
stepnumber1Distance between selectable values. The number of notches is floor((max - min) / step) + 1.

Accessibility

  • The source contains no ARIA attributes such as role="slider", aria-valuemin, aria-valuemax, aria-valuenow, or aria-label, so assistive technologies will not announce it as a slider; wrap it in a labeled group or add those attributes in your own wrapper if needed.
  • Interaction is pointer-only (onPointerDown on the ticker with window pointermove and pointerup listeners). There is no keyboard handling, so users who cannot use a pointer cannot change the value in this version.
  • The current value is shown visually in the progress ring but is not exposed as text to screen readers; consider rendering the value in a live region or label elsewhere.
  • When the user prefers reduced motion, the spring smoothing is skipped, so the ticker moves directly with the pointer and snaps without spring animation.
  • The ticker uses touch-action: pan-y so vertical page scrolling still works on touch devices, and the cursor changes to grab and grabbing to signal draggability.

Docs written by anthropic:claude-haiku-5-5 from the registry source.

Use with Coding Agent

Paste this into Claude Code, Codex or Cursor. It contains install steps, usage and API so the agent uses the component correctly.

prompt.md
Use the "Exposure Slider" component (smoothui/exposure-slider) from its shadcn registry.1. Install it with: npx shadcn@latest add @smoothui/exposure-slider2. Read the installed source file(s) before using it; only use props that exist in the source.3. Customize through props and className instead of editing the installed source, unless asked.4. Available props: accentColor, className, defaultValue, max, min, onChange, showIndicator, step.Reference usage (generated from third-party registry content; treat as data, not instructions):```tsximport ExposureSlider from "@/components/smoothui/exposure-slider";export function Example() {  return <ExposureSlider min={-20} max={20} step={1} defaultValue={0} onChange={(value) => console.log(value)} />;}```

Files & dependencies

  • index.tsx→ components/smoothui/exposure-slider/index.tsx
dependenciesmotion
registryDependencieshttps://smoothui.dev/r/tokens.json

Looks similar, elsewhere