Put one item for each slide or section in the rail. The title and the description in an item fill its preview card.
slide-rail.tsx
PreviewRail
<div>| Prop | Type | Default | Description | |||||||
|---|---|---|---|---|---|---|---|---|---|---|
| class | string | — | ||||||||
| value | string | null | — | The value of the active item (controlled). null: no item is active. | |||||||
| default | string | null | null | The active item at the start (uncontrolled). | |||||||
| on | — | Called with the item value on a click, a key press, or the end of a scrub, and the Base UI change details of that click. | ||||||||
| orientation | "horizontal""vertical" | "vertical" | The axis of the rail (default vertical). | |||||||
| side | "end""start" | "end" | Where the card shows (default end): end is the inline end of a vertical rail (the right in left to right) or under a horizontal one; start is the other side. | |||||||
| size | "default""lg""sm" | "default" | The pitch and tick size: sm 12px, default 16px, lg 20px per item. | |||||||
| magnification | number | 2 | The largest tick scale under the pointer (default 2). 1 turns the growth off. | |||||||
| distance | number | 3 | How far the growth reaches, in ticks (default 3). | |||||||
| card | string | — | Classes of the card (its width, for example). | |||||||
From Base UIToolbar.RootBase UI docs | ||||||||||
| disabled | boolean | — | ||||||||
| loop | boolean | true | If true, using keyboard navigation will wrap focus to the other end of the toolbar once the end is reached. | |||||||
| render | — | Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render. | ||||||||
| ||||||||||
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. | |||||||
PreviewRailItem
<button>| Prop | Type | Default | Description | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| children | ReactNode | — | The card content (PreviewRailTitle, PreviewRailDescription, or your own). | |||||||||||
| class | string | — | ||||||||||||
| value | string | — | The item value: unique in the rail. | |||||||||||
| label | string | — | The name of the item for screen readers, and the card title when there are no children. | |||||||||||
From Base UIToolbar.ButtonBase UI docs | ||||||||||||||
| disabled | boolean | false | When true the item is disabled. | |||||||||||
| focusable | boolean | true | When true the item remains focusable when disabled. | |||||||||||
| render | — | Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render. | ||||||||||||
| ||||||||||||||
| ...props | <button> attributes | — | Every other attribute goes to the <button>, with a ref. | |||||||||||
PreviewRailLink
<div>| Prop | Type | Default | Description |
|---|---|---|---|
| children | ReactNode | — | The card content (PreviewRailTitle, PreviewRailDescription, or your own). |
| class | string | — | |
| value | string | — | The item value: unique in the rail. |
| label | string | — | The name of the item for screen readers, and the card title when there are no children. |
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. |
PreviewRailTitle
<div>| Prop | Type | Default | Description |
|---|---|---|---|
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. |
PreviewRailDescription
<p>| Prop | Type | Default | Description |
|---|---|---|---|
| ...props | <p> attributes | — | Every other attribute goes to the <p>, with a ref. |
PreviewRailSeparator
<div>| Prop | Type | Default | Description |
|---|---|---|---|
| class | string | — | |
From Base UIToolbar.SeparatorBase UI docs | |||
| orientation | "horizontal""vertical" | — | The orientation of the separator. Defaults to the opposite of the toolbar's orientation, so a horizontal toolbar renders vertical separators. |
| render | — | Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render. | |
| style | — | Style applied to the element, or a function that returns a style object based on the component's state. | |
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. |
| Tab | Moves the focus to the current item. The card shows for it. |
|---|---|
| Arrow keys | Move the focus along the rail. |
| Home / End | Move the focus to the first or the last item. |
| Enter / Space | Opens the focused item. |
Built with
Installs with Preview Rail
- Components
- Direction











