Resizable

A component with resizable panels for flexible layouts.

Installation

Import the component from the passport-ui package.

components/example.tsx
1
2
import { ResizableHandle, ResizablePanel, ResizablePanelGroup } from "passport-ui";
import { Card } from "passport-ui";

Usage

Basic example showing how to use the component.

components/example.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<div className="w-sm h-96">
<ResizablePanelGroup direction="horizontal">
<ResizablePanel defaultSize={50}>
<Card className="h-full rounded-none flex items-center justify-center">
<div className="meta-container">
<h3>Panel One</h3>
<p>This panel can be resized</p>
</div>
</Card>
</ResizablePanel>
<ResizableHandle withHandle />
<ResizablePanel defaultSize={50}>
<Card className="h-full rounded-none flex items-center justify-center">
<div className="meta-container">
<h3>Panel Two</h3>
<p>Drag the handle to resize</p>
</div>
</Card>
</ResizablePanel>
</ResizablePanelGroup>
</div>
{/* Vertical layout */}
<div className="w-sm h-96">
<ResizablePanelGroup direction="vertical">
<ResizablePanel defaultSize={50}>
<Card className="h-full rounded-none">Panel One</Card>
</ResizablePanel>
<ResizableHandle />
<ResizablePanel defaultSize={50}>
<Card className="h-full rounded-none">Panel Two</Card>
</ResizablePanel>
</ResizablePanelGroup>
</div>

Additional resources

Documentation and examples are available in Storybook.