{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "bookshelf",
  "title": "Bookshelf",
  "author": "VenusUI",
  "description": "Books on a wooden shelf whose spines lift on hover and pull out when selected, with a matching cover.",
  "files": [
    {
      "path": "registry/default/ui/bookshelf.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\nexport interface ShelfBook {\n  id: string\n  title: string\n  author: string\n  /** Cover and spine color: any CSS color. */\n  color: string\n  /** Text color on the spine and cover. */\n  ink?: string\n  /** Height relative to the tallest book, 0.7–1. */\n  height?: number\n  /** Spine thickness in px. */\n  thickness?: number\n}\n\ninterface BookshelfProps extends Omit<React.ComponentProps<\"div\">, \"onSelect\"> {\n  books: ShelfBook[]\n  /** Id of the selected book (pulled out of the shelf). */\n  selected?: string\n  onSelect?: (book: ShelfBook) => void\n  /** Accessible name for the shelf, e.g. \"Staff picks\". */\n  label?: string\n}\n\n/** The front cover of a book, for showing the one picked from the shelf. */\nfunction BookCover({ book, className }: { book: ShelfBook; className?: string }) {\n  return (\n    <div\n      className={cn(\"@container relative aspect-[2/3] w-full overflow-hidden rounded-r-md rounded-l-sm p-[12%] shadow-[0_20px_30px_-12px_rgb(0_0_0/0.45)]\", className)}\n      style={{ background: book.color, color: book.ink ?? \"#fff\" }}\n    >\n      {/* Spine fold and cloth texture */}\n      <span aria-hidden=\"true\" className=\"absolute inset-y-0 left-0 w-[7%] bg-linear-to-r from-black/30 via-black/5 to-white/10\" />\n      <span aria-hidden=\"true\" className=\"absolute inset-0 bg-[repeating-linear-gradient(0deg,rgb(255_255_255/0.04)_0_1px,transparent_1px_3px)]\" />\n      <div className=\"relative flex h-full flex-col\">\n        <span aria-hidden=\"true\" className=\"h-px w-1/3 bg-current opacity-60\" />\n        <p className=\"mt-[10%] font-serif text-[clamp(1.1rem,9cqw,1.9rem)] leading-tight text-balance\">{book.title}</p>\n        <p className=\"mt-auto text-[clamp(0.65rem,4.5cqw,0.85rem)] tracking-[0.2em] uppercase opacity-80\">{book.author}</p>\n      </div>\n    </div>\n  )\n}\n\n/**\n * Books standing on a wooden shelf. Hovering or focusing a spine lifts it;\n * selecting one (click, Enter or Space) pulls it out and calls `onSelect`.\n * Each spine is a button with `aria-pressed`, named by title and author.\n */\nfunction Bookshelf({ books, selected, onSelect, label = \"Bookshelf\", className, ...props }: BookshelfProps) {\n  return (\n    <div data-slot=\"bookshelf\" role=\"group\" aria-label={label} className={cn(\"w-fit max-w-full\", className)} {...props}>\n      <div className=\"flex h-72 items-end gap-[3px] overflow-x-auto px-8 pt-10\">\n        {books.map((book) => {\n          const isSelected = book.id === selected\n          return (\n            <button\n              key={book.id}\n              type=\"button\"\n              aria-pressed={isSelected}\n              aria-label={`${book.title} by ${book.author}`}\n              onClick={() => onSelect?.(book)}\n              className={cn(\n                \"group/book relative flex shrink-0 flex-col items-center justify-between overflow-hidden rounded-t-[3px] py-3 outline-none\",\n                \"shadow-[inset_-3px_0_6px_rgb(0_0_0/0.25),inset_3px_0_4px_rgb(255_255_255/0.12)] transition-transform duration-300 ease-out motion-reduce:transition-none\",\n                \"hover:-translate-y-3 focus-visible:-translate-y-3 focus-visible:ring-3 focus-visible:ring-ring/60\",\n                isSelected && \"-translate-y-8 hover:-translate-y-8 focus-visible:-translate-y-8\"\n              )}\n              style={{\n                width: book.thickness ?? 36,\n                height: `${(book.height ?? 1) * 100}%`,\n                background: book.color,\n                color: book.ink ?? \"#fff\",\n              }}\n            >\n              <span aria-hidden=\"true\" className=\"h-[3px] w-full bg-current opacity-40\" />\n              <span className=\"min-h-0 flex-1 overflow-hidden py-2 font-serif text-[13px] leading-none text-ellipsis whitespace-nowrap [writing-mode:vertical-rl]\">\n                {book.title}\n              </span>\n              <span className=\"mt-2 text-[8px] tracking-wider uppercase opacity-90 [writing-mode:vertical-rl]\">{book.author.split(\" \").pop()}</span>\n              <span aria-hidden=\"true\" className=\"mt-1 h-[3px] w-full bg-current opacity-40\" />\n            </button>\n          )\n        })}\n      </div>\n      {/* Shelf plank */}\n      <div aria-hidden=\"true\" className=\"relative h-5 rounded-sm bg-linear-to-b from-amber-700 via-amber-800 to-amber-950 shadow-[0_14px_20px_-10px_rgb(0_0_0/0.55)]\">\n        <span className=\"absolute inset-x-0 top-0 h-px bg-amber-500/60\" />\n        <span className=\"absolute inset-x-0 top-1.5 h-px bg-[repeating-linear-gradient(90deg,rgb(0_0_0/0.18)_0_40px,transparent_40px_90px)]\" />\n      </div>\n    </div>\n  )\n}\n\nexport { Bookshelf, BookCover }\n",
      "type": "registry:ui"
    }
  ],
  "meta": {
    "version": "0.1.1"
  },
  "categories": [
    "interactive",
    "data-display"
  ],
  "type": "registry:ui"
}