Resizable: Remember the layout
useDefaultLayout saves sizes to localStorage and restores them on the next visit without animating in. Give each panel an id.
Resize me, then reload
Detail
This adds the example as components/examples/resizable/persist.tsx, together with the Resizable component and the HextaUI theme tokens it needs.
pnpm dlx shadcn@latest add https://hextaui.com/r/resizable-persist.jsonTo add only the component, follow the Resizable installation.
Props in this example
The Resizable props this example sets, from the API reference.
| Prop | Type | Default |
|---|---|---|
defaultLayout | Layout | – |
onLayoutChangedOnce a change settles. | (layout, meta) => void | – |
| Prop | Type | Default |
|---|---|---|
defaultSize | number | string | – |
minSize | number | string | – |
idNeeded to remember layouts. | string | – |
Every prop is in the Resizable API reference.
See them all, with keyboard support and accessibility notes, on the Resizable page.
- AccordionStacked headings that each reveal a panel, with height motion you can reverse mid-way and panels that stay searchable while closed.
- Aspect ratioA box that holds its shape before media loads, shimmers while loading, fades the media in and falls back when it fails.
- CarouselNative scroll-snap slides with momentum on touch, mouse dragging, arrow keys, dots, thumbnails and an autoplay that pauses when it should.
- CollapsibleA panel that shows and hides with height motion you can reverse mid-way, without jumping the layout.
- Scroll areaNative scrolling with a minimal scrollbar, edges that fade only where there’s more to see, and an optional peek that cuts the last item in half.
- SeparatorA hairline that divides content horizontally or vertically, with an optional label and a decorative mode for purely visual lines.