‹ components

SlippageControl

draftv0.9.0·open in canvas

Slippage tolerance — presets + custom %, with risk tone bands.

Installnpx shadcn add @cids/slippage-control
Live demo
Slippage0.5%low

Motion · tap to replay

honors reduced-motion

Chip press: `active:scale-[0.96]` + `duration-150` color/bg. Level word swaps instantly with the value — never animate risk readouts.

Brand chip remounts on tap · highlighted tokens are named in this component's doc · spring is budgeted to human feedback only.

import { SlippageControl } from "@/design-system";

<SlippageControl value={50} onValueChange={setBps} />
{/* 50 bps = 0.5% */}

Tokens · live

Resolves in the active theme — flip the toggle above to verify.

States · from doc

Parsed from the doc. Interact with the live demo for hover/active.

**level** — lownormalelevatedhigh ;word + tint together .**disabled** — opacity 40 on chips/input.

Slippage tolerance — presets + custom %, with risk tone bands.

Anatomy

Slippage                         0.5% LOW
└ label                          └ value + level word (tone ink)

[ 0.1% ] [ 0.5% ] [ 1% ] [ Custom ] [ 0.5 % ]
  └ presets (aria-pressed)          └ custom input when active

Props

PropTypeDefaultNotes
valuenumber—Tolerance in bps (50 = 0.5%).
onValueChange(bps: number) => void—Controlled.
presetsnumber[][10, 50, 100]Preset chips in bps.
maxBpsnumber5000Cap for custom input (50%).
labelstring"Slippage"Row label.
disabledboolean—Disables chips + input.
classNamestring—cn-merged onto the root.

"use client" — owns ephemeral custom-mode + draft string; domain

value is controlled.

Also exports slippageLevel(bps) and DEFAULT_SLIPPAGE_PRESETS.

Motion

Chip press: active:scale-[0.96] + duration-150 color/bg. Level

word swaps instantly with the value — never animate risk readouts.

A11y

role="group" labelled by the row label. Preset/Custom chips use

aria-pressed. Custom field has its own aria-label. Level word

doubles as the non-color risk cue. Hit area: chips h-8 (≥32; pair

with surrounding row padding for comfortable tap).

Self-contained: copy the folder into any Tailwind+React app, or use the install command above. Docs and this page render the same file on disk — they cannot drift.