component

Alert

props · 27 shown · 27 total

Appearance

  • "transparent" "surface.peak" "surface.hill" "surface.base" "surface.valley" "surface.ground"

    Background style of the outer container, forwarded to Panel.

  • "default" "none" "bold" "muted" "accent"

    Box-shadow ring border forwarded to Panel. none: no border. default: standard border. bold: stronger emphasis. muted: subtle separation. Defaults to none for primary emphasis and muted for secondary/tertiary.

  • false AlertCardProps<TSlot>
    default {}

    The Card the alert renders itself as — or `false` for the legacy bare `<div>` (the pre-card DOM, exactly). The alert's own surface props (`tone`, `emphasis`, `background`, `border`, `radius`, `shadow`, `translucent`, `rhythm`) are the Card's defaults and `size` picks the Card size; any field set here wins. `card.contentBackground` turns the message into an inset panel. In card mode `padding` is ignored (the Card size owns the spacing) and `passThrough.header` / `title` address the card header Banner / heading.

  • "primary" "secondary" "tertiary"
    default "primary"

    Controls the visual weight of the outer container. primary: full-color (500) outer ring with contrast text and a tinted content area. secondary: neutral surface outer with a full-color icon. tertiary: transparent outer with a neutral-background icon tinted by the tone color.

  • boolean
    default false

    When true, hides the tone icon from the alert.

  • "inherit" "lg" "md" "sm" "none" "2xl" "xl" "inner" "xs" "2xs" "3xl" "4xl" "5xl" "6xl" "full"
    default "xs"

    Border radius of the outer container, forwarded to Panel.

  • "inherit" "lg" "md" "sm" "none" "2xl" "xl" "inner" "xs" "2xs" "3xl" "4xl" "5xl" "6xl" "full"

    Border radius applied to the bottom corners of the outer container, forwarded to Panel.

  • "inherit" "lg" "md" "sm" "none" "2xl" "xl" "inner" "xs" "2xs" "3xl" "4xl" "5xl" "6xl" "full"

    Border radius applied to the left corners of the outer container, forwarded to Panel.

  • "inherit" "lg" "md" "sm" "none" "2xl" "xl" "inner" "xs" "2xs" "3xl" "4xl" "5xl" "6xl" "full"

    Border radius applied to the right corners of the outer container, forwarded to Panel.

  • "inherit" "lg" "md" "sm" "none" "2xl" "xl" "inner" "xs" "2xs" "3xl" "4xl" "5xl" "6xl" "full"

    Border radius applied to the top corners of the outer container, forwarded to Panel.

  • "lg" "md" "sm" "none" "xl" "xs"

    Box-shadow elevation of the outer container, forwarded to Panel.

  • "lg" "md" "sm"
    default "md"

    Font size for the alert text. sm: smaller text for compact layouts. md: default size. lg: larger text for prominent alerts.

  • AlertTone
    default "default"

    Semantic tone color scheme. When omitted, the alert uses the primary color palette (general information). Providing a tone color applies the corresponding color tokens and icon.

  • boolean
    default false

    Apply a frosted glass effect with backdrop blur to the outer container.

Layout

  • "lg" "md" "sm" "none" "2xl" "xl" "xs" "2xs" "3xl" "4xl" "5xl" "6xl" "10xl" "11xl" "3xs" "4xs" "7xl" "8xl" "9xl"
    default "2xs"

    Internal padding of the outer container, forwarded to Panel.

  • boolean
    default false

    Opt the alert into the baseline rhythm: forwarded to Panel, which bakes `data-rhythm` on the root and pads it in whole raster lines, while the alert's own text slots quantise their leading to the line. The alert's height then comes out as a whole number of lines. An ancestor scope (a `<Grid rhythm>`, any `[data-rhythm]`) quantises the text without this prop; the prop is what also puts the alert's own box on the raster.

Behavior

  • boolean
    default false

    Render a dismiss button (header trailing; the end of the row in the compact layout). Clicking it calls `onDismiss`; without a handler the alert hides itself.

  • boolean
    default false

    When true, applies interactive surface styling (e.g. hover affordances) to the outer container.

Events

  • onDismiss svelte
    (event: MouseEvent) => void

    Called when the dismiss button is clicked. Without a handler the alert hides itself.

Accessibility

  • string
    default "Dismiss"

    Accessible label of the dismiss button.

  • "polite" "assertive"

    Make the alert a live region: `"polite"` → `role="status"`, `"assertive"` → `role="alert"`. An explicit `role` wins.

Slots

  • actions slot svelte
    Snippet

    Action controls. In card mode they render in the Card footer (trailing); with `card={false}` at the right of the header row.

  • children slot svelte
    Snippet

    The alert body content.

  • title svelte
    string

    Plain-text heading. In card mode it is the Card heading (with the tone Stamp leading it); without one the alert is the compact single-row layout.

Advanced

  • element binding svelte
    HTMLElement null

    Bindable reference to the alert's root element (the Card root in card mode).

  • AlertPassThrough<RootElementAttributes>

    Per-slot override bag for customizing the styles and HTML attributes of any alert slot.

  • boolean
    default false

    Astro / vanilla: serialize the props into `data-alert-config` so the client runtime hydrates this instance and `getPindoba(el, "alert")` can `update()` it. Frameworks with their own reactivity don't need it.

Plus all standard <div> HTML attributes.

Type

  • Components
  • Blocks