Skip to content
caliper ui pro docs

Book shelf

A shelf of documents as spines. Width follows the page count, so a dozen fit in a row and scan like a list. Hover or focus tugs a spine up by its top; choosing one takes it off the shelf, its neighbours lean into the gap, and the book swings round beside the shelf to show its cover, page edge and details.

Pro
Pick a book

12 documents. Hover or focus a spine to tug it; press it to take the book off the shelf.

Last updated by Priya N. on October 14

When to use

  • A library of runbooks, handbooks or reports where people browse before they open.
  • Showing how much there is and who owns it, with one document inspected at a time.

When not to use

  • Search results or anything people filter by text; use a list or a table.
  • More than about twenty documents; the shelf scrolls sideways and loses its overview.

Installation

terminal
pnpm dlx shadcn@latest add @caliper/book-shelf

Adds its 5 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

BookShelf

11 props
PropTypeDefaultDescription
labelstring"Library shelf"Names the shelf for screen readers.
items *readonly BookShelfItem[]—
selectedstring | null—The id of the book pulled out, or null. Controlled when set.
defaultSelectedstring | nullnull
onSelect((id: string | null) => void)—
onOpen((id: string) => void)—Adds an Open button to the cover.
statusDepthStatus"ready"
messagesDepthMessages—
onRetry(() => void)—
disabledboolean—
classNamestring—

Keyboard

→
Moves to the next item or value.
←
Moves to the previous item or value.
Home
Jumps to the first item or the minimum.
End
Jumps to the last item or the maximum.
Escape
Closes or cancels, then returns focus to where it came from.

Accessibility

It is built on native elements and keeps aria-label, aria-pressed, 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/book-shelf.md

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

More in Surfaces