Status Modal

StatusModal is a dialog variant that communicates status through icon style, color accents, and layout orientation.

tsx
import { Button } from '@/components/ui/wideset/button/Button';
import { StatusModal } from '@/components/ui/wideset/status-modal/StatusModal';

<StatusModal>
  <StatusModal.Trigger asChild>
    <Button>Delete workspace</Button>
  </StatusModal.Trigger>
  <StatusModal.Content>
    <StatusModal.Title>Delete workspace</StatusModal.Title>
    <StatusModal.Body>This workspace and all its contents will be permanently deleted.</StatusModal.Body>
    <StatusModal.Footer>
      <StatusModal.Close asChild>
        <Button size="sm" variant="secondary" preset="border">
          Cancel
        </Button>
      </StatusModal.Close>
      <StatusModal.Close asChild>
        <Button size="sm" preset="border">
          Delete
        </Button>
      </StatusModal.Close>
    </StatusModal.Footer>
  </StatusModal.Content>
</StatusModal>

Installation

pnpm dlx wideset add status-modal

Copies the component and any Wideset components it uses into your project.

Examples

Statuses

The status sets the icon and the tint behind the title. neutral has no icon: use it for an ordinary confirmation. positive confirms that something finished, notice warns before it is too late, information announces something new, and error says what failed and how to retry. The icon is hidden from screen readers, so the title has to carry the meaning on its own.

tsx
import { Button } from '@/components/ui/wideset/button/Button';
import { StatusModal } from '@/components/ui/wideset/status-modal/StatusModal';
import { type StatusModalStatus } from '@wideset/react';

const statuses: { status: StatusModalStatus; title: string; body: string; confirm: string }[] = [
  {
    status: 'neutral',
    title: 'Delete workspace',
    body: 'This workspace and all its contents will be permanently deleted.',
    confirm: 'Delete',
  },
  {
    status: 'positive',
    title: 'Payment successful',
    body: 'Your subscription is active. You now have access to every premium feature.',
    confirm: 'Get started',
  },
  {
    status: 'notice',
    title: 'Session expiring',
    body: 'Your session expires in 5 minutes. Save your work to avoid losing changes.',
    confirm: 'Stay signed in',
  },
  {
    status: 'information',
    title: 'New components available',
    body: 'Version 2.4 adds DataGrid, Timeline and updated form controls.',
    confirm: 'View changelog',
  },
  {
    status: 'error',
    title: 'Failed to save',
    body: 'Your changes could not be saved. Check your connection and try again.',
    confirm: 'Retry',
  },
];

export default function StatusModalStatuses() {
  return (
    <div className="gap-ws-6 flex flex-wrap">
      {statuses.map(({ status, title, body, confirm }) => (
        <StatusModal key={status} status={status}>
          <StatusModal.Trigger asChild>
            <Button variant="secondary" preset="border">
              {title}
            </Button>
          </StatusModal.Trigger>
          <StatusModal.Content>
            <StatusModal.Title>{title}</StatusModal.Title>
            <StatusModal.Body>{body}</StatusModal.Body>
            <StatusModal.Footer>
              <StatusModal.Close asChild>
                <Button size="sm" variant="secondary" preset="border">
                  Cancel
                </Button>
              </StatusModal.Close>
              <StatusModal.Close asChild>
                <Button size="sm" preset="border">
                  {confirm}
                </Button>
              </StatusModal.Close>
            </StatusModal.Footer>
          </StatusModal.Content>
        </StatusModal>
      ))}
    </div>
  );
}

Orientation

horizontal puts the icon above a left-aligned title and right-aligns the actions under a divider: the compact layout for most dialogs. vertical centres the icon, text and actions, for a moment that deserves more weight, such as a finished payment or a failed import. Set it once on StatusModal; every part follows.

tsx
import { Button } from '@/components/ui/wideset/button/Button';
import { StatusModal } from '@/components/ui/wideset/status-modal/StatusModal';

