< script lang = "ts" >
import * as Resizable from "$lib/components/ui/resizable/index.js" ;
</ script >
< Resizable.PaneGroup direction = "horizontal" class = "max-w-md rounded-lg border" >
< Resizable.Pane defaultSize ={50}>
< div class = "flex h-[200px] items-center justify-center p-6" >
< span class = "font-semibold" > One </ span >
</ div >
</ Resizable.Pane >
< Resizable.Handle />
< Resizable.Pane defaultSize ={50}>
< Resizable.PaneGroup direction = "vertical" >
< Resizable.Pane defaultSize ={25}>
< div class = "flex h-full items-center justify-center p-6" >
< span class = "font-semibold" > Two </ span >
</ div >
</ Resizable.Pane >
< Resizable.Handle />
< Resizable.Pane defaultSize ={75}>
< div class = "flex h-full items-center justify-center p-6" >
< span class = "font-semibold" > Three </ span >
</ div >
</ Resizable.Pane >
</ Resizable.PaneGroup >
</ Resizable.Pane >
</ Resizable.PaneGroup >
Copy
< script lang = "ts" >
import * as Resizable from "$lib/components/ui/resizable/index.js" ;
</ script >
< Resizable.PaneGroup direction = "horizontal" class = "max-w-md rounded-lg border" >
< Resizable.Pane defaultSize ={50}>
< div class = "flex h-[200px] items-center justify-center p-6" >
< span class = "font-semibold" > One </ span >
</ div >
</ Resizable.Pane >
< Resizable.Handle />
< Resizable.Pane defaultSize ={50}>
< Resizable.PaneGroup direction = "vertical" >
< Resizable.Pane defaultSize ={25}>
< div class = "flex h-full items-center justify-center p-6" >
< span class = "font-semibold" > Two </ span >
</ div >
</ Resizable.Pane >
< Resizable.Handle />
< Resizable.Pane defaultSize ={75}>
< div class = "flex h-full items-center justify-center p-6" >
< span class = "font-semibold" > Three </ span >
</ div >
</ Resizable.Pane >
</ Resizable.PaneGroup >
</ Resizable.Pane >
</ Resizable.PaneGroup >
Copy
About The Resizable
component is built on top of PaneForge by Huntabyte . Visit the PaneForge documentation for all the available props and abilities of the Resizable
component.
Installation
npx shadcn-svelte@latest add resizable
select package manager npm Copy Install paneforge
:
npm install paneforge -D
select package manager npm Copy Copy and paste the component source files linked at the top of this page into your project. Usage
< script lang = "ts" >
import * as Resizable from "$lib/components/ui/resizable" ;
</ script >
< Resizable.PaneGroup direction = "horizontal" >
< Resizable.Pane > One </ Resizable.Pane >
< Resizable.Handle />
< Resizable.Pane > Two </ Resizable.Pane >
</ Resizable.PaneGroup >
Copy Examples Vertical Use the direction
prop to set the direction of the resizable panels.
< script lang = "ts" >
import * as Resizable from "$lib/components/ui/resizable/index.js" ;
</ script >
< Resizable.PaneGroup
direction = "vertical"
class = "min-h-[200px] max-w-md rounded-lg border"
>
< Resizable.Pane defaultSize ={25}>
< div class = "flex h-full items-center justify-center p-6" >
< span class = "font-semibold" > Header </ span >
</ div >
</ Resizable.Pane >
< Resizable.Handle />
< Resizable.Pane defaultSize ={75}>
< div class = "flex h-full items-center justify-center p-6" >
< span class = "font-semibold" > Content </ span >
</ div >
</ Resizable.Pane >
</ Resizable.PaneGroup >
Copy
< script lang = "ts" >
import * as Resizable from "$lib/components/ui/resizable/index.js" ;
</ script >
< Resizable.PaneGroup
direction = "vertical"
class = "min-h-[200px] max-w-md rounded-lg border"
>
< Resizable.Pane defaultSize ={25}>
< div class = "flex h-full items-center justify-center p-6" >
< span class = "font-semibold" > Header </ span >
</ div >
</ Resizable.Pane >
< Resizable.Handle />
< Resizable.Pane defaultSize ={75}>
< div class = "flex h-full items-center justify-center p-6" >
< span class = "font-semibold" > Content </ span >
</ div >
</ Resizable.Pane >
</ Resizable.PaneGroup >
Copy
< script lang = "ts" >
import * as Resizable from "$lib/components/ui/resizable" ;
</ script >
< Resizable.PaneGroup direction = "vertical" >
< Resizable.Pane > One </ Resizable.Pane >
< Resizable.Handle />
< Resizable.Pane > Two </ Resizable.Pane >
</ Resizable.PaneGroup >
Copy Handle You can set or hide the handle by using the withHandle
prop on the ResizableHandle
component.
< script lang = "ts" >
import * as Resizable from "$lib/components/ui/resizable/index.js" ;
</ script >
< Resizable.PaneGroup
direction = "horizontal"
class = "min-h-[200px] max-w-md rounded-lg border"
>
< Resizable.Pane defaultSize ={25}>
< div class = "flex h-full items-center justify-center p-6" >
< span class = "font-semibold" > Sidebar </ span >
</ div >
</ Resizable.Pane >
< Resizable.Handle withHandle />
< Resizable.Pane defaultSize ={75}>
< div class = "flex h-full items-center justify-center p-6" >
< span class = "font-semibold" > Content </ span >
</ div >
</ Resizable.Pane >
</ Resizable.PaneGroup >
Copy
< script lang = "ts" >
import * as Resizable from "$lib/components/ui/resizable/index.js" ;
</ script >
< Resizable.PaneGroup
direction = "horizontal"
class = "min-h-[200px] max-w-md rounded-lg border"
>
< Resizable.Pane defaultSize ={25}>
< div class = "flex h-full items-center justify-center p-6" >
< span class = "font-semibold" > Sidebar </ span >
</ div >
</ Resizable.Pane >
< Resizable.Handle withHandle />
< Resizable.Pane defaultSize ={75}>
< div class = "flex h-full items-center justify-center p-6" >
< span class = "font-semibold" > Content </ span >
</ div >
</ Resizable.Pane >
</ Resizable.PaneGroup >
Copy
< script lang = "ts" >
import * as Resizable from "$lib/components/ui/resizable" ;
</ script >
< Resizable.PaneGroup direction = "vertical" >
< Resizable.Pane > One </ Resizable.Pane >
< Resizable.Handle withHandle />
< Resizable.Pane > Two </ Resizable.Pane >
</ Resizable.PaneGroup >
Copy