Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: update imperative API docs #250

Merged
merged 1 commit into from
Dec 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions packages/react-resizable-panels/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ import { Panel, PanelGroup, PanelResizeHandle } from "react-resizable-panels";
`PanelGroup` components also expose an imperative API for manual resizing:
| method | description
| :-------------------------------- | :---
| `setLayout(panelSizes: number[])` | Resize panel group to the specified _panelSizes_ (`[1 - 100, ...]`).
| `getId(): string` | Gets the panel group's ID.
| `getLayout(): number[]` | Gets the panel group's current _layout_ (`[1 - 100, ...]`).
| `setLayout(layout: number[])` | Resize panel group to the specified _layout_ (`[1 - 100, ...]`).

### `Panel`

Expand All @@ -73,9 +75,12 @@ import { Panel, PanelGroup, PanelResizeHandle } from "react-resizable-panels";
| :--------------------------- | :---
| `collapse()` | If panel is `collapsible`, collapse it fully.
| `expand()` | If panel is currently _collapsed_, expand it to its most recent size.
| `getCollapsed(): boolean` | Returns `true` if the panel is currently _collapsed_ (`size === 0`).
| `getId(): string` | Gets the ID of the panel.
| `getSize(): number` | Gets the current size of the panel as a percentage (`1 - 100`).
| `isCollapsed(): boolean` | Returns `true` if the panel is currently _collapsed_ (`size === 0`).
| `isExpanded(): boolean` | Returns `true` if the panel is currently _not collapsed_ (`!isCollapsed()`).
| `getSize(): number` | Returns the most recently commited size of the panel as a percentage (`1 - 100`).
| `resize(percentage: number)` | Resize panel to the specified _percentage_ (`1 - 100`).
| `resize(size: number)` | Resize panel to the specified _percentage_ (`1 - 100`).

### `PanelResizeHandle`

Expand Down