Expandable card
Give a dense card more room when requested.
npx shadcn@latest add @silicon-ui/expandable-cardInstallation
With the shadcn CLI
npx shadcn@latest add @silicon-ui/expandable-cardManually
Install the dependencies
npm install lucide-react motionCopy these files into your project
- components/silicon-ui/expandable-card/expandable-card.tsx
- components/silicon-ui/expandable-card/expandable-card.module.css
Add the foundation, once per app, for the design and motion tokens
npx shadcn@latest add @silicon-ui/silicon-foundation
Usage
API reference
| Prop | Type | Default |
|---|---|---|
title* | string | — |
children* | ReactNode | — |
description | string | — |
defaultExpanded | boolean | false |
widthCollapsed width cap in px. The card is centered and never wider than its container. Fills the container when omitted. | number | — |
expandedWidthExpanded width cap in px, so the card can grow sideways into more room. Defaults to `width`. | number | — |
Also accepts the props of ComponentPropsWithoutRef<"article">, except title, children, onAnimationStart, onAnimationEnd, onAnimationIteration, onDrag, onDragStart, onDragEnd, onDragOver, onDragLeave, onDragEnter, onDragExit, onDrop.
Dependencies
- npm
- lucide-reactmotion
- Registry
- silicon-motion-tokens