Switch between related panels within the same context. Use tabs for peer views of one subject, with a clear selected tab and keyboard navigation.
Examples Props Setup All components → Examples Controlled
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 radix-ui
Copy JSX "use client";
import { useState } from "react";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@kongmy-dev/sapphire-ui/tabs";
function TabsControlled() {
const [value, setValue] = useState('profile');
return (
<Tabs
value={value}
onValueChange={setValue}
orientation="vertical"
activationMode="manual"
>
<TabsList aria-label="Account sections" variant="pills">
<TabsTrigger value="profile">Profile</TabsTrigger>
<TabsTrigger value="security">Security</TabsTrigger>
</TabsList>
<TabsContent value="profile">Profile preferences</TabsContent>
<TabsContent value="security">Security preferences</TabsContent>
</Tabs>
);
}
export default TabsControlled;
Example CSS Load these demo styles alongside the package stylesheet for the same layout and surfaces.
Copy CSS .docs-tabs-note {
padding: var(--space-3);
font-family: var(--font-sans);
font-size: var(--text-sm);
color: var(--muted-foreground);
}
.docs-tabs-vertical {
display: flex;
min-height: calc(var(--space-1) * 37.5);
}
.docs-tabs-vertical .sp-tabs-list {
flex-shrink: 0;
width: calc(var(--space-1) * 48);
}
.docs-tabs-vertical .sp-tabs-content {
flex: 1;
margin-top: 0;
}
HTML markup Initial rendered HTML only. React handlers and portalled content require the JSX example; static HTML does not reproduce those interactions.
Overview
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 radix-ui
Copy JSX "use client";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@kongmy-dev/sapphire-ui/tabs";
function TabsOverview() {
return (
<Tabs defaultValue="overview">
<TabsList aria-label="Project sections">
<TabsTrigger value="overview">Overview</TabsTrigger>
<TabsTrigger value="activity">Activity</TabsTrigger>
<TabsTrigger value="billing" disabled>
Billing
</TabsTrigger>
</TabsList>
<TabsContent value="overview">Project overview</TabsContent>
<TabsContent value="activity">Recent project activity</TabsContent>
</Tabs>
);
}
export default TabsOverview;
Example CSS Load these demo styles alongside the package stylesheet for the same layout and surfaces.
Copy CSS .docs-tabs-note {
padding: var(--space-3);
font-family: var(--font-sans);
font-size: var(--text-sm);
color: var(--muted-foreground);
}
.docs-tabs-vertical {
display: flex;
min-height: calc(var(--space-1) * 37.5);
}
.docs-tabs-vertical .sp-tabs-list {
flex-shrink: 0;
width: calc(var(--space-1) * 48);
}
.docs-tabs-vertical .sp-tabs-content {
flex: 1;
margin-top: 0;
}
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.
Tabs Tabs component props Prop Type Required Local default valuestring | undefinedNo — defaultValuestring | undefinedNo — onValueChange((value: string) => void) | undefinedNo — orientation("vertical" | "horizontal") | undefinedNo — dir("ltr" | "rtl") | undefinedNo — activationMode("manual" | "automatic") | undefinedNo — asChildboolean | undefinedNo —
Inherited HTML / React props (278) Tabs common platform props Prop Type Required Local default styleimport("react").CSSProperties | undefinedNo — classNamestring | undefinedNo — idstring | undefinedNo — tabIndexnumber | undefinedNo — roleimport("react").AriaRole | undefinedNo — aria-labelstring | undefinedNo — childrenimport("react").ReactNodeNo — onChangeimport("react").ChangeEventHandler<HTMLDivElement, Element> | undefinedNo — refimport("react").Ref<HTMLDivElement> | undefinedNo —
All inherited prop names:
slot style title key defaultChecked suppressContentEditableWarning suppressHydrationWarning accessKey autoCapitalize autoFocus className contentEditable contextMenu draggable enterKeyHint hidden id 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 ref
ARIA attributes and native event handlers keep their React types. data-* attributes are also accepted by React.
TabsList TabsList component props Prop Type Required Local default loopboolean | undefinedNo — asChildboolean | undefinedNo — variant"underline" | "pills" | "dashboard" | undefinedNo 'underline'
Inherited HTML / React props (280) TabsList common platform props Prop Type Required Local default styleimport("react").CSSProperties | undefinedNo — defaultValuestring | number | readonly string[] | undefinedNo — classNamestring | undefinedNo — idstring | undefinedNo — tabIndexnumber | undefinedNo — roleimport("react").AriaRole | undefinedNo — aria-labelstring | undefinedNo — childrenimport("react").ReactNodeNo — onChangeimport("react").ChangeEventHandler<HTMLDivElement, Element> | undefinedNo — refimport("react").Ref<HTMLDivElement> | undefinedNo —
All inherited prop names:
slot style title key defaultChecked defaultValue suppressContentEditableWarning suppressHydrationWarning accessKey autoCapitalize autoFocus className contentEditable contextMenu dir draggable enterKeyHint hidden id 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 ref
ARIA attributes and native event handlers keep their React types. data-* attributes are also accepted by React.
TabsTrigger TabsTrigger component props Prop Type Required Local default valuestringYes — asChildboolean | undefinedNo —
Inherited HTML / React props (289) TabsTrigger common platform props Prop Type Required Local default styleimport("react").CSSProperties | undefinedNo — defaultValuestring | number | readonly string[] | undefinedNo — classNamestring | undefinedNo — idstring | undefinedNo — tabIndexnumber | undefinedNo — roleimport("react").AriaRole | undefinedNo — aria-labelstring | undefinedNo — childrenimport("react").ReactNodeNo — onChangeimport("react").ChangeEventHandler<HTMLButtonElement, Element> | undefinedNo — disabledboolean | undefinedNo — namestring | undefinedNo — type"button" | "submit" | "reset" | undefinedNo — refimport("react").Ref<HTMLButtonElement> | undefinedNo —
All inherited prop names:
form slot style title key defaultChecked defaultValue suppressContentEditableWarning suppressHydrationWarning accessKey autoCapitalize autoFocus className contentEditable contextMenu dir draggable enterKeyHint hidden id 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 disabled formAction formEncType formMethod formNoValidate formTarget name type ref
ARIA attributes and native event handlers keep their React types. data-* attributes are also accepted by React.
TabsContent TabsContent component props Prop Type Required Local default valuestringYes — forceMounttrue | undefinedNo — asChildboolean | undefinedNo —
Inherited HTML / React props (280) TabsContent common platform props Prop Type Required Local default styleimport("react").CSSProperties | undefinedNo — defaultValuestring | number | readonly string[] | undefinedNo — classNamestring | undefinedNo — idstring | undefinedNo — tabIndexnumber | undefinedNo — roleimport("react").AriaRole | undefinedNo — aria-labelstring | undefinedNo — childrenimport("react").ReactNodeNo — onChangeimport("react").ChangeEventHandler<HTMLDivElement, Element> | undefinedNo — refimport("react").Ref<HTMLDivElement> | undefinedNo —
All inherited prop names:
slot style title key defaultChecked defaultValue suppressContentEditableWarning suppressHydrationWarning accessKey autoCapitalize autoFocus className contentEditable contextMenu dir draggable enterKeyHint hidden id 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 ref
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 radix-ui
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 { Tabs } from "@kongmy-dev/sapphire-ui/tabs";
Mixing package and vendored components? Follow application setup .