export default function StatusModalOrientation() {
  return (
    <div className="gap-ws-6 flex flex-wrap">
      {(['horizontal', 'vertical'] as const).map((orientation) => (
        <StatusModal key={orientation} status="positive" orientation={orientation}>
          <StatusModal.Trigger asChild>
            <Button variant="secondary" preset="border">
              {orientation === 'horizontal' ? 'Horizontal' : 'Vertical'}
            </Button>
          </StatusModal.Trigger>
          <StatusModal.Content>
            <StatusModal.Title>Payment successful</StatusModal.Title>
            <StatusModal.Body>
              Your subscription is active. You now have access to every premium feature.
            </StatusModal.Body>
            <StatusModal.Footer>
              <StatusModal.Close asChild>
                <Button size="sm" variant="secondary" preset="border">
                  Close
                </Button>
              </StatusModal.Close>
              <StatusModal.Close asChild>
                <Button size="sm" preset="border">
                  Get started
                </Button>
              </StatusModal.Close>
            </StatusModal.Footer>
          </StatusModal.Content>
        </StatusModal>
      ))}
    </div>
  );
}

API reference

StatusModal

NameDescriptionDefault
orientation

Layout orientation for title and content alignment.

StatusModalOrientation
'horizontal'
showCloseButton

Shows the close button in the top right corner.

boolean
true
status

Status that controls the icon style and color.

StatusModalStatus
'neutral'
Every other prop of Radix Dialog.Root is passed through to it. See Radix Dialog.Root.

StatusModal.Body

NameDescriptionDefault
orientation

Layout orientation for title and content alignment.

StatusModalOrientation
—

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

StatusModal.Content

NameDescriptionDefault
autoFocusOnOpen

Moves focus into the dialog when it opens. Defaults to `true`.

boolean
true
closeAriaLabel

Accessible label for the close button. Defaults to `'Close status modal'`.

string
'Close status modal'
defaultMotion

Turns the component's built-in animations on or off. When omitted, inherits the value from the nearest `MotionProvider`.

boolean
true
orientation

Layout orientation for title and content alignment.

StatusModalOrientation
—
persistent

Prevents dismissal by outside interaction or Escape. Defaults to `false`.

boolean
false
showCloseButton

Shows the close button in the top right corner.

boolean
—
status

Status that controls the icon style and color.

StatusModalStatus
—
Every other prop of Radix Dialog.Content is passed through to it. See Radix Dialog.Content.

StatusModal.Footer

NameDescriptionDefault
orientation

Layout orientation for title and content alignment.

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

StatusModal.Overlay

NameDescriptionDefault
defaultMotion

Turns the component's built-in animations on or off. When omitted, inherits the value from the nearest `MotionProvider`.

boolean
true
Every other prop of Radix Dialog.Overlay is passed through to it. See Radix Dialog.Overlay.

StatusModal.Title

NameDescriptionDefault
orientation

Layout orientation for title and content alignment.

StatusModalOrientation
—
status

Status that controls the icon style and color.

StatusModalStatus
—
Every other prop of Radix Dialog.Title is passed through to it. See Radix Dialog.Title.

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

  • The status icon is hidden from screen readers; the title must carry the meaning on its own.
  • StatusModal.Title is the dialog’s name and StatusModal.Body its description; render both.
  • With persistent, keep a visible way out.
PartRendersDescription
StatusModalRadix Dialog.RootA dialog communicating a status through its icon and layout.
StatusModal.Body—The main content area.
StatusModal.CloseRadix Dialog.CloseThe Radix Dialog close control.
StatusModal.ContentRadix Dialog.ContentThe content surface rendered within `StatusModal`.
StatusModal.Footer<div>The action area beneath the main content.
StatusModal.OverlayRadix Dialog.OverlayThe scrim behind the content.
StatusModal.TitleRadix Dialog.TitleThe primary title text.
StatusModal.TriggerRadix Dialog.TriggerThe Radix Dialog trigger.
tsx
import { Button } from '@/components/ui/wideset/button/Button';
import { StatusModal } from '@/components/ui/wideset/status-modal/StatusModal';

<StatusModal>
  <StatusModal.Trigger asChild>
    <Button>Delete workspace</Button>
  </StatusModal.Trigger>
  <StatusModal.Content>
    <StatusModal.Title>Delete workspace</StatusModal.Title>
    <StatusModal.Body>This workspace and all its contents will be permanently deleted.</StatusModal.Body>
    <StatusModal.Footer>
      <StatusModal.Close asChild>
        <Button size="sm" variant="secondary" preset="border">
          Cancel
        </Button>
      </StatusModal.Close>
      <StatusModal.Close asChild>
        <Button size="sm" preset="border">
          Delete
        </Button>
      </StatusModal.Close>
    </StatusModal.Footer>
  </StatusModal.Content>
</StatusModal>

Appearance

Status
Orientation

Content

Close button