Resizable
optics/resizableFreeComponent
Accessible resizable panel groups and layouts.
See it running
Open the demo on optics
optics.agusmayol.com.ar/components/resizableInstall it
npx shadcn@latest add https://optics.agusmayol.com.ar/r/resizable.jsonSource
1"use client";23import * as React from "react";4import * as ResizablePrimitive from "react-resizable-panels";56import { cn } from "@/lib/utils";78function ResizablePanelGroup({ className = "", ...props }) {9 return (10 <ResizablePrimitive.PanelGroup11 data-slot="resizable-panel-group"12 className={cn(13 "flex h-full w-full data-[panel-group-direction=vertical]:flex-col",14 className,15 )}16 {...props}17 />18 );19}2021function ResizablePanel({ ...props } = {}) {22 return <ResizablePrimitive.Panel data-slot="resizable-panel" {...props} />;23}2425function ResizableHandle({ withHandle = false, className = "", ...props }) {26 return (27 <ResizablePrimitive.PanelResizeHandle28 data-slot="resizable-handle"29 className={cn(30 "bg-border focus-visible:ring-ring 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:ring-offset-1 focus-visible:outline-hidden data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:translate-x-0 data-[panel-group-direction=vertical]:after:-translate-y-1/2 [&[data-panel-group-direction=vertical]>div]:rotate-90",31 className,32 )}33 {...props}34 >35 {withHandle && (36 <div className="bg-border h-6 w-1 rounded-lg z-10 flex shrink-0" />37 )}38 </ResizablePrimitive.PanelResizeHandle>39 );40}4142ResizablePanelGroup.displayName = "ResizablePanelGroup";43ResizablePanel.displayName = "ResizablePanel";44ResizableHandle.displayName = "ResizableHandle";4546export { ResizablePanelGroup, ResizablePanel, ResizableHandle };
What it pulls in
npm packages
Other registry items
Files it writes
More from optics
All 79 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | optics | Components | Free | 5 deps | |
| Alertalert | optics | Components | Free | 4 deps | |
| Alert Dialogalert-dialog | optics | Components | Free | 4 deps | |
| Aspect Ratioaspect-ratio | optics | Components | Free | 2 deps | |
| Auto Heightauto-height | optics | Components | Free | 3 deps | |
| Avataravatar | optics | Components | Free | 3 deps | |
| Badgebadge | optics | Components | Free | 4 deps | |
| Breadcrumbbreadcrumb | optics | Components | Free | 4 deps |
