Skip to content

Search

Start typing to search.


Show all pages

Documentation

overlays

Dialog

A modal window that asks for a decision or a short task before people continue.

Native behaviorUses built-in HTML behavior, so you write no script.

Usage

A native <dialog> opened with commandfor and command="show-modal". No JavaScript of your own is needed.

Delete “Spring campaign”?

The project and its 12 tasks are removed for everyone. You cannot undo this.

HTML

Examples

With a form

A form with method="dialog" closes the dialog on submit and keeps the button value as the result.

Rename lesson

HTML

Guidance and accessibility

When to use

  • Use a dialog when people must decide before they continue, such as confirming a deletion.
  • Do not use a dialog for information that can live on the page. Every dialog interrupts.
  • Name the action on the buttons: “Delete project” and “Keep project”, not “OK” and “Cancel”.

Accessibility

  • The browser keeps focus inside the open dialog, closes it on Escape and makes the page behind it inert. Calaca adds the styles and locks page scrolling.
  • Connect the title with aria-labelledby and the explanation with aria-describedby.
  • Put autofocus on the safest action, so a quick Enter does not delete anything.
  • Older browsers without invoker commands need ca-commands.js; it does nothing where the browser supports them natively.

Classes

Generated from the component contract. Parts use __, modifiers use --.

Classes of the dialog component
ClassKindUse it for
ca-dialogComponentCentered modal surface; open state and backdrop.
ca-dialog__titlePartHeading of the dialog; connect it with aria-labelledby.
ca-dialog__descriptionPartExplains the consequence; connect it with aria-describedby.
ca-dialog__footerPartRow of actions at the end of the dialog.

Skins

The same markup, dressed by each skin. Structure and behavior stay the same; only the look changes.

Base skin

Neutral grayscale starting point; product skins extend it and change what differs.

Delete “Spring campaign”?

The project and its 12 tasks are removed for everyone. You cannot undo this.

Calaca skin

The Calaca UI brand: hueso paper and tinta ink, cempasúchil marigold, rosa and jade.

Delete “Spring campaign”?

The project and its 12 tasks are removed for everyone. You cannot undo this.

Proof skin

Pilot skin pushed far from base: square, heavy, offset shadows, larger targets.

Delete “Spring campaign”?

The project and its 12 tasks are removed for everyone. You cannot undo this.

Crossview skin

The CrossView proofing table: cool ground, bond-paper sheets, rule-grey hairlines, one red mark.

Delete “Spring campaign”?

The project and its 12 tasks are removed for everyone. You cannot undo this.

Framework notes

Link the prebuilt stylesheet of your skin next to your brand theme. No build step.

HTML
<link rel="stylesheet" href="theme.css" />
<link rel="stylesheet" href="ca-base.css" />