Skip to content

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

Bekræft ordren

Antal kan stadig ændres bagefter.

Fokus bliver i dialogen, og Escape lukker den. Det kommer fra browseren, ikke fra et bibliotek.

Bekræft ordren

Antal kan stadig ændres bagefter.

Fokus bliver i dialogen, og Escape lukker den. Det kommer fra browseren, ikke fra et bibliotek.

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

PropTypeDefaultWhat it does
open (required)booleanWhether the dialog is shown. The page owns this state.
onClose (required)() => voidCalled when the dialog closes: the close button, the Escape key or a click outside.
title (required)stringThe name of the dialog, read aloud when it opens.
hideTitlebooleanfalseHides the title from the eye, when the content is its own heading.
descriptionstringA line under the title.
footerReactNodeThe foot of the dialog, usually Actions with the buttons.
closeLabelstring'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