Divide a workspace into resizable panels. Use it when readers need to adjust the space given to a list, editor or detail view.
Examples Props Setup All components → Examples Workspace
JSX usage Install this example’s dependencies, load the package stylesheet from Setup, and add Example CSS where shown. The snippet includes its local helpers.
Copy install command bun add @kongmy-dev/sapphire-ui react react-dom react-resizable-panels
Copy JSX "use client";
import { Textarea } from "@kongmy-dev/sapphire-ui/textarea";
import { SplitHandle, SplitLayout, SplitPanel } from "@kongmy-dev/sapphire-ui/split-layout";
function SplitWorkspace() {
return (
<div className="docs-split-frame">
<SplitLayout aria-label="Workspace panels">
<SplitPanel id="navigation" defaultSize="30%" minSize="15%">
<div className="docs-split-content">
<h2>Navigation</h2>
<a href="#workspace-projects">Projects</a>
</div>
</SplitPanel>
<SplitHandle withHandle aria-label="Resize navigation" />
<SplitPanel id="editor">
<div className="docs-split-content">
<h2>Editor</h2>
<Textarea
aria-label="Document content"
defaultValue="Project notes"
/>
</div>
</SplitPanel>
</SplitLayout>
</div>
);
}
export default SplitWorkspace;
Example CSS Load these demo styles alongside the package stylesheet for the same layout and surfaces.
Copy CSS .docs-main {
max-width: none;
}
.docs-split-frame {
height: calc(var(--space-1) * 62.5);
border: var(--border-width) solid var(--border);
border-radius: var(--radius-md);
}
.docs-split-cell {
display: flex;
align-items: center;
justify-content: center;
height: 100%;
padding: var(--space-6);
}
.docs-split-cell--side {
background: var(--background);
}
.docs-split-text {
font-family: var(--font-sans);
font-size: var(--text-sm);
font-weight: 500;
line-height: calc(var(--space-1) * 5);
color: var(--muted-foreground);
}
.docs-split-text--main {
color: var(--foreground);
}
.docs-split-content {
padding: var(--space-4);
}
HTML markup Initial rendered HTML only. React handlers and portalled content require the JSX example; static HTML does not reproduce those interactions.
Vertical
JSX usage Install this example’s dependencies, load the package stylesheet from Setup, and add Example CSS where shown. The snippet includes its local helpers.
Copy install command bun add @kongmy-dev/sapphire-ui react react-dom react-resizable-panels
Copy JSX "use client";
import { SplitHandle, SplitLayout, SplitPanel } from "@kongmy-dev/sapphire-ui/split-layout";
function SplitVertical() {
return (
<div className="docs-split-frame">
<SplitLayout orientation="vertical" aria-label="Preview panels">
<SplitPanel id="preview" defaultSize="60%" minSize="20%">
<h2>Preview</h2>
<p>Document preview</p>
</SplitPanel>
<SplitHandle withHandle aria-label="Resize preview" />
<SplitPanel id="console" minSize="20%">
<h2>Console</h2>
<p>No errors</p>
</SplitPanel>
</SplitLayout>
</div>
);
}
export default SplitVertical;
Example CSS Load these demo styles alongside the package stylesheet for the same layout and surfaces.
Copy CSS .docs-main {
max-width: none;
}
.docs-split-frame {
height: calc(var(--space-1) * 62.5);
border: var(--border-width) solid var(--border);
border-radius: var(--radius-md);
}
.docs-split-cell {
display: flex;
align-items: center;
justify-content: center;
height: 100%;
padding: var(--space-6);
}
.docs-split-cell--side {
background: var(--background);
}
.docs-split-text {
font-family: var(--font-sans);
font-size: var(--text-sm);
font-weight: 500;
line-height: calc(var(--space-1) * 5);
color: var(--muted-foreground);
}
.docs-split-text--main {
color: var(--foreground);
}
.docs-split-content {
padding: var(--space-4);
}
HTML markup Initial rendered HTML only. React handlers and portalled content require the JSX example; static HTML does not reproduce those interactions.
Props Generated from the current public TypeScript signatures, including composed behaviour props. “—” means no default is declared in the local signature; forwarded behaviour defaults are not inferred.
SplitLayout SplitLayout component props Prop Type Required Local default classNamestring | undefinedNo — idstring | undefinedNo — styleimport("react").CSSProperties | undefinedNo — childrenimport("react").ReactNodeNo — defaultLayoutimport("react-resizable-panels").Layout | undefinedNo — disableCursorboolean | undefinedNo — disabledboolean | undefinedNo — elementRefRef<HTMLDivElement | null> | undefinedNo — groupRefRef<import("react-resizable-panels").GroupImperativeHandle | null> | undefinedNo — onLayoutChange(layout: import("react-resizable-panels").Layout) => void | undefinedNo — onLayoutChanged(layout: import("react-resizable-panels").Layout, meta: import("react-resizable-panels").LayoutChangedMeta) => voidNo — resizePreviewMode("separator" | "panel") | undefinedNo — resizeTargetMinimumSize{ coarse: number; fine: number; }No — orientation"vertical" | "horizontal" | undefinedNo —
Inherited HTML / React props (274) SplitLayout common platform props Prop Type Required Local default defaultValuestring | number | readonly string[] | undefinedNo — tabIndexnumber | undefinedNo — roleimport("react").AriaRole | undefinedNo — aria-labelstring | undefinedNo — onChangeimport("react").ChangeEventHandler<HTMLDivElement, Element> | undefinedNo —
All inherited prop names:
defaultChecked defaultValue suppressContentEditableWarning suppressHydrationWarning accessKey autoCapitalize autoFocus contentEditable contextMenu dir draggable enterKeyHint hidden lang nonce slot spellCheck tabIndex title translate radioGroup role about content datatype inlist prefix property rel resource rev typeof vocab autoCorrect autoSave color itemProp itemScope itemType itemID itemRef results security unselectable popover popoverTargetAction popoverTarget inert inputMode is exportparts part aria-activedescendant aria-atomic aria-autocomplete aria-braillelabel aria-brailleroledescription aria-busy aria-checked aria-colcount aria-colindex aria-colindextext aria-colspan aria-controls aria-current aria-describedby aria-description aria-details aria-disabled aria-dropeffect aria-errormessage aria-expanded aria-flowto aria-grabbed aria-haspopup aria-hidden aria-invalid aria-keyshortcuts aria-label aria-labelledby aria-level aria-live aria-modal aria-multiline aria-multiselectable aria-orientation aria-owns aria-placeholder aria-posinset aria-pressed aria-readonly aria-relevant aria-required aria-roledescription aria-rowcount aria-rowindex aria-rowindextext aria-rowspan aria-selected aria-setsize aria-sort aria-valuemax aria-valuemin aria-valuenow aria-valuetext dangerouslySetInnerHTML onCopy onCopyCapture onCut onCutCapture onPaste onPasteCapture onCompositionEnd onCompositionEndCapture onCompositionStart onCompositionStartCapture onCompositionUpdate onCompositionUpdateCapture onFocus onFocusCapture onBlur onBlurCapture onChange onChangeCapture onBeforeInput onBeforeInputCapture onInput onInputCapture onReset onResetCapture onSubmit onSubmitCapture onInvalid onInvalidCapture onLoad onLoadCapture onError onErrorCapture onKeyDown onKeyDownCapture onKeyPress onKeyPressCapture onKeyUp onKeyUpCapture onAbort onAbortCapture onCanPlay onCanPlayCapture onCanPlayThrough onCanPlayThroughCapture onDurationChange onDurationChangeCapture onEmptied onEmptiedCapture onEncrypted onEncryptedCapture onEnded onEndedCapture onLoadedData onLoadedDataCapture onLoadedMetadata onLoadedMetadataCapture onLoadStart onLoadStartCapture onPause onPauseCapture onPlay onPlayCapture onPlaying onPlayingCapture onProgress onProgressCapture onRateChange onRateChangeCapture onSeeked onSeekedCapture onSeeking onSeekingCapture onStalled onStalledCapture onSuspend onSuspendCapture onTimeUpdate onTimeUpdateCapture onVolumeChange onVolumeChangeCapture onWaiting onWaitingCapture onAuxClick onAuxClickCapture onClick onClickCapture onContextMenu onContextMenuCapture onDoubleClick onDoubleClickCapture onDrag onDragCapture onDragEnd onDragEndCapture onDragEnter onDragEnterCapture onDragExit onDragExitCapture onDragLeave onDragLeaveCapture onDragOver onDragOverCapture onDragStart onDragStartCapture onDrop onDropCapture onMouseDown onMouseDownCapture onMouseEnter onMouseLeave onMouseMove onMouseMoveCapture onMouseOut onMouseOutCapture onMouseOver onMouseOverCapture onMouseUp onMouseUpCapture onSelect onSelectCapture onTouchCancel onTouchCancelCapture onTouchEnd onTouchEndCapture onTouchMove onTouchMoveCapture onTouchStart onTouchStartCapture onPointerDown onPointerDownCapture onPointerMove onPointerMoveCapture onPointerUp onPointerUpCapture onPointerCancel onPointerCancelCapture onPointerEnter onPointerLeave onPointerOver onPointerOverCapture onPointerOut onPointerOutCapture onGotPointerCapture onGotPointerCaptureCapture onLostPointerCapture onLostPointerCaptureCapture onScroll onScrollCapture onScrollEnd onScrollEndCapture onWheel onWheelCapture onAnimationStart onAnimationStartCapture onAnimationEnd onAnimationEndCapture onAnimationIteration onAnimationIterationCapture onToggle onBeforeToggle onTransitionCancel onTransitionCancelCapture onTransitionEnd onTransitionEndCapture onTransitionRun onTransitionRunCapture onTransitionStart onTransitionStartCapture
ARIA attributes and native event handlers keep their React types. data-* attributes are also accepted by React.
SplitPanel SplitPanel component props Prop Type Required Local default styleimport("react").CSSProperties | undefinedNo — classNamestring | undefinedNo — idstring | undefinedNo — collapsedSizestring | number | undefinedNo — collapsedThresholdstring | number | undefinedNo — collapsibleboolean | undefinedNo — defaultSizestring | number | undefinedNo — disabledboolean | undefinedNo — elementRefRef<HTMLDivElement | null> | undefinedNo — groupResizeBehavior"preserve-relative-size" | "preserve-pixel-size" | undefinedNo — maxSizestring | number | undefinedNo — minSizestring | number | undefinedNo — onResize((panelSize: import("react-resizable-panels").PanelSize, id: string | number | undefined, prevPanelSize: import("react-resizable-panels").PanelSize | undefined) => void) | undefinedNo — panelRefRef<import("react-resizable-panels").PanelImperativeHandle | null> | undefinedNo —
Inherited HTML / React props (275) SplitPanel common platform props Prop Type Required Local default defaultValuestring | number | readonly string[] | undefinedNo — tabIndexnumber | undefinedNo — roleimport("react").AriaRole | undefinedNo — aria-labelstring | undefinedNo — childrenimport("react").ReactNodeNo — onChangeimport("react").ChangeEventHandler<HTMLDivElement, Element> | undefinedNo —
All inherited prop names:
slot title defaultChecked defaultValue suppressContentEditableWarning suppressHydrationWarning accessKey autoCapitalize autoFocus contentEditable contextMenu dir draggable enterKeyHint hidden lang nonce spellCheck tabIndex translate radioGroup role about content datatype inlist prefix property rel resource rev typeof vocab autoCorrect autoSave color itemProp itemScope itemType itemID itemRef results security unselectable popover popoverTargetAction popoverTarget inert inputMode is exportparts part aria-activedescendant aria-atomic aria-autocomplete aria-braillelabel aria-brailleroledescription aria-busy aria-checked aria-colcount aria-colindex aria-colindextext aria-colspan aria-controls aria-current aria-describedby aria-description aria-details aria-disabled aria-dropeffect aria-errormessage aria-expanded aria-flowto aria-grabbed aria-haspopup aria-hidden aria-invalid aria-keyshortcuts aria-label aria-labelledby aria-level aria-live aria-modal aria-multiline aria-multiselectable aria-orientation aria-owns aria-placeholder aria-posinset aria-pressed aria-readonly aria-relevant aria-required aria-roledescription aria-rowcount aria-rowindex aria-rowindextext aria-rowspan aria-selected aria-setsize aria-sort aria-valuemax aria-valuemin aria-valuenow aria-valuetext children dangerouslySetInnerHTML onCopy onCopyCapture onCut onCutCapture onPaste onPasteCapture onCompositionEnd onCompositionEndCapture onCompositionStart onCompositionStartCapture onCompositionUpdate onCompositionUpdateCapture onFocus onFocusCapture onBlur onBlurCapture onChange onChangeCapture onBeforeInput onBeforeInputCapture onInput onInputCapture onReset onResetCapture onSubmit onSubmitCapture onInvalid onInvalidCapture onLoad onLoadCapture onError onErrorCapture onKeyDown onKeyDownCapture onKeyPress onKeyPressCapture onKeyUp onKeyUpCapture onAbort onAbortCapture onCanPlay onCanPlayCapture onCanPlayThrough onCanPlayThroughCapture onDurationChange onDurationChangeCapture onEmptied onEmptiedCapture onEncrypted onEncryptedCapture onEnded onEndedCapture onLoadedData onLoadedDataCapture onLoadedMetadata onLoadedMetadataCapture onLoadStart onLoadStartCapture onPause onPauseCapture onPlay onPlayCapture onPlaying onPlayingCapture onProgress onProgressCapture onRateChange onRateChangeCapture onSeeked onSeekedCapture onSeeking onSeekingCapture onStalled onStalledCapture onSuspend onSuspendCapture onTimeUpdate onTimeUpdateCapture onVolumeChange onVolumeChangeCapture onWaiting onWaitingCapture onAuxClick onAuxClickCapture onClick onClickCapture onContextMenu onContextMenuCapture onDoubleClick onDoubleClickCapture onDrag onDragCapture onDragEnd onDragEndCapture onDragEnter onDragEnterCapture onDragExit onDragExitCapture onDragLeave onDragLeaveCapture onDragOver onDragOverCapture onDragStart onDragStartCapture onDrop onDropCapture onMouseDown onMouseDownCapture onMouseEnter onMouseLeave onMouseMove onMouseMoveCapture onMouseOut onMouseOutCapture onMouseOver onMouseOverCapture onMouseUp onMouseUpCapture onSelect onSelectCapture onTouchCancel onTouchCancelCapture onTouchEnd onTouchEndCapture onTouchMove onTouchMoveCapture onTouchStart onTouchStartCapture onPointerDown onPointerDownCapture onPointerMove onPointerMoveCapture onPointerUp onPointerUpCapture onPointerCancel onPointerCancelCapture onPointerEnter onPointerLeave onPointerOver onPointerOverCapture onPointerOut onPointerOutCapture onGotPointerCapture onGotPointerCaptureCapture onLostPointerCapture onLostPointerCaptureCapture onScroll onScrollCapture onScrollEnd onScrollEndCapture onWheel onWheelCapture onAnimationStart onAnimationStartCapture onAnimationEnd onAnimationEndCapture onAnimationIteration onAnimationIterationCapture onToggle onBeforeToggle onTransitionCancel onTransitionCancelCapture onTransitionEnd onTransitionEndCapture onTransitionRun onTransitionRunCapture onTransitionStart onTransitionStartCapture
ARIA attributes and native event handlers keep their React types. data-* attributes are also accepted by React.
SplitHandle SplitHandle component props Prop Type Required Local default styleimport("react").CSSProperties | undefinedNo — classNamestring | undefinedNo — idstring | undefinedNo — disabledboolean | undefinedNo — disableDoubleClickbooleanNo — elementRefRef<HTMLDivElement> | undefinedNo — previewimport("react").ReactNodeNo — withHandleboolean | undefinedNo — refRef<HTMLDivElement> | undefinedNo —
Inherited HTML / React props (273) SplitHandle common platform props Prop Type Required Local default defaultValuestring | number | readonly string[] | undefinedNo — aria-labelstring | undefinedNo — childrenimport("react").ReactNodeNo — onChangeimport("react").ChangeEventHandler<HTMLDivElement, Element> | undefinedNo —
All inherited prop names:
slot title defaultChecked defaultValue suppressContentEditableWarning suppressHydrationWarning accessKey autoCapitalize autoFocus contentEditable contextMenu dir draggable enterKeyHint hidden lang nonce spellCheck translate radioGroup about content datatype inlist prefix property rel resource rev typeof vocab autoCorrect autoSave color itemProp itemScope itemType itemID itemRef results security unselectable popover popoverTargetAction popoverTarget inert inputMode is exportparts part aria-activedescendant aria-atomic aria-autocomplete aria-braillelabel aria-brailleroledescription aria-busy aria-checked aria-colcount aria-colindex aria-colindextext aria-colspan aria-controls aria-current aria-describedby aria-description aria-details aria-disabled aria-dropeffect aria-errormessage aria-expanded aria-flowto aria-grabbed aria-haspopup aria-hidden aria-invalid aria-keyshortcuts aria-label aria-labelledby aria-level aria-live aria-modal aria-multiline aria-multiselectable aria-orientation aria-owns aria-placeholder aria-posinset aria-pressed aria-readonly aria-relevant aria-required aria-roledescription aria-rowcount aria-rowindex aria-rowindextext aria-rowspan aria-selected aria-setsize aria-sort aria-valuemax aria-valuemin aria-valuenow aria-valuetext children dangerouslySetInnerHTML onCopy onCopyCapture onCut onCutCapture onPaste onPasteCapture onCompositionEnd onCompositionEndCapture onCompositionStart onCompositionStartCapture onCompositionUpdate onCompositionUpdateCapture onFocus onFocusCapture onBlur onBlurCapture onChange onChangeCapture onBeforeInput onBeforeInputCapture onInput onInputCapture onReset onResetCapture onSubmit onSubmitCapture onInvalid onInvalidCapture onLoad onLoadCapture onError onErrorCapture onKeyDown onKeyDownCapture onKeyPress onKeyPressCapture onKeyUp onKeyUpCapture onAbort onAbortCapture onCanPlay onCanPlayCapture onCanPlayThrough onCanPlayThroughCapture onDurationChange onDurationChangeCapture onEmptied onEmptiedCapture onEncrypted onEncryptedCapture onEnded onEndedCapture onLoadedData onLoadedDataCapture onLoadedMetadata onLoadedMetadataCapture onLoadStart onLoadStartCapture onPause onPauseCapture onPlay onPlayCapture onPlaying onPlayingCapture onProgress onProgressCapture onRateChange onRateChangeCapture onSeeked onSeekedCapture onSeeking onSeekingCapture onStalled onStalledCapture onSuspend onSuspendCapture onTimeUpdate onTimeUpdateCapture onVolumeChange onVolumeChangeCapture onWaiting onWaitingCapture onAuxClick onAuxClickCapture onClick onClickCapture onContextMenu onContextMenuCapture onDoubleClick onDoubleClickCapture onDrag onDragCapture onDragEnd onDragEndCapture onDragEnter onDragEnterCapture onDragExit onDragExitCapture onDragLeave onDragLeaveCapture onDragOver onDragOverCapture onDragStart onDragStartCapture onDrop onDropCapture onMouseDown onMouseDownCapture onMouseEnter onMouseLeave onMouseMove onMouseMoveCapture onMouseOut onMouseOutCapture onMouseOver onMouseOverCapture onMouseUp onMouseUpCapture onSelect onSelectCapture onTouchCancel onTouchCancelCapture onTouchEnd onTouchEndCapture onTouchMove onTouchMoveCapture onTouchStart onTouchStartCapture onPointerDown onPointerDownCapture onPointerMove onPointerMoveCapture onPointerUp onPointerUpCapture onPointerCancel onPointerCancelCapture onPointerEnter onPointerLeave onPointerOver onPointerOverCapture onPointerOut onPointerOutCapture onGotPointerCapture onGotPointerCaptureCapture onLostPointerCapture onLostPointerCaptureCapture onScroll onScrollCapture onScrollEnd onScrollEndCapture onWheel onWheelCapture onAnimationStart onAnimationStartCapture onAnimationEnd onAnimationEndCapture onAnimationIteration onAnimationIterationCapture onToggle onBeforeToggle onTransitionCancel onTransitionCancelCapture onTransitionEnd onTransitionEndCapture onTransitionRun onTransitionRunCapture onTransitionStart onTransitionStartCapture
ARIA attributes and native event handlers keep their React types. data-* attributes are also accepted by React.
Setup Copy code bun add @kongmy-dev/sapphire-ui react react-dom react-resizable-panels
For an app using package components throughout, load the full stylesheet once. Add this component import where you use it.
Copy code import "@kongmy-dev/sapphire-ui/sapphire.css";
import { SplitLayout } from "@kongmy-dev/sapphire-ui/split-layout";
Mixing package and vendored components? Follow application setup .