CLI previewInstall commands shown on this site are not released yet.

DocsComponentsPrimitives

Resizable

React example follows below.
ts
import { Resizable, ResizablePanel } from "@grassroot/ui-react";
<Resizable defaultSize={50} className="h-[200px] w-full">
<ResizablePanel label="Editor">Drag the handle to split.</ResizablePanel>
<ResizablePanel label="Preview" className="bg-sunken">
Arrow keys nudge the handle when focused.
</ResizablePanel>
</Resizable>
ts
<script setup lang="ts">
import { ResizablePanel, Resizable } from "@grassroot/ui-vue";
</script>
<template>
<Resizable
:default-size="50"
class-name="h-[200px] w-full"
>
<ResizablePanel
label="Editor"
>Drag the handle to split.</ResizablePanel>
<ResizablePanel
label="Preview"
class-name="bg-sunken"
>
Arrow keys nudge the handle when focused.
</ResizablePanel>
</Resizable>
</template>
ts
import { Component } from "@angular/core";
import { GrassrootResizablePanel, GrassrootResizable } from "@grassroot/ui-angular";
@Component({
selector: "app-example",
standalone: true,
imports: [GrassrootResizablePanel, GrassrootResizable],
template: `
<grassroot-resizable
[defaultSize]="50"
className="h-[200px] w-full"
>
<grassroot-resizable-panel
label="Editor"
>Drag the handle to split.</grassroot-resizable-panel>
<grassroot-resizable-panel
label="Preview"
className="bg-sunken"
>
Arrow keys nudge the handle when focused.
</grassroot-resizable-panel>
</grassroot-resizable>
`,
})
export class ExampleComponent {
}
ts
<script lang="ts">
import { ResizablePanel, Resizable } from "@grassroot/ui-svelte";
</script>
<Resizable
defaultSize={50}
className="h-[200px] w-full"
>
<ResizablePanel label="Editor">Drag the handle to split.</ResizablePanel>
<ResizablePanel
label="Preview"
className="bg-sunken"
>
Arrow keys nudge the handle when focused.
</ResizablePanel>
</Resizable>
ts
import { ResizablePanel, Resizable } from "@grassroot/ui-solid";
export function Example() {
return (
<>
<Resizable
defaultSize={50}
className="h-[200px] w-full"
>
<ResizablePanel label="Editor">Drag the handle to split.</ResizablePanel>
<ResizablePanel
label="Preview"
className="bg-sunken"
>
Arrow keys nudge the handle when focused.
</ResizablePanel>
</Resizable>
</>
);
}

Installation

bash
pnpm dlx grassroot add ui/resizable
bash
npx grassroot@latest add ui/resizable
bash
yarn dlx grassroot add ui/resizable
bash
bunx grassroot add ui/resizable

API Reference

ResizableProps
PropTypeDefault
childrenrequiredThe two panes, in order.[React.ReactNode, React.ReactNode]
directionSplit direction."horizontal" | "vertical" | undefined"horizontal"
defaultSizeInitial size of the first pane, in %.number | undefined50
minSizeMinimum size of either pane, in %.number | undefined12
stepKeyboard nudge step, in %.number | undefined4
onResizeNotified after each resize, with the first pane's new %.((size: number) => void) | undefined