Skip to content

Overlays

Surfaces that float above the page or expand inline: modal dialogs over native <dialog>, disclosure wrappers over <details>, and the toast notifications API for transient feedback.

Disclosure

cui-disclosure wraps a native <details> element and adds consistent styling, animation, an attribute-reflected open state, and a cui-disclosure-toggle event. Markup stays in light DOM, so headings remain crawlable and the component still works without JavaScript.

Use the native name attribute on the inner <details> to create an accordion — opening one sibling collapses the others.

How does Combat UI ship CSS?

Components inject their shadow styles through constructable stylesheets and expose light-DOM hooks via the cui-* class system. Import cui/index.css once at the app root, then drop components anywhere.

Does it work without JavaScript?

Yes. The component progressively enhances the native <details>. Without JS the summary still toggles open and closed; with JS you also get the open attribute on the host, custom events, and an imperative API.

How do I make an accordion?

Give each inner <details> the same name attribute. The browser will close siblings automatically when one opens.

Can I style the chevron?

Override --cui-disclosure-marker-color or replace the ::after rule in your own stylesheet.

Inline ghost disclosure

Use data-variant="ghost" for a borderless treatment that nests inside other surfaces — table of contents, API references, etc.

Pairs with prose

The summary inherits text styles so it sits naturally beside paragraphs.

Toggle below Open Close
Remote-controlled disclosure

Any element with data-cui-disclosure-target="<id>" toggles the matching disclosure. Add data-cui-disclosure-action="open" or "close" to force a specific state.

API reference
Attribute / property Purpose
open Reflects the open state. Setting or removing toggles via the API.
disclosure.open() Opens the inner <details>.
disclosure.close() Closes the inner <details>.
disclosure.toggle() Toggles the open state.
disclosure.isOpen Boolean — current state.
disclosure.details Reference to the inner <details> element.
Markup attribute / class Purpose
.cui-disclosure · .cui-surface Both on the <details> for a default card — compose .cui-surface for the chrome. data-variant="ghost" needs no surface.
.cui-disclosure-body Optional wrapper around the disclosure content for consistent padding.
.cui-stack Container that lays out adjacent disclosures with consistent spacing (replaces the former .cui-disclosure-group).
data-variant="ghost" On the <details>. Borderless treatment for in-flow disclosures.
data-variant="stacked" On the .cui-stack. Joins adjacent disclosures with shared borders.
data-tone="subtle" Muted surface treatment.
name="<group>" Native attribute on <details>. Siblings sharing a name behave as an accordion.
data-cui-disclosure-target="<id>" On any clickable element. Toggles the matching disclosure.
data-cui-disclosure-action="open | close" On a trigger. Forces the state instead of toggling.
Event Detail / behavior
cui-disclosure-toggle { open }. Fires after the inner <details> toggles.
Variable Default
--cui-disclosure-bg --cui-color-surface-raised
--cui-disclosure-color --cui-color
--cui-disclosure-border --cui-color-border
--cui-disclosure-radius --cui-radius-2
--cui-disclosure-padding-block --cui-space-3
--cui-disclosure-padding-inline --cui-space-4
--cui-disclosure-marker-color --cui-color-muted
--cui-disclosure-hover-bg --cui-color-surface-muted

Notifications

Two flavors share the same .cui-alert CSS: static inline alerts sit in the page flow and need no JavaScript; floating toasts are created programmatically via the toast() function and slotted into a cui-toast-region that auto-creates itself on the first call. A data-cui-dismiss attribute on any button inside a .cui-alert removes its alert.

Heads up

Maintenance starts at 22:00 UTC.

Saved.

Your changes are live.

No JavaScript required for styling. The dismiss button works as soon as the toast module is loaded — one global click listener handles [data-cui-dismiss] for any .cui-alert on the page.

A cui-toast-region auto-mounts on first call. Place <cui-toast-region placement="end-end"></cui-toast-region> in your body to control the container yourself.

Default outline tone. Surface background with an accent stripe.

data-tone="filled". Subtle accent-tinted background.

data-tone="solid". Full accent background, high-contrast text.

API reference
.danger
API Purpose
toast(options) Show a toast. Returns { element, dismiss(), update(opts) }.
toast.info(msg, opts?) · .success · .warning · .danger Sugar — sets variant for you.
handle.dismiss() Cancel the auto-dismiss timer and remove the toast (with the exit animation).
handle.update(opts) Patch any option (message, title, variant, tone, duration). Resets the timer.
warning and danger render with role="alert".
Option Default · Purpose
message Required. Body text.
title Optional bold heading.
variant "info". One of info | success | warning | danger. warning and danger render with role="alert".
tone None. filled or solid for heavier emphasis.
duration 4000 ms. Set 0 for sticky.
placement "end-end" (bottom right). Six positions: start | end on the block axis × start | center | end on the inline axis.
Markup attribute / class Purpose
.cui-alert · .cui-surface Container. Both classes on the element — compose .cui-surface for chrome; the alert keeps its grid layout: icon · body · dismiss.
.cui-alert-icon · .cui-alert-title · .cui-alert-message · .cui-alert-dismiss Bespoke / JS-hook slots that keep a class. The body is a .cui-stack and an actions row a .cui-cluster.
data-variant="info | success | warning | danger" Sets the accent color and icon.
data-tone="filled | solid" Visual weight. Omitted = outline tone.
data-cui-dismiss On any element inside a .cui-alert. Clicks remove the alert with the exit animation.
cui-alert-dismiss event Bubbles from a .cui-alert after it's removed.
Variable Default
--cui-alert-bg --cui-color-surface-raised
--cui-alert-color --cui-color
--cui-alert-border --cui-color-border
--cui-alert-accent Per-variant --cui-color-info | success | warning | danger
--cui-alert-radius --cui-radius-2
--cui-toast-z-index 1000
--cui-toast-padding --cui-space-4
--cui-toast-gap --cui-space-2