Modal
A dialog that blocks the page until the person decides.
Add the source to a shadcn project
npx shadcn@latest add https://docs.atomus.io/r/modal.jsonOpen in v0Installs the component source, its CSS and the Atomus tokens into components/atomus/. How the registry works
In Figma
Section titled “In Figma”From guidelines/components/modal.md · Open in Figma: Modal
Properties, variants and anatomy of the Figma components. React props use the same names.
Dialog with header, Content slot and actions. Sizes 400 / 544 / 720px.
Variants: 6
| Property | Type / options |
|---|---|
| Content | slot (any content) |
| Title | text |
| Description | text |
| Featured icon | boolean (on) |
| Close button | boolean (on) |
| Actions | boolean (on) |
| Size | sm · md · lg |
| Type | Default · Destructive |
import { Modal } from '@stanvision/atomus-react';
<Modal open={open} onClose={() => setOpen(false)} type="destructive" featuredIcon title="Delete project?" description="You can’t undo this." actions={<><Button hierarchy="outline">Cancel</Button><Button hierarchy="primary">Delete</Button></>}/>A dialog that blocks the page until the person decides. Built on the native <dialog>: focus moves in, Esc and the backdrop close it, the page behind is inert.
Props at a glance
Section titled “Props at a glance”Full types and defaults are in React API at the end of the page.
open+onClose;titleanddescription;childrenfor the Content slot.actions— buttons, the primary last;featuredIcon(trueor an icon);closeButton(default on).sizesm400 ·md544 ·lg720;typedestructivetints the icon red.
Design guidance
Section titled “Design guidance”From the Figma guidelines.
Do
- Use for focused tasks that need a decision.
- Put content into the Content slot.
- Put the primary action on the right, after Cancel.
- Use Type = Destructive for irreversible actions.
Forbidden
- Never open a modal on top of a modal.
- Never use a modal for long forms — use a page or Drawer.
- Never hide the close button.
- Never open a modal the user did not ask for.
React API
Section titled “React API”Generated from react/src/components by scripts/gen-react-api.mjs — the same tables agents read in guidelines/components/modal.md.
Use only these props; anything else is not part of the API.
Figma: Modal. Uses the native dialog element: focus trap, Esc to close and inert background come built in.
import { Modal } from '@stanvision/atomus-react'; — source: react/src/components/Modal.tsx
| Prop | Type | Default | Description |
|---|---|---|---|
open |
boolean |
required | Whether it is shown (controlled). |
onClose |
() => void |
required | Called when the user closes it. |
title |
ReactNode |
required | Figma: Title |
description |
ReactNode |
— | Figma: Description |
children |
ReactNode |
— | Figma: Content slot |
actions |
ReactNode |
— | Figma: Actions — buttons, primary last |
featuredIcon |
boolean | ReactNode |
— | Figma: Featured icon — true for the default glyph, or pass an icon |
closeButton |
boolean |
true |
Figma: Close button |
size |
'sm' | 'md' | 'lg' |
'md' |
Figma: Size — sm 400 · md 544 · lg 720 |
type |
'default' | 'destructive' |
'default' |
Figma: Type — destructive tints the featured icon red |
className |
string |
— | Extra class on the root element (layout only — never restyle colours or sizes). |
Accepts only the props above.