1import {2 Resizable,3 ResizableHandle,4 ResizablePanel,5} from "~/components/ui/resizable";6
7export default function ResizableDemo() {8 return (9 <Resizable class="w-xs rounded-base border-2 border-border">10 <ResizablePanel initialSize={0.25} class="overflow-hidden">11 <div class="flex h-[200px] items-center justify-center p-6">12 <span class="font-semibold">One</span>13 </div>14 </ResizablePanel>15 <ResizableHandle withHandle />16 <ResizablePanel initialSize={0.75} class="overflow-hidden">17 <Resizable orientation="vertical">18 <ResizablePanel initialSize={0.5} class="overflow-hidden">19 <div class="flex h-full items-center justify-center p-6">20 <span class="font-semibold">Two</span>21 </div>22 </ResizablePanel>23 <ResizableHandle />24 <ResizablePanel initialSize={0.5} class="overflow-hidden">25 <div class="flex h-full items-center justify-center p-6">26 <span class="font-semibold">Three</span>27 </div>28 </ResizablePanel>29 </Resizable>30 </ResizablePanel>31 </Resizable>32 );33}
npx shadcn@latest add https://solid-ui-neobrutalism.vercel.app/r/resizable.json
yarn shadcn@latest add https://solid-ui-neobrutalism.vercel.app/r/resizable.json
pnpm dlx shadcn@latest add https://solid-ui-neobrutalism.vercel.app/r/resizable.json
bunx --bun shadcn@latest add https://solid-ui-neobrutalism.vercel.app/r/resizable.json
Install the following dependencies
npm install @corvu/resizable
yarn add @corvu/resizable
pnpm add @corvu/resizable
bun add @corvu/resizable
Copy and paste the following code into your project
1import type { DynamicProps, HandleProps, RootProps } from "@corvu/resizable";2import type { ValidComponent } from "solid-js";3
4import { Show, splitProps } from "solid-js";5import ResizablePrimitive from "@corvu/resizable";6import GripVerticalIcon from "lucide-solid/icons/grip-vertical";7
8import { cn } from "~/lib/utils";9
10type ResizableProps<T extends ValidComponent = "div"> = RootProps<T> & {11 class?: string;12};13
14const Resizable = <T extends ValidComponent = "div">(15 props: DynamicProps<T, ResizableProps<T>>,16) => {17 const [, rest] = splitProps(props as ResizableProps, ["class"]);18 return (19 <ResizablePrimitive20 data-slot="resizable"21 class={cn(22 "flex size-full data-[orientation=vertical]:flex-col",23 props.class,24 )}25 {...rest}26 />27 );28};29
30const ResizablePanel = ResizablePrimitive.Panel;31
32type ResizableHandleProps<T extends ValidComponent = "button"> =33 HandleProps<T> & {34 class?: string;35 withHandle?: boolean;36 };37
38const ResizableHandle = <T extends ValidComponent = "button">(39 props: DynamicProps<T, ResizableHandleProps<T>>,40) => {41 const [, rest] = splitProps(props as ResizableHandleProps, [42 "class",43 "withHandle",44 ]);45 return (46 <ResizablePrimitive.Handle47 data-slot="resizable-handle"48 class={cn(49 "relative flex w-px shrink-0 items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:outline-none data-[orientation=vertical]:h-px data-[orientation=vertical]:w-full data-[orientation=vertical]:after:left-0 data-[orientation=vertical]:after:h-1 data-[orientation=vertical]:after:w-full data-[orientation=vertical]:after:translate-x-0 data-[orientation=vertical]:after:-translate-y-1/2 [&[data-orientation=vertical]>div]:rotate-90",50 props.class,51 )}52 {...rest}53 >54 <Show when={props.withHandle}>55 <div56 data-slot="resizable-grip"57 class="z-10 flex h-5 w-4 items-center justify-center rounded-base border bg-primary text-primary-foreground"58 >59 <GripVerticalIcon class="size-3" />60 </div>61 </Show>62 </ResizablePrimitive.Handle>63 );64};65
66export { Resizable, ResizablePanel, ResizableHandle };
Update the import paths to match your project setup.
1import {2 Resizable,3 ResizableHandle,4 ResizablePanel,5} from "~/components/ui/resizable";
1<Resizable orientation="horizontal">2 <ResizablePanel>One</ResizablePanel>3 <ResizableHandle />4 <ResizablePanel>Two</ResizablePanel>5</Resizable>
1import {2 Resizable,3 ResizableHandle,4 ResizablePanel,5} from "~/components/ui/resizable";6
7export default function ResizableVertical() {8 return (9 <Resizable10 class="max-w-md rounded-base border-2 border-border"11 orientation="vertical"12 >13 <ResizablePanel class="grid place-content-center">One</ResizablePanel>14 <ResizableHandle />15 <ResizablePanel class="grid place-content-center">Two</ResizablePanel>16 </Resizable>17 );18}
1import {2 Resizable,3 ResizableHandle,4 ResizablePanel,5} from "~/components/ui/resizable";6
7export default function ResizableHorizontal() {8 return (9 <Resizable10 class="max-w-md rounded-base border-2 border-border"11 orientation="horizontal"12 >13 <ResizablePanel class="grid place-content-center">One</ResizablePanel>14 <ResizableHandle />15 <ResizablePanel class="grid place-content-center">Two</ResizablePanel>16 </Resizable>17 );18}