Accessible resizable panel groups and layouts with keyboard support.
View the full component source code below.
"use client"
import {
Group,
Panel,
Separator,
type GroupProps,
type PanelProps,
type SeparatorProps,
} from "react-resizable-panels"
type ResizeSeparatorProps = SeparatorProps
import { cn } from '@/lib/utils'
function ResizablePanelGroup({
className,
...props
}: GroupProps) {
return (
<Group
data-slot="resizable-panel-group"
className={cn(
"flex h-full w-full aria-[orientation=vertical]:flex-col",
className
)}
{...props}
/>
)
}
function ResizablePanel({ ...props }: PanelProps) {
return <Panel data-slot="resizable-panel" {...props} />
}
function ResizableHandle({
withHandle,
className,
...props
}: ResizeSeparatorProps & {
withHandle?: boolean
}) {
return (
<Separator
data-slot="resizable-handle"
className={cn(
"bg-border focus-visible:ring-ring ring-offset-background relative flex w-px items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:outline-hidden aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:translate-x-0 aria-[orientation=horizontal]:after:-translate-y-1/2 [&[aria-orientation=horizontal]>div]:rotate-90",
className
)}
{...props}
>
{withHandle && (
<div className="bg-border z-10 flex h-6 w-1 shrink-0 rounded-lg" />
)}
</Separator>
)
}
export { ResizableHandle, ResizablePanel, ResizablePanelGroup }
npx shadcn@latest add https://registry.mukoko.com/api/v1/ui/resizableFetch this component's metadata and source code from the registry API.
/api/v1/ui/resizablecomponents/ui/resizable.tsx