apx-dsv0.1Local renderer · live
K
Foundations4
  • Getting started
  • Theming
  • Templates
  • Icons
  • Avatar
  • Badge
  • DataGrid
  • Scheduler
  • Stat
  • Table
  • Timeline
  • TreeView
  • Accordion
  • Alert
  • EmptyState
  • Progress
  • Skeleton
  • Spinner
  • SplashScreen
  • Toast
  • ColorPicker
  • FileUpload
  • Form
  • Rating
  • TagsInput
  • Combobox
  • Field
  • Select
  • Toggle
  • Button
  • Calendar
  • Checkbox
  • DatePicker
  • Input
  • NumberInput
  • Radio
  • Slider
  • Switch
  • Textarea
  • AppShell
  • Div
  • Divider
  • Sidebar
  • Stack
  • Typography
  • Image
  • Breadcrumbs
  • Carousel
  • NavigationMenu
  • Pagination
  • Stepper
  • Tabs
  • Toolbar
  • CommandPalette
  • Confirm
  • Drawer
  • HoverCard
  • Menu
  • Modal
  • Popover
  • Tooltip
  • Icon
  • Card
  • PricingCard
60 componentsapx-ds/renderer
Alert
Variant↳ other

Feedback

Alert

Inline status banner. The canonical feedback surface for info / success / warning / danger / neutral messages — auto-icon, optional title + description + action, Motion-driven dismiss.

Alert

The canonical inline status banner. <Alert /> is the DS's first opinionated feedback surface — it covers info / success / warning / danger / neutral messages with auto-icon, optional title + description + action area, and a Motion-driven dismiss.

Overview — info, success, warning, and closable danger

Loading preview…
Overview.tsx

Why this exists

Three jobs land in this component that other status surfaces (Toast, Banner, Inline-error) will reuse:

  1. Icon-by-color. The leading icon is selected automatically from the active color via the shared _shared/iconForColor helper. One mapping, every consumer.
  2. Constrained color set. Alerts speak about what happened — they don't carry brand. The 5-of-7 palette (no primary / secondary) is the convention.
  3. Motion-driven exit. <AnimatePresence> makes closable Alerts dismiss with a single height + opacity tween. Surrounding layout reflows for free.

Anatomy

tsx
┌──────────────────────────────────────────────────────────┐
│  [icon]   <Title>                       [× close button] │
│           <Description>                                  │
│           <Action> [button] [button]                     │
└──────────────────────────────────────────────────────────┘
┌──────────────────────────────────────────────────────────┐
│  [icon]   <Title>                       [× close button] │
│           <Description>                                  │
│           <Action> [button] [button]                     │
└──────────────────────────────────────────────────────────┘

<Alert.Title> / <Alert.Description> / <Alert.Action> are subparts — use only the ones you need. A bare <Alert>Saved.</Alert> is just as valid.

Variants

VariantBackgroundBorderWhen to reach for it
solidfull colornoneCritical announcements, system-level alerts.
outlinepapercolored borderBrand-light contexts, paired with Card.
softsubtle tintlow-contrast colored borderDefault. Toast/banner-style notifications.
inlinetransparentlogical-start 4px colored barInline form validation, minimal chrome.

Colors

info (default) · success · warning · danger · neutral

Brand colors (primary, secondary) are intentionally excluded — they don't carry status meaning. Add them via a theme override if your product needs them.

Examples

Default — info color, soft variant

Loading preview…
Basic.tsx

All four variants

Loading preview…
Variants.tsx

Three sizes (sm / md / lg)

Loading preview…
Sizes.tsx

Every variant × every color

Loading preview…
Colors.tsx

With title + description

Loading preview…
WithTitle.tsx

With action button row

Loading preview…
WithAction.tsx

Closable + Motion exit

Loading preview…
Closable.tsx

Custom leading icon

Loading preview…
CustomIcon.tsx

Hide icon (chrome-less)

Loading preview…
HideIcon.tsx

Controlled — parent owns open state

Loading preview…
Controlled.tsx

Inline variant under a form field

Loading preview…
FormValidation.tsx

Stacked / dismissable list

Loading preview…
Stacked.tsx

Props

PropTypeDefaultNotes
variant'solid' | 'outline' | 'soft' | 'inline''soft'Responsive via the { base, md } shape.
color'info' | 'success' | 'warning' | 'danger' | 'neutral''info'Drives the auto-icon and the auto-role.
size'sm' | 'md' | 'lg''md'Padding + icon size + font scale.
iconReactNode—Overrides the auto-selected leading icon.
hideIconbooleanfalseHides the leading icon slot entirely.
closablebooleanfalseRenders a × button on the trailing edge.
onClose() => void—Fired when the alert dismisses (close button or controlled open flip).
openboolean—Controlled visibility. Pair with onClose.
defaultOpenbooleantrueInitial visibility for the uncontrolled flow.
role'status' | 'alert'autoAuto-selects per color. Override only when intentional.
classNamestring—Merged via tailwind-merge. Last-wins.
sxSx—Theme-aware inline style.

Accessibility

  • Auto live-region role. info / success / neutral → role="status" (polite live region). warning / danger → role="alert" (assertive). Override only when you know.
  • Decorative icon. The leading icon is wrapped in an aria-hidden="true" span — the body text + role carry the meaning for screen readers.
  • Close button has a name. Always reads as "Dismiss" via aria-label.
  • Heading level is left to you. Alert.Title is a plain <div>. Wrap in <h3> / <h4> when the page outline demands a real heading.

Theming

ts
defineTheme({
  components: {
    Alert: {
      defaultProps: { variant: 'outline', size: 'sm' },
      styleOverrides: {
        root: 'rounded-xl',
        title: 'tracking-tight',
        description: 'leading-snug',
        action: 'mt-3',
      },
    },
  },
});
defineTheme({
  components: {
    Alert: {
      defaultProps: { variant: 'outline', size: 'sm' },
      styleOverrides: {
        root: 'rounded-xl',
        title: 'tracking-tight',
        description: 'leading-snug',
        action: 'mt-3',
      },
    },
  },
});

Alert is consumed by the renderer's Theme Studio for live preview.

Props

PropTypeDefaultDescription
closablebooleanfalseRender a built-in `×` dismiss button on the trailing edge.
colorenum'info'Status color.
defaultOpenbooleantrueInitial visibility for the uncontrolled flow.
hideIconbooleanfalseHide the leading icon entirely.
iconReactNode—Overrides the auto-selected leading icon for the active `color`.
onClose(() => void)—Fired when the alert is dismissed (via the close button or controlled `open=false`).
openboolean—Controlled visibility. Pair with `onClose`.
roleenum—Live-region role override. Auto-selects based on `color` — info / success / neutral get `status` (polite), warning / danger get `alert` (assertive). Only override when intentional.
sizeResponsiveValue<AlertSize>'md'Visual size.
sxSx—Theme-aware inline style object.
variantResponsiveValue<AlertVariant>'soft'Stylistic family.