Sidepanel

Sidepanel is an overlay panel that slides in from the left or right edge of the viewport.

tsx
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.

tsx
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.

tsx
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

No props of its ownIt takes its content as children and nothing else.

Sidepanel.Actions

No props of its ownIt takes its content as children.
Every other prop of <div> is passed through to it. See MDN: <div>.

Sidepanel.Close

No props of its ownIt takes its content as children.
Every other prop of Radix Dialog.Close is passed through to it. See Radix Dialog.Close.

Sidepanel.Content

NameDescriptionDefault
wrapperClassName

Additional className applied to the ScrollArea wrapper (outer element).

string
—
Every other prop of <div> is passed through to it. See MDN: <div>.

Sidepanel.Description

No props of its ownIt takes its content as children.
Every other prop of Radix Dialog.Description is passed through to it. See Radix Dialog.Description.

Sidepanel.Footer

NameDescriptionDefault
divider

Draws the divider separating the footer from the content. Defaults to `true`.

boolean
true
Every other prop of <div> is passed through to it. See MDN: <div>.

Sidepanel.Header

NameDescriptionDefault
divider

Draws the divider separating the header from the content. Defaults to `true`.

boolean
true
Every other prop of <div> is passed through to it. See MDN: <div>.

Sidepanel.Panel

NameDescriptionDefault
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'
Every other prop of Radix Dialog.Content is passed through to it. See Radix Dialog.Content.

Sidepanel.Title

No props of its ownIt takes its content as children.
Every other prop of Radix Dialog.Title is passed through to it. See Radix Dialog.Title.

Sidepanel.Trigger

No props of its ownIt takes its content as children.
Every other prop of Radix Dialog.Trigger is passed through to it. See Radix Dialog.Trigger.

Accessibility

  • Always render Sidepanel.Title; it names the dialog. Without Sidepanel.Description, pass aria-describedby={undefined} to Sidepanel.Panel.
  • There is no built-in close button: put Sidepanel.Close asChild around an IconButton with an aria-label in Sidepanel.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.
PartRendersDescription
Sidepanel—Sidepanel is an overlay panel that slides in from the left or right edge of the viewport.
Sidepanel.Actions<div>The top-right action slot.
Sidepanel.CloseRadix Dialog.CloseThe Radix Dialog close control.
Sidepanel.Content<div>Props for the Sidepanel scrollable content area.
Sidepanel.DescriptionRadix Dialog.DescriptionProps for `Sidepanel.Description`.
Sidepanel.Footer<div>Props for the Sidepanel footer.
Sidepanel.Header<div>Props for the Sidepanel header.
Sidepanel.PanelRadix Dialog.ContentProps for the Sidepanel panel surface. Controls which edge it slides in from and its size.
Sidepanel.TitleRadix Dialog.TitleProps for `Sidepanel.Title`.
Sidepanel.TriggerRadix Dialog.TriggerThe Radix Dialog trigger.
tsx
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>

Appearance

Size
Side

Content

Footer
Header divider
Footer divider