Toast

Notification cards and a manager for stacked, queued notifications with independent lifetimes.

c2-toast

Attributes

NameTypeDefaultDescription
messagestringPlain-text message; the default slot can replace it.
headingstringOptional title above the message.
variant'neutral' | 'info' | 'success' | 'warning' | 'error'neutralSemantic icon variant.
no-iconbooleanfalseHides the leading icon and removes its space from the layout.
show-progressbooleanfalseDisplays a countdown bar. Managed toasts receive progress from their region.
progressnumber1Remaining fraction from 0 to 1. Standalone cards display this value without starting a timer.
dismissiblebooleanfalseShows a keyboard-accessible dismiss button.
action-labelstringLabel for the optional action button.
close-labelstringDismiss notificationAccessible name of the dismiss button.
managedbooleanfalseSet by a region to prevent duplicate announcements.

Events

NameTypeDescription
toast-closeCustomEventDismiss requested by the close button or Escape; detail contains reason.
toast-actionCustomEventThe action-label button was activated.

CSS custom properties

Grouped by the element and state they target. Click a group to collapse it; click a name to copy it.

NameTypeDefaultDescription
--c2-toast__container--backgroundcolor#ffffff
--c2-toast__container--colorcolor#18181b
--c2-toast__container--borderborder1px solid #e4e4e7
--c2-toast__container--border-radiusborder-radius10px
--c2-toast__container--paddingpadding14px 16px
--c2-toast__container--gappixel12px
--c2-toast__container--box-shadowbox-shadow0 4px 16px rgba(0, 0, 0, 0.1)
--c2-toast__container--font-familyfont-familyinherit
--c2-toast__container--font-sizefont-size14px
--c2-toast__container--line-heightline-height1.5
--c2-toast__heading--font-weightfont-weight600
--c2-toast__icon--align-selfalign-selfcenter
--c2-toast__icon--sizepixel20px
--c2-toast__icon--colorcolor#71717a
--c2-toast__icon__info--colorcolor#2563eb
--c2-toast__icon__success--colorcolor#15803d
--c2-toast__icon__warning--colorcolor#a16207
--c2-toast__icon__error--colorcolor#dc2626
--c2-toast__progress--heightpixel3px
--c2-toast__progress--colorcolor#2563eb
--c2-toast__progress--backgroundcolorrgba(37, 99, 235, 0.15)
--c2-toast__action--colorcolor#2563eb
--c2-toast__close--colorcolor#71717a
--c2-toast__close__hover--backgroundcolor#f4f4f5
--c2-toast__button__focus--outlineoutline2px solid #476ef9

c2-toast-region

Attributes

NameTypeDefaultDescription
position'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right'bottom-rightViewport corner or center edge at which notifications appear.
max-visiblenumber3Maximum visible notifications; the rest wait without running their timers.
labelstringNotificationsAccessible region name.
inlinebooleanfalseInline layout for embedded notification stacks.
enter-animationToastAnimationslide-upEntrance effect. Directions describe movement: slide-down enters from above.
exit-animationToastAnimationfadeExit effect. Directions describe movement: slide-right exits toward the right.
animation-durationnumber200Entrance and exit duration in milliseconds. Zero disables animation.
show-progressbooleantrueShows a remaining-time bar on timed notifications by default; set false to hide it.

Events

NameTypeDescription
toast-actionCustomEventAction activated; detail contains id and toast. The toast is then dismissed.
toast-dismissCustomEventA toast was removed; detail contains id, toast and reason.

CSS custom properties

Grouped by the element and state they target. Click a group to collapse it; click a name to copy it.

