Put the content and the trigger in the root.
long-description.tsx
Spoiler
<div>| Prop | Type | Default | Description | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| class | string | — | |||||||||||||||||||
| max | number | 100 | The height in px that shows while closed. Content taller than this gets the control. Default 100. | ||||||||||||||||||
| fade | boolean | true | Fade the bottom edge of the closed content out with a mask. Default true. | ||||||||||||||||||
From Base UICollapsible.RootBase UI docs | |||||||||||||||||||||
| open | boolean | — | Whether the collapsible panel is currently open. To render an uncontrolled collapsible, use the defaultOpen prop instead. | ||||||||||||||||||
| default | boolean | false | Whether the collapsible panel is initially open. To render a controlled collapsible, use the open prop instead. | ||||||||||||||||||
| on | — | Event handler called when the panel is opened or closed. | |||||||||||||||||||
| |||||||||||||||||||||
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. | ||||||||||||||||||
SpoilerContent
<div>| Prop | Type | Default | Description |
|---|---|---|---|
| class | string | — | |
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. |
SpoilerTrigger
<div>| Prop | Type | Default | Description |
|---|---|---|---|
| align | "center""end""start" | — | |
| size | "default""icon""icon-lg""icon-sm""icon-xs""lg""sm""xl""xs" | "sm" | |
| variant | "dashed""default""destructive""destructive-outline""ghost""link""media""outline""secondary" | "ghost" | |
| class | string | — | |
| show | ReactNode | "Show more" | The label while closed. Default "Show more". Pass a translated string. |
| hide | ReactNode | "Show less" | The label while open. Default "Show less": close to the width of "Show more", so the button, which keeps the width of the longer label, shows no gap before the chevron. |
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. |
| EnterorSpace | Opens or closes it from the trigger. |
|---|
Built with
Installs with Spoiler
- Components
- Button,Collapsible





