Skip to content

Commit

Permalink
docs: document props (#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
johnwalley committed Dec 3, 2021
1 parent 2ece9ce commit b0377b1
Showing 1 changed file with 61 additions and 1 deletion.
62 changes: 61 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,67 @@ export const App = () => (
);
```

### Styling
If you want more control over the behaviour of the individual panes you can use the `Allotment.Pane` component. This includes setting the minimum and maximum size of a pane, as well as whether to enable snapping behaviour.

```jsx
<Allotment >
<Allotment.Pane minSize={200}>
<ComponentA>
</Allotment.Pane>
<Allotment.Pane snap>
<ComponentB>
</Allotment.Pane>
</Allotment>
```

## Allotment props

### defaultSizes

An array of initial sizes of the panes. If the sum of the sizes differs from the size of the container then the panes' sizes will be scaled proportionally.

```jsx
<Allotment defaultSizes={[100, 200]}>
<div />
<div />
</Allotment>
```

### maxSize (default: `Infinity`)

Maximum size of any pane.

### minSize (default: `30`)

Minimum size of any pane.

### snap

Enable snap to zero for all panes.

### vertical (default: `false`)

Direction to split. If true then the panes will be stacked vertically, otherwise they will be stacked horizontally.

### onChange

Callback that is fired when the pane sizes change (usually on drag). Recommended to add a debounce function to rate limit the callback.

## Allotment.Pane props

### maxSize

Maximum size of this pane. Overrides `maxSize` set on parent component.

### minSize

Minimum size of this pane. Overrides `minSize` set on parent component.

### snap

Enable snap to zero for this pane. Overrides `snap` set on parent component.

## Styling

Allotment uses [CSS variables](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties) for styling.
You can customize the following default variables.
Expand Down

0 comments on commit b0377b1

Please sign in to comment.