Dialog

Component

Dialog

A real dialog element, with a jelly panel inside.

Classes

ClassType
modalComponentThe dialog element.
modal-panelPartThe panel.
modal-smSizeLess padding. The width stays the same.
modal-lgSizeMore padding. The width stays the same.
btn-surfacePartThe close control. Two washes sit on it and swap when pressed.
btn-surface-smSizeA smaller close control.
btn-surface-lgSizeA larger close control.
primaryColorPut the color on the panel. It tints the panel and the close control. With no color, both use the neutral surface.
secondaryColorPink by default.
tertiaryColorTeal by default.
neutralColorGray by default.
successColorGreen by default.
errorColorRed by default.
warningColorAmber by default.
infoColorSky by default.

Open and close

Open it with showModal() on the dialog element. The form method="dialog" closes it. With no color, the close control uses the neutral surface.

<button class="btn" type="button">Open</button>
<dialog class="modal">
  <div class="modal-panel">
    <form method="dialog">
      <button class="btn-surface" type="submit" aria-label="Close">×</button>
    </form>
    <h2>A note</h2>
    <p>Surface panel.</p>
  </div>
</dialog>

Colors

The color goes on modal-panel. It tints the panel and the close control.

<div class="modal-panel primary">
  <h2>Primary</h2>
</div>
<div class="modal-panel secondary">
  <h2>Secondary</h2>
</div>
<div class="modal-panel tertiary">
  <h2>Tertiary</h2>
</div>
<div class="modal-panel neutral">
  <h2>Neutral</h2>
</div>
<div class="modal-panel success">
  <h2>Success</h2>
</div>
<div class="modal-panel error">
  <h2>Error</h2>
</div>
<div class="modal-panel warning">
  <h2>Warning</h2>
</div>
<div class="modal-panel info">
  <h2>Info</h2>
</div>