Skip to content
caliper ui pro docs

Magic plus

A list with an add button you can drag: drop the plus between two rows and the new item goes exactly there, the rows parting to show where while you move. A tap adds at the end.

Pro

When to use

  • To-do lists, outlines and checklists where position matters.
  • Touch-first lists where inserting in the middle is otherwise fiddly.

When not to use

  • Lists sorted automatically; position would be ignored.
  • Very long lists that scroll while dragging.

Installation

terminal
pnpm dlx shadcn@latest add @caliper/magic-plus

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

MagicPlus

4 props

Also accepts the native props of its root element and a ref.

PropTypeDefaultDescription
items *MagicPlusItem[]—
onAdd *(index: number) => void—Insert a new item at this index (items.length means at the end).
labelstring"Items"Names the list for assistive technology.
addLabelstring"Add item"Accessible name of the add button.

Keyboard

↑
Moves to the previous item or value.
↓
Moves to the next item or value.
Escape
Closes or cancels, then returns focus to where it came from.
Enter
Activates the focused control.
Space
Activates the focused control.

Accessibility

It is built on native elements and keeps aria-label, aria-hidden and aria-live 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/magic-plus.md

The index of every part is at /llms.txt.

More in Changing values