# ResizablePanelGroup Divide a region into panels with handles that resize adjacent panels by pointer, touch or keyboard. [Interactive guide](/docs/components/resizable) · Forge 3.2.0 Use the API for your installed version. Run `npx --no-install wss3-forge api --json` inside the project. ## Implementation guidance ### When to use it Use ResizablePanelGroup when the reader needs to allocate space among adjacent panels. ### How to compose it Put ResizableHandle between panels. Give each panel a minimum that keeps its main task usable. ### What to verify Exercise the handle with pointer, touch and keyboard and check the smallest permitted sizes. ## Usage ```tsx import { ResizablePanelGroup, ResizablePanel, ResizableHandle } from 'wss3-forge' ``` - Provide alternating panel and handle children and give each handle the name of the pane it resizes. - The native root package measures sizes in percentages. Adjust the adjacent panels with the arrow keys, or use Home and End to move to the allowed bounds. - In the root package, Enter collapses and restores the preceding pane when its minimum size is zero. - Use sizes with onSizesChange when the app stores the layout. Use defaultSizes for an unmanaged layout. - All three engine entries use react-resizable-panels v4. Supply percentage strings for relative panel constraints. Give the group a definite height when splitting it vertically. ```tsx Navigation Content ``` ## Runnable examples ### Nested panels ```tsx import { lazy, useState } from 'react' import { Switch, Text, VStack } from 'wss3-forge' type PanelParts = Pick type SplitVariant = 'nested' | 'vertical' | 'handle' | 'rtl' function splitExample({ ResizablePanelGroup, ResizablePanel, ResizableHandle }: PanelParts, variant: SplitVariant) { return function SplitExample() { const [arabic, setArabic] = useState(true) const rtl = variant === 'rtl' && arabic const nested = variant === 'nested' || variant === 'rtl' const vertical = variant === 'vertical' const pane = (text: string) => {text} return {variant === 'rtl' && } {pane(nested ? (rtl ? 'الملفات' : 'Files') : vertical ? 'Editor' : 'Outline')} {nested ? {pane(rtl ? 'التفاصيل' : 'Details')} {pane(rtl ? 'المعاينة' : 'Preview')} : pane(vertical ? 'Output' : 'Document')} } } function basePreview(variant: SplitVariant) { return lazy(async () => ({ default: splitExample(await import('wss3-forge/base-ui'), variant) })) } const Nested = basePreview('nested') export default function Example() { return () } ``` ### Vertical ```tsx import { lazy, useState } from 'react' import { Switch, Text, VStack } from 'wss3-forge' type PanelParts = Pick type SplitVariant = 'nested' | 'vertical' | 'handle' | 'rtl' function splitExample({ ResizablePanelGroup, ResizablePanel, ResizableHandle }: PanelParts, variant: SplitVariant) { return function SplitExample() { const [arabic, setArabic] = useState(true) const rtl = variant === 'rtl' && arabic const nested = variant === 'nested' || variant === 'rtl' const vertical = variant === 'vertical' const pane = (text: string) => {text} return {variant === 'rtl' && } {pane(nested ? (rtl ? 'الملفات' : 'Files') : vertical ? 'Editor' : 'Outline')} {nested ? {pane(rtl ? 'التفاصيل' : 'Details')} {pane(rtl ? 'المعاينة' : 'Preview')} : pane(vertical ? 'Output' : 'Document')} } } function basePreview(variant: SplitVariant) { return lazy(async () => ({ default: splitExample(await import('wss3-forge/base-ui'), variant) })) } const Vertical = basePreview('vertical') export default function Example() { return () } ``` ### Handle ```tsx import { lazy, useState } from 'react' import { Switch, Text, VStack } from 'wss3-forge' type PanelParts = Pick type SplitVariant = 'nested' | 'vertical' | 'handle' | 'rtl' function splitExample({ ResizablePanelGroup, ResizablePanel, ResizableHandle }: PanelParts, variant: SplitVariant) { return function SplitExample() { const [arabic, setArabic] = useState(true) const rtl = variant === 'rtl' && arabic const nested = variant === 'nested' || variant === 'rtl' const vertical = variant === 'vertical' const pane = (text: string) => {text} return {variant === 'rtl' && } {pane(nested ? (rtl ? 'الملفات' : 'Files') : vertical ? 'Editor' : 'Outline')} {nested ? {pane(rtl ? 'التفاصيل' : 'Details')} {pane(rtl ? 'المعاينة' : 'Preview')} : pane(vertical ? 'Output' : 'Document')} } } function basePreview(variant: SplitVariant) { return lazy(async () => ({ default: splitExample(await import('wss3-forge/base-ui'), variant) })) } const Handle = basePreview('handle') export default function Example() { return () } ``` ### RTL ```tsx import { lazy, useState } from 'react' import { Switch, Text, VStack } from 'wss3-forge' type PanelParts = Pick type SplitVariant = 'nested' | 'vertical' | 'handle' | 'rtl' function splitExample({ ResizablePanelGroup, ResizablePanel, ResizableHandle }: PanelParts, variant: SplitVariant) { return function SplitExample() { const [arabic, setArabic] = useState(true) const rtl = variant === 'rtl' && arabic const nested = variant === 'nested' || variant === 'rtl' const vertical = variant === 'vertical' const pane = (text: string) => {text} return {variant === 'rtl' && } {pane(nested ? (rtl ? 'الملفات' : 'Files') : vertical ? 'Editor' : 'Outline')} {nested ? {pane(rtl ? 'التفاصيل' : 'Details')} {pane(rtl ? 'المعاينة' : 'Preview')} : pane(vertical ? 'Output' : 'Document')} } } function basePreview(variant: SplitVariant) { return lazy(async () => ({ default: splitExample(await import('wss3-forge/base-ui'), variant) })) } const Direction = basePreview('rtl') export default function Example() { return () } ``` ### Controlled message list and preview ```tsx import { useState } from 'react' import { Button, ResizableHandle, ResizablePanel, ResizablePanelGroup, Text, VStack } from 'wss3-forge' function MessageSplit() { const [sizes, setSizes] = useState([35, 65]) return ( Messages Quarterly review Preview The review starts at 10:00. Messages pane: {Math.round(sizes[0])}% ) } export default function Example() { return () } ``` ### Vertical editor and output ```tsx import { ResizableHandle, ResizablePanel, ResizablePanelGroup, Text, VStack } from 'wss3-forge' export default function Example() { return ( Editor Output ) } ``` ## Primitive libraries ### Base UI Pass percentage strings for relative sizes and numeric values for pixels. Use onLayoutChanged to save the layout after a drag. ```sh npm install wss3-forge @base-ui/react ``` ```tsx import { lazy, useState } from 'react' import { Switch, Text, VStack } from 'wss3-forge' type PanelParts = Pick type SplitVariant = 'nested' | 'vertical' | 'handle' | 'rtl' function splitExample({ ResizablePanelGroup, ResizablePanel, ResizableHandle }: PanelParts, variant: SplitVariant) { return function SplitExample() { const [arabic, setArabic] = useState(true) const rtl = variant === 'rtl' && arabic const nested = variant === 'nested' || variant === 'rtl' const vertical = variant === 'vertical' const pane = (text: string) => {text} return {variant === 'rtl' && } {pane(nested ? (rtl ? 'الملفات' : 'Files') : vertical ? 'Editor' : 'Outline')} {nested ? {pane(rtl ? 'التفاصيل' : 'Details')} {pane(rtl ? 'المعاينة' : 'Preview')} : pane(vertical ? 'Output' : 'Document')} } } function basePreview(variant: SplitVariant) { return lazy(async () => ({ default: splitExample(await import('wss3-forge/base-ui'), variant) })) } const Nested = basePreview('nested') export default function Example() { return () } ``` #### Vertical ```tsx import { lazy, useState } from 'react' import { Switch, Text, VStack } from 'wss3-forge' type PanelParts = Pick type SplitVariant = 'nested' | 'vertical' | 'handle' | 'rtl' function splitExample({ ResizablePanelGroup, ResizablePanel, ResizableHandle }: PanelParts, variant: SplitVariant) { return function SplitExample() { const [arabic, setArabic] = useState(true) const rtl = variant === 'rtl' && arabic const nested = variant === 'nested' || variant === 'rtl' const vertical = variant === 'vertical' const pane = (text: string) => {text} return {variant === 'rtl' && } {pane(nested ? (rtl ? 'الملفات' : 'Files') : vertical ? 'Editor' : 'Outline')} {nested ? {pane(rtl ? 'التفاصيل' : 'Details')} {pane(rtl ? 'المعاينة' : 'Preview')} : pane(vertical ? 'Output' : 'Document')} } } function basePreview(variant: SplitVariant) { return lazy(async () => ({ default: splitExample(await import('wss3-forge/base-ui'), variant) })) } const Vertical = basePreview('vertical') export default function Example() { return () } ``` #### Handle ```tsx import { lazy, useState } from 'react' import { Switch, Text, VStack } from 'wss3-forge' type PanelParts = Pick type SplitVariant = 'nested' | 'vertical' | 'handle' | 'rtl' function splitExample({ ResizablePanelGroup, ResizablePanel, ResizableHandle }: PanelParts, variant: SplitVariant) { return function SplitExample() { const [arabic, setArabic] = useState(true) const rtl = variant === 'rtl' && arabic const nested = variant === 'nested' || variant === 'rtl' const vertical = variant === 'vertical' const pane = (text: string) => {text} return {variant === 'rtl' && } {pane(nested ? (rtl ? 'الملفات' : 'Files') : vertical ? 'Editor' : 'Outline')} {nested ? {pane(rtl ? 'التفاصيل' : 'Details')} {pane(rtl ? 'المعاينة' : 'Preview')} : pane(vertical ? 'Output' : 'Document')} } } function basePreview(variant: SplitVariant) { return lazy(async () => ({ default: splitExample(await import('wss3-forge/base-ui'), variant) })) } const Handle = basePreview('handle') export default function Example() { return () } ``` #### RTL ```tsx import { lazy, useState } from 'react' import { Switch, Text, VStack } from 'wss3-forge' type PanelParts = Pick type SplitVariant = 'nested' | 'vertical' | 'handle' | 'rtl' function splitExample({ ResizablePanelGroup, ResizablePanel, ResizableHandle }: PanelParts, variant: SplitVariant) { return function SplitExample() { const [arabic, setArabic] = useState(true) const rtl = variant === 'rtl' && arabic const nested = variant === 'nested' || variant === 'rtl' const vertical = variant === 'vertical' const pane = (text: string) => {text} return {variant === 'rtl' && } {pane(nested ? (rtl ? 'الملفات' : 'Files') : vertical ? 'Editor' : 'Outline')} {nested ? {pane(rtl ? 'التفاصيل' : 'Details')} {pane(rtl ? 'المعاينة' : 'Preview')} : pane(vertical ? 'Output' : 'Document')} } } function basePreview(variant: SplitVariant) { return lazy(async () => ({ default: splitExample(await import('wss3-forge/base-ui'), variant) })) } const Direction = basePreview('rtl') export default function Example() { return () } ``` ### Radix Pass percentage strings for relative sizes and numeric values for pixels. Use onLayoutChanged to save the layout after a drag. ```sh npm install wss3-forge radix-ui ``` ```tsx import { lazy, useState } from 'react' import { Switch, Text, VStack } from 'wss3-forge' type PanelParts = Pick type SplitVariant = 'nested' | 'vertical' | 'handle' | 'rtl' function splitExample({ ResizablePanelGroup, ResizablePanel, ResizableHandle }: PanelParts, variant: SplitVariant) { return function SplitExample() { const [arabic, setArabic] = useState(true) const rtl = variant === 'rtl' && arabic const nested = variant === 'nested' || variant === 'rtl' const vertical = variant === 'vertical' const pane = (text: string) => {text} return {variant === 'rtl' && } {pane(nested ? (rtl ? 'الملفات' : 'Files') : vertical ? 'Editor' : 'Outline')} {nested ? {pane(rtl ? 'التفاصيل' : 'Details')} {pane(rtl ? 'المعاينة' : 'Preview')} : pane(vertical ? 'Output' : 'Document')} } } function basePreview(variant: SplitVariant) { return lazy(async () => ({ default: splitExample(await import('wss3-forge/radix'), variant) })) } const Nested = basePreview('nested') export default function Example() { return () } ``` #### Vertical ```tsx import { lazy, useState } from 'react' import { Switch, Text, VStack } from 'wss3-forge' type PanelParts = Pick type SplitVariant = 'nested' | 'vertical' | 'handle' | 'rtl' function splitExample({ ResizablePanelGroup, ResizablePanel, ResizableHandle }: PanelParts, variant: SplitVariant) { return function SplitExample() { const [arabic, setArabic] = useState(true) const rtl = variant === 'rtl' && arabic const nested = variant === 'nested' || variant === 'rtl' const vertical = variant === 'vertical' const pane = (text: string) => {text} return {variant === 'rtl' && } {pane(nested ? (rtl ? 'الملفات' : 'Files') : vertical ? 'Editor' : 'Outline')} {nested ? {pane(rtl ? 'التفاصيل' : 'Details')} {pane(rtl ? 'المعاينة' : 'Preview')} : pane(vertical ? 'Output' : 'Document')} } } function basePreview(variant: SplitVariant) { return lazy(async () => ({ default: splitExample(await import('wss3-forge/radix'), variant) })) } const Vertical = basePreview('vertical') export default function Example() { return () } ``` #### Handle ```tsx import { lazy, useState } from 'react' import { Switch, Text, VStack } from 'wss3-forge' type PanelParts = Pick type SplitVariant = 'nested' | 'vertical' | 'handle' | 'rtl' function splitExample({ ResizablePanelGroup, ResizablePanel, ResizableHandle }: PanelParts, variant: SplitVariant) { return function SplitExample() { const [arabic, setArabic] = useState(true) const rtl = variant === 'rtl' && arabic const nested = variant === 'nested' || variant === 'rtl' const vertical = variant === 'vertical' const pane = (text: string) => {text} return {variant === 'rtl' && } {pane(nested ? (rtl ? 'الملفات' : 'Files') : vertical ? 'Editor' : 'Outline')} {nested ? {pane(rtl ? 'التفاصيل' : 'Details')} {pane(rtl ? 'المعاينة' : 'Preview')} : pane(vertical ? 'Output' : 'Document')} } } function basePreview(variant: SplitVariant) { return lazy(async () => ({ default: splitExample(await import('wss3-forge/radix'), variant) })) } const Handle = basePreview('handle') export default function Example() { return () } ``` #### RTL ```tsx import { lazy, useState } from 'react' import { Switch, Text, VStack } from 'wss3-forge' type PanelParts = Pick type SplitVariant = 'nested' | 'vertical' | 'handle' | 'rtl' function splitExample({ ResizablePanelGroup, ResizablePanel, ResizableHandle }: PanelParts, variant: SplitVariant) { return function SplitExample() { const [arabic, setArabic] = useState(true) const rtl = variant === 'rtl' && arabic const nested = variant === 'nested' || variant === 'rtl' const vertical = variant === 'vertical' const pane = (text: string) => {text} return {variant === 'rtl' && } {pane(nested ? (rtl ? 'الملفات' : 'Files') : vertical ? 'Editor' : 'Outline')} {nested ? {pane(rtl ? 'التفاصيل' : 'Details')} {pane(rtl ? 'المعاينة' : 'Preview')} : pane(vertical ? 'Output' : 'Document')} } } function basePreview(variant: SplitVariant) { return lazy(async () => ({ default: splitExample(await import('wss3-forge/radix'), variant) })) } const Direction = basePreview('rtl') export default function Example() { return () } ``` ### React Aria Pass percentage strings for relative sizes and numeric values for pixels. Use onLayoutChanged to save the layout after a drag. ```sh npm install wss3-forge react-aria-components ``` ```tsx import { lazy, useState } from 'react' import { Switch, Text, VStack } from 'wss3-forge' type PanelParts = Pick type SplitVariant = 'nested' | 'vertical' | 'handle' | 'rtl' function splitExample({ ResizablePanelGroup, ResizablePanel, ResizableHandle }: PanelParts, variant: SplitVariant) { return function SplitExample() { const [arabic, setArabic] = useState(true) const rtl = variant === 'rtl' && arabic const nested = variant === 'nested' || variant === 'rtl' const vertical = variant === 'vertical' const pane = (text: string) => {text} return {variant === 'rtl' && } {pane(nested ? (rtl ? 'الملفات' : 'Files') : vertical ? 'Editor' : 'Outline')} {nested ? {pane(rtl ? 'التفاصيل' : 'Details')} {pane(rtl ? 'المعاينة' : 'Preview')} : pane(vertical ? 'Output' : 'Document')} } } function basePreview(variant: SplitVariant) { return lazy(async () => ({ default: splitExample(await import('wss3-forge/react-aria'), variant) })) } const Nested = basePreview('nested') export default function Example() { return () } ``` #### Vertical ```tsx import { lazy, useState } from 'react' import { Switch, Text, VStack } from 'wss3-forge' type PanelParts = Pick type SplitVariant = 'nested' | 'vertical' | 'handle' | 'rtl' function splitExample({ ResizablePanelGroup, ResizablePanel, ResizableHandle }: PanelParts, variant: SplitVariant) { return function SplitExample() { const [arabic, setArabic] = useState(true) const rtl = variant === 'rtl' && arabic const nested = variant === 'nested' || variant === 'rtl' const vertical = variant === 'vertical' const pane = (text: string) => {text} return {variant === 'rtl' && } {pane(nested ? (rtl ? 'الملفات' : 'Files') : vertical ? 'Editor' : 'Outline')} {nested ? {pane(rtl ? 'التفاصيل' : 'Details')} {pane(rtl ? 'المعاينة' : 'Preview')} : pane(vertical ? 'Output' : 'Document')} } } function basePreview(variant: SplitVariant) { return lazy(async () => ({ default: splitExample(await import('wss3-forge/react-aria'), variant) })) } const Vertical = basePreview('vertical') export default function Example() { return () } ``` #### Handle ```tsx import { lazy, useState } from 'react' import { Switch, Text, VStack } from 'wss3-forge' type PanelParts = Pick type SplitVariant = 'nested' | 'vertical' | 'handle' | 'rtl' function splitExample({ ResizablePanelGroup, ResizablePanel, ResizableHandle }: PanelParts, variant: SplitVariant) { return function SplitExample() { const [arabic, setArabic] = useState(true) const rtl = variant === 'rtl' && arabic const nested = variant === 'nested' || variant === 'rtl' const vertical = variant === 'vertical' const pane = (text: string) => {text} return {variant === 'rtl' && } {pane(nested ? (rtl ? 'الملفات' : 'Files') : vertical ? 'Editor' : 'Outline')} {nested ? {pane(rtl ? 'التفاصيل' : 'Details')} {pane(rtl ? 'المعاينة' : 'Preview')} : pane(vertical ? 'Output' : 'Document')} } } function basePreview(variant: SplitVariant) { return lazy(async () => ({ default: splitExample(await import('wss3-forge/react-aria'), variant) })) } const Handle = basePreview('handle') export default function Example() { return () } ``` #### RTL ```tsx import { lazy, useState } from 'react' import { Switch, Text, VStack } from 'wss3-forge' type PanelParts = Pick type SplitVariant = 'nested' | 'vertical' | 'handle' | 'rtl' function splitExample({ ResizablePanelGroup, ResizablePanel, ResizableHandle }: PanelParts, variant: SplitVariant) { return function SplitExample() { const [arabic, setArabic] = useState(true) const rtl = variant === 'rtl' && arabic const nested = variant === 'nested' || variant === 'rtl' const vertical = variant === 'vertical' const pane = (text: string) => {text} return {variant === 'rtl' && } {pane(nested ? (rtl ? 'الملفات' : 'Files') : vertical ? 'Editor' : 'Outline')} {nested ? {pane(rtl ? 'التفاصيل' : 'Details')} {pane(rtl ? 'المعاينة' : 'Preview')} : pane(vertical ? 'Output' : 'Document')} } } function basePreview(variant: SplitVariant) { return lazy(async () => ({ default: splitExample(await import('wss3-forge/react-aria'), variant) })) } const Direction = basePreview('rtl') export default function Example() { return () } ``` ## Root package API ### ResizablePanelGroup Divide a region into panels with handles that resize adjacent panels by pointer, touch or keyboard. Props type: `ResizablePanelGroupProps` Native attributes: AriaAttributes, DOMAttributes, HTMLAttributes - `orientation?` — `Orientation` Default `'horizontal'`. Options `"horizontal"`, `"vertical"`. Axis along which the panels are arranged. - `sizes?` — `readonly number[]` Controlled panel sizes, in percentages in panel order. - `defaultSizes?` — `readonly number[]` Initial percentages for an uncontrolled group. Defaults to equal sizes. - `onSizesChange?` — `(sizes: number[]) => void` Receives updated percentages after resizing. - `keyboardStep?` — `number` Default `5`. Percentage points moved per arrow press. - `ref?` — `React.LegacyRef | undefined` ### ResizablePanel Props type: `ResizablePanelProps` Native attributes: AriaAttributes, DOMAttributes, HTMLAttributes - `minSize?` — `number` Default `0`. Smallest allowed share of the panel area. - `maxSize?` — `number` Default `100`. Largest allowed share of the panel area. - `ref?` — `React.LegacyRef | undefined` ### ResizableHandle Props type: `ResizableHandleProps` Native attributes: AriaAttributes, DOMAttributes, HTMLAttributes - `withHandle?` — `boolean` Default `false`. - `disabled?` — `boolean` Default `false`. - `ref?` — `React.LegacyRef | undefined` ## Related types ```ts type Orientation = 'horizontal' | 'vertical' export interface ResizablePanelGroupProps extends HTMLAttributes { /** Axis along which the panels are arranged. @default 'horizontal' */ orientation?: Orientation /** Controlled panel sizes, in percentages in panel order. */ sizes?: readonly number[] /** Initial percentages for an uncontrolled group. Defaults to equal sizes. */ defaultSizes?: readonly number[] onSizesChange?: (sizes: number[]) => void /** Percentage points moved per arrow press. @default 5 */ keyboardStep?: number } export interface ResizablePanelProps extends HTMLAttributes { /** Smallest allowed share of the panel area. @default 0 */ minSize?: number /** Largest allowed share of the panel area. @default 100 */ maxSize?: number } export interface ResizableHandleProps extends HTMLAttributes { withHandle?: boolean disabled?: boolean } ``` ## Optional primitive contracts - [wss3-forge/base-ui · ResizablePanelGroup contract](/ai/skill/primitive-api/ResizablePanelGroup.json) - [wss3-forge/radix · ResizablePanelGroup contract](/ai/skill/primitive-api/ResizablePanelGroup.json) - [wss3-forge/react-aria · ResizablePanelGroup contract](/ai/skill/primitive-api/ResizablePanelGroup.json)