Accessible resizable panel groups and layouts with keyboard support.
About
The Resizable component is a Templ pendant of react-resizable-panels, the same primitive used by shadcn’s Base UI variant. Its UI behavior targets react-resizable-panels 4.5.8, the version currently resolved by shadcn/ui.
Installation
Copy and paste the following code into your project.
Component scripts are loaded through the shared script bundle, see JavaScript.
Update the import paths to match your project setup.
Usage
Composition
Panel and Handle components must be direct children of PanelGroup.
Vertical
Use Orientation: resizable.OrientationVertical for vertical resizing.
Handle
Use WithHandle: true to show a visible grip.
RTL
Resizable panel groups follow the document direction.
Imperative API
The browser API mirrors the panel and group imperative handles used by shadcn’s primitive.
getSize returns { asPercentage, inPixels }. Group layouts are objects keyed by panel ID, matching react-resizable-panels v4. PanelGroup dispatches resizable-layout-change while resizing and resizable-layout-changed when the interaction is committed. Both events expose { layout } in event.detail; the completed event also includes isUserInteraction.
API Reference
PanelGroup
| Prop | Type | Default |
|---|---|---|
Orientation |
OrientationHorizontal | OrientationVertical |
OrientationHorizontal |
DefaultLayout |
map[string]float64 |
- |
Disabled |
bool |
false |
DisableCursor |
bool |
false |
ResizeTargetMinimumSize |
ResizeTargetMinimumSize |
{Coarse: 20, Fine: 10} |
ID |
string |
generated |
Class |
string |
- |
Style |
string |
- |
Attributes |
templ.Attributes |
- |
Panel
Sizes accept percentages, pixels, unitless percentage strings, and CSS length units. Numeric values passed to the JavaScript API are pixels, matching react-resizable-panels v4.
| Prop | Type | Default |
|---|---|---|
DefaultSize |
string |
auto |
MinSize |
string |
0% |
MaxSize |
string |
100% |
Collapsible |
bool |
false |
CollapsedSize |
string |
0% |
Disabled |
bool |
false |
GroupResizeBehavior |
GroupResizeBehavior |
PreserveRelativeSize |
ID |
string |
generated |
Class |
string |
- |
Style |
string |
- |
Attributes |
templ.Attributes |
- |
Handle
| Prop | Type | Default |
|---|---|---|
WithHandle |
bool |
false |
Disabled |
bool |
false |
DisableDoubleClick |
bool |
false |
ID |
string |
generated |
Class |
string |
- |
Style |
string |
- |
Attributes |
templ.Attributes |
- |
Changelog
react-resizable-panels 4.5.8
This pendant follows the concrete v4 version currently resolved by shadcn/ui rather than an unspecified moving v4 target. Panel sizes use CSS-aware values such as "50%", layouts are keyed by panel ID, PanelGroup maps to Group, and Handle maps to Separator.