Internal ID software / Overlays
Dialog
A question that must be answered before the work goes on.
Not drawn in Figma: built only from the tokens, for internal ID software. In code: components/software/overlay.tsx. From the old system: Dialog in @id-identity-as/ui/overlay.
Example
import { Dialog } from '@/components/software/overlay';
<Dialog
open={open}
onClose={() => setOpen(false)}
title="Bekræft ordren"
description="Antal kan stadig ændres bagefter."
footer={
<Actions align="end">
<Button variant="outline" onClick={() => setOpen(false)}>Annullér</Button>
<Button onClick={confirm}>Bekræft</Button>
</Actions>
}
>
...
</Dialog>Props
| Prop | Type | Default | What it does |
|---|---|---|---|
open (required) | boolean | Whether the dialog is shown. The page owns this state. | |
onClose (required) | () => void | Called when the dialog closes: the close button, the Escape key or a click outside. | |
title (required) | string | The name of the dialog, read aloud when it opens. | |
hideTitle | boolean | false | Hides the title from the eye, when the content is its own heading. |
description | string | A line under the title. | |
footer | ReactNode | The foot of the dialog, usually Actions with the buttons. | |
closeLabel | string | 'Luk' | The name of the close button. |
Do
- Use it for a decision that cannot wait: confirm, discard, choose.
- Write the title as the question and the buttons as the answers.
- Put the outline action first and the solid one last in the footer.
Do not
- Do not open a dialog from a dialog.
- Do not use it for a message that needs no answer. That is FlashMessage.
- Do not use it on the public site. A dialog there waits for Figma.
Accessibility
- The native dialog element, opened as a modal: focus is kept inside, Escape closes it, and the page behind is inert.
- Named by its title and described by its description.
- The close button is an icon with a name.
Tokens it uses
- color.surface.base
- color.border.default
- color.text.default
- color.software.muted
- color.neutral.900
- radius.sm
- type.heading.md
- type.body.md
- type.body.sm
- space.inline.1
- space.inline.4
- space.inline.5