NameTypeDefaultDescription
--c2-toast-region__container--widthpixel360px
--c2-toast-region__container--gappixel12px
--c2-toast-region__container--offsetpixel20px
--c2-toast-region__container--z-indexnumber1000
escAccordionConnected, animated panels with shared borders and single or multiple expansion.LayoutAvatarImage, initials or icon for a person, with status dot and badge.Data displayBadgeTinted pill for status text, counts and dots, optionally pinned to a corner of another element.Data displayBreadcrumbNavigation trail of link buttons with separators, a current page and optional collapsing.NavigationButtonThemeable button with slots for text, prefix, suffix and running icons.ButtonsButton GroupAttached buttons with shared borders, optionally a segmented control with single or multiple selection.ButtonsCardGroups related content and actions on a single bordered surface.LayoutChat InputAuto-growing message box with a send button for chat interfaces.ChatChat MessageOne chat bubble with avatar, title, timestamp and message body.ChatCheckboxNative checkbox behaviour in a quiet, themeable box with an opt-in hover layer.InputsCode ViewerSyntax-highlighted code with line numbers, copy button and dark mode, powered by shiki.Data displayColor AreaTwo-dimensional area for picking saturation and value of a colour.InputsColor SelectColour swatch that opens a full picker built from area and slider.InputsColor SliderHorizontal slider for choosing a hue from 0 to 360.InputsCopy ButtonButton that copies text to the clipboard — the element it sits in, another element by id, or a literal string.ButtonsDetailsCollapsible disclosure built on native details and summary.LayoutIcon ButtonRound, hoverable button wrapping a slotted SVG icon.ButtonsKbdKeyboard key label for shortcuts and command hints, with the semantics of the native kbd element.Data displayLabelCaption that names and activates the control referenced by its for attribute, with a required marker.InputsLink ButtonText-styled control for link and navigation actions, rendered as a real anchor or a button.NavigationListVertical list container with single or multiple selection.Data displayList ItemSelectable row with icon slots, used on its own or as the option of list and select.Data displayMenuCommands, links, checkboxes and submenus in a popover anchored to a trigger.NavigationModalDialog built on the native dialog element: focus trap, backdrop, Escape, title, body and footer.FeedbackNavigation MenuSite navigation bar whose triggers open panels of links below the header.NavigationOverlayAnchored popup built on the browser Popover API, positioned with floating-ui.FeedbackPaginationPage navigation in three layouts: numbered pages, a simple page status, or a table-footer row with rows-per-page.NavigationProgressLinear progress bar, indeterminate or filling to a value, with an optional label and count.FeedbackRadioRadio options built on native inputs, grouped into one value with keyboard navigation.InputsSelectDropdown that pairs a themeable trigger with an anchored list of c2-list-item options.InputsSeperatorHorizontal or vertical rule with an optional label, for dividing content and toolbars.LayoutSheetDialog pinned to an edge of the screen, for content that complements the page rather than interrupting it.FeedbackSide NavResponsive navigation drawer beside the page: pushes the content on large screens, slides over it with a backdrop on small ones.NavigationSkeletonPlaceholder block standing in for content that has not arrived, in three shapes and three animations.FeedbackSliderRange input with a themeable track, thumb, step ticks and value bubble.InputsSpinnerCircular progress indicator, indeterminate or showing a value, with optional text.FeedbackSwitchOn/off toggle on a native switch input, with label, description and thumb icons.InputsTableVirtualized data grid with declarative columns, sorting, selection, pinning and resizing.Data displayTabsTab strip that shows one content panel at a time.NavigationText FieldSingle-line input with icon slots, clear button, helper and error text, and a character counter.InputsTextareaMultiline text input with resizing, helper and error text, and a character counter.InputsToastNotification cards and a manager for stacked, queued notifications with independent lifetimes.FeedbackTooltipContextual hint shown when its target is hovered or focused, rendered in the top layer.FeedbackFeather Icons287 open-source Feather icons, one web component each.IconsMat Icon2,234 Material Icons ligatures rendered through a single element.IconsPhosphor Icons1,512 flexible icons in six weights, one web component each.IconsThemingTheme every c2n component from a handful of design tokens with @c2n/theme, or reach for any component variable directly.GuideUsing c2n in an applicationThe workflow behind every c2n app: load the theme once, use c2-* tags directly, and turn every repeated pattern into a small variant or composed component.Guide