Status Modal
StatusModal is a dialog variant that communicates status through icon style, color accents, and layout orientation.
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.
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.
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
| Name | Description | Default |
|---|---|---|
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' |
Radix Dialog.Root is passed through to it. See Radix Dialog.Root.StatusModal.Body
| Name | Description | Default |
|---|---|---|
orientation | Layout orientation for title and content alignment. StatusModalOrientation | — |
StatusModal.Close
Radix Dialog.Close is passed through to it. See Radix Dialog.Close.StatusModal.Content
| Name | Description | Default |
|---|---|---|
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 | — |
Radix Dialog.Content is passed through to it. See Radix Dialog.Content.StatusModal.Footer
| Name | Description | Default |
|---|---|---|
orientation | Layout orientation for title and content alignment. StatusModalOrientation | — |
<div> is passed through to it. See MDN: <div>.StatusModal.Overlay
| 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 |
Radix Dialog.Overlay is passed through to it. See Radix Dialog.Overlay.StatusModal.Title
| Name | Description | Default |
|---|---|---|
orientation | Layout orientation for title and content alignment. StatusModalOrientation | — |
status | Status that controls the icon style and color. StatusModalStatus | — |
Radix Dialog.Title is passed through to it. See Radix Dialog.Title.StatusModal.Trigger
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.Titleis the dialog’s name andStatusModal.Bodyits description; render both.- With
persistent, keep a visible way out.
| Part | Renders | Description |
|---|---|---|
| StatusModalRenders no element | Radix Dialog.Root | A dialog communicating a status through its icon and layout. |
| StatusModal.BodyRenders no element | — | The main content area. |
| StatusModal.CloseRenders no element | Radix Dialog.Close | The Radix Dialog close control. |
| StatusModal.ContentRenders no element | Radix Dialog.Content | The content surface rendered within `StatusModal`. |
| StatusModal.FooterRenders no element | <div> | The action area beneath the main content. |
| StatusModal.OverlayRenders no element | Radix Dialog.Overlay | The scrim behind the content. |
| StatusModal.TitleRenders no element | Radix Dialog.Title | The primary title text. |
| StatusModal.TriggerRenders no element | Radix Dialog.Trigger | The Radix Dialog trigger. |
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>