Sidepanel
Sidepanel is an overlay panel that slides in from the left or right edge of the viewport.
import { RiCloseLine } from '@remixicon/react';
import { Button } from '@/components/ui/wideset/button/Button';
import { IconButton } from '@/components/ui/wideset/button/IconButton';
import { Sidepanel } from '@/components/ui/wideset/sidepanel/Sidepanel';
<Sidepanel>
<Sidepanel.Trigger asChild>
<Button variant="secondary" preset="border">View order details</Button>
</Sidepanel.Trigger>
<Sidepanel.Panel>
<Sidepanel.Actions>
<Sidepanel.Close asChild>
<IconButton
aria-label="Close"
icon={RiCloseLine}
preset="border"
variant="secondary"
size="sm"
className="size-ws-forms-sm p-0"
/>
</Sidepanel.Close>
</Sidepanel.Actions>
<Sidepanel.Header>
<Sidepanel.Title>Order #4821</Sidepanel.Title>
<Sidepanel.Description>Awaiting shipment</Sidepanel.Description>
</Sidepanel.Header>
<Sidepanel.Content>
<p className="typography-body-md text-ws-static-base">Placed on 12 October. Two items, paid by card, shipping to Warsaw.</p>
</Sidepanel.Content>
<Sidepanel.Footer>
<Button>Mark as shipped</Button>
<Sidepanel.Close asChild>
<Button variant="secondary" preset="border">Cancel</Button>
</Sidepanel.Close>
</Sidepanel.Footer>
</Sidepanel.Panel>
</Sidepanel>Installation
pnpm dlx wideset add sidepanel
Copies the component and any Wideset components it uses into your project.
Examples
Side
side on Sidepanel.Panel anchors it to the right edge (the default) or the left one. Open details and edit forms from the right, next to the content they describe; keep the left for navigation or filters that read before the content. The panel is full height either way, moves focus inside while open, and returns it to the trigger on close.
import { Button } from '@/components/ui/wideset/button/Button';
import { Sidepanel } from '@/components/ui/wideset/sidepanel/Sidepanel';
export default function SidepanelSide() {
return (
<div className="gap-ws-6 flex flex-wrap">
<Sidepanel>
<Sidepanel.Trigger asChild>
<Button variant="secondary" preset="border">
Order details
</Button>
</Sidepanel.Trigger>
<Sidepanel.Panel side="right">
<Sidepanel.Header>
<Sidepanel.Title>Order #4821</Sidepanel.Title>
<Sidepanel.Description>Awaiting shipment</Sidepanel.Description>
</Sidepanel.Header>
<Sidepanel.Content>
<p className="typography-body-md text-ws-static-base">
Placed on 12 October. Two items, paid by card, shipping to Warsaw.
</p>
</Sidepanel.Content>
<Sidepanel.Footer>
<Sidepanel.Close asChild>
<Button variant="secondary" preset="border">
Close
</Button>
</Sidepanel.Close>
</Sidepanel.Footer>
</Sidepanel.Panel>
</Sidepanel>
<Sidepanel>
<Sidepanel.Trigger asChild>
<Button variant="secondary" preset="border">
Filters
</Button>
</Sidepanel.Trigger>
<Sidepanel.Panel side="left">
<Sidepanel.Header>
<Sidepanel.Title>Filters</Sidepanel.Title>
<Sidepanel.Description>Narrow the order list</Sidepanel.Description>
</Sidepanel.Header>
<Sidepanel.Content>
<p className="typography-body-md text-ws-static-base">
Status, date placed and shipping country.
</p>
</Sidepanel.Content>
<Sidepanel.Footer>
<Sidepanel.Close asChild>
<Button>Show results</Button>
</Sidepanel.Close>
</Sidepanel.Footer>
</Sidepanel.Panel>
</Sidepanel>
</div>
);
}Sizes
size on Sidepanel.Panel caps its width: sm (560px) for details and short forms, md (704px) for longer forms, lg (960px) for tables or side-by-side content. On a narrow screen the panel takes the full width at every size. Pick the smallest size that fits the content.
import { Button } from '@/components/ui/wideset/button/Button';
import { Sidepanel } from '@/components/ui/wideset/sidepanel/Sidepanel';
const sizes = [
{ size: 'sm', label: 'Small', title: 'Order #4821' },
{ size: 'md', label: 'Medium', title: 'Edit shipping address' },
{ size: 'lg', label: 'Large', title: 'Order history' },
] as const;
export default function SidepanelSizes() {
return (
<div className="gap-ws-6 flex flex-wrap">
{sizes.map(({ size, label, title }) => (
<Sidepanel key={size}>
<Sidepanel.Trigger asChild>
<Button variant="secondary" preset="border">
{label}
</Button>
</Sidepanel.Trigger>
<Sidepanel.Panel size={size}>
<Sidepanel.Header>
<Sidepanel.Title>{title}</Sidepanel.Title>
</Sidepanel.Header>
<Sidepanel.Content>
<p className="typography-body-md text-ws-static-base">
Placed on 12 October. Two items, paid by card, shipping to Warsaw.
</p>
</Sidepanel.Content>
<Sidepanel.Footer>
<Sidepanel.Close asChild>
<Button variant="secondary" preset="border">
Close
</Button>
</Sidepanel.Close>
</Sidepanel.Footer>
</Sidepanel.Panel>
</Sidepanel>
))}
</div>
);
}API reference
Sidepanel
Sidepanel.Actions
<div> is passed through to it. See MDN: <div>.Sidepanel.Close
Radix Dialog.Close is passed through to it. See Radix Dialog.Close.Sidepanel.Content
| Name | Description | Default |
|---|---|---|
wrapperClassName | Additional className applied to the ScrollArea wrapper (outer element). string | — |
<div> is passed through to it. See MDN: <div>.Sidepanel.Description
Radix Dialog.Description is passed through to it. See Radix Dialog.Description.Sidepanel.Footer
| Name | Description | Default |
|---|---|---|
divider | Draws the divider separating the footer from the content. Defaults to `true`. boolean | true |
<div> is passed through to it. See MDN: <div>.Sidepanel.Header
| Name | Description | Default |
|---|---|---|
divider | Draws the divider separating the header from the content. Defaults to `true`. boolean | true |
<div> is passed through to it. See MDN: <div>.Sidepanel.Panel
| Name | Description | Default |
|---|---|---|
defaultMotion | Turns the component's built-in animations on or off. When omitted, inherits the value from the nearest `MotionProvider`. boolean | true |
side | 'left''right' | 'right' |
size | 'sm''md''lg' | 'md' |
Radix Dialog.Content is passed through to it. See Radix Dialog.Content.Sidepanel.Title
Radix Dialog.Title is passed through to it. See Radix Dialog.Title.Sidepanel.Trigger
Radix Dialog.Trigger is passed through to it. See Radix Dialog.Trigger.Accessibility
- Always render
Sidepanel.Title; it names the dialog. WithoutSidepanel.Description, passaria-describedby={undefined}toSidepanel.Panel. - There is no built-in close button: put
Sidepanel.Close asChildaround anIconButtonwith anaria-labelinSidepanel.Actions, or a Close button in the footer. - Focus moves inside on open and returns to the trigger on close; Escape and an outside click close it.
| Part | Renders | Description |
|---|---|---|
| SidepanelRenders no element | — | Sidepanel is an overlay panel that slides in from the left or right edge of the viewport. |
| Sidepanel.ActionsRenders no element | <div> | The top-right action slot. |
| Sidepanel.CloseRenders no element | Radix Dialog.Close | The Radix Dialog close control. |
| Sidepanel.ContentRenders no element | <div> | Props for the Sidepanel scrollable content area. |
| Sidepanel.DescriptionRenders no element | Radix Dialog.Description | Props for `Sidepanel.Description`. |
| Sidepanel.FooterRenders no element | <div> | Props for the Sidepanel footer. |
| Sidepanel.HeaderRenders no element | <div> | Props for the Sidepanel header. |
| Sidepanel.PanelRenders no element | Radix Dialog.Content | Props for the Sidepanel panel surface. Controls which edge it slides in from and its size. |
| Sidepanel.TitleRenders no element | Radix Dialog.Title | Props for `Sidepanel.Title`. |
| Sidepanel.TriggerRenders no element | Radix Dialog.Trigger | The Radix Dialog trigger. |
import { RiCloseLine } from '@remixicon/react';
import { Button } from '@/components/ui/wideset/button/Button';
import { IconButton } from '@/components/ui/wideset/button/IconButton';
import { Sidepanel } from '@/components/ui/wideset/sidepanel/Sidepanel';
<Sidepanel>
<Sidepanel.Trigger asChild>
<Button variant="secondary" preset="border">View order details</Button>
</Sidepanel.Trigger>
<Sidepanel.Panel>
<Sidepanel.Actions>
<Sidepanel.Close asChild>
<IconButton
aria-label="Close"
icon={RiCloseLine}
preset="border"
variant="secondary"
size="sm"
className="size-ws-forms-sm p-0"
/>
</Sidepanel.Close>
</Sidepanel.Actions>
<Sidepanel.Header>
<Sidepanel.Title>Order #4821</Sidepanel.Title>
<Sidepanel.Description>Awaiting shipment</Sidepanel.Description>
</Sidepanel.Header>
<Sidepanel.Content>
<p className="typography-body-md text-ws-static-base">Placed on 12 October. Two items, paid by card, shipping to Warsaw.</p>
</Sidepanel.Content>
<Sidepanel.Footer>
<Button>Mark as shipped</Button>
<Sidepanel.Close asChild>
<Button variant="secondary" preset="border">Cancel</Button>
</Sidepanel.Close>
</Sidepanel.Footer>
</Sidepanel.Panel>
</Sidepanel>