Quantity pill
Add to an order in one press. Add opens sideways into a − count + pill, the count rolls as it changes, and the minus turns into a bin at one. Focus moves to plus after adding and back to Add after the last one is removed.
- Oat flat whiteDouble shot · £4.20
- Cardamom bunBaked this morning · £3.60
- Sourdough toastCultured butter, sea salt · £5.50
Total£7.20
When to use
- Menus, carts and shop listings where most people add one and some add a few.
- Tight rows where a full number field would crowd the line.
When not to use
- Large quantities typed exactly; use the number field.
- Settings with a range; use a slider.
Installation
pnpm dlx shadcn@latest add @caliper/quantity-pill
Adds its 2 files to components/ui/, each with its own stylesheet, and installs their packages. Pro installs with your access token, set up once per project. See Pro access. The first part also adds Caliper UI’s tokens; import them once as in Installation.
API reference
QuantityPill
5 props
Also accepts the native props of its root element and a ref.
Keyboard
- No custom key handling; Tab and the native activation keys do the work.
Accessibility
It exposes group semantics, with aria-label, aria-hidden and aria-live kept in step with state. Changes that matter are announced through a live region.
Notes for AI
Give your coding assistant this page as Markdown instead of screenshots: the props, keyboard and examples in one file.
/docs/components/quantity-pill.mdThe index of every part is at /llms.txt.