# Alert (Lumen Halo): prompt.md (v1.0.0)

- id: `lumen-alert` · version 1.0.0 · component · free
- category: Feedback
- build: Base UI (one set of files; its dependencies follow the build)
- install (this build): `npx shadcn@latest add https://beautiful-ui.dev/r/lumen-alert.json`
- npm dependencies: class-variance-authority@^0.7
- registry dependencies: utils, https://beautiful-ui.dev/r/lumen-foundation.json
- docs: https://beautiful-ui.dev/components/lumen-alert
- The install command carries everything this item needs (files, CSS, tokens, npm and registry dependencies). Prefer it to copying source by hand.

A strip of glass whose status shows as a lit cell and a tinted rim, with the title saying it too, never colour alone. shadcn's Alert, cut from Lumen glass.

## Build it
- Stack: React 19 (`ref` is a plain prop), TypeScript, Tailwind CSS v4 utilities, a shadcn-initialised project with the `@/*` alias.
- Packages: `class-variance-authority@^0.7`.
- Files: `components/ui/lumen/alert.tsx`.
- Registry dependencies, installed with it automatically: shadcn `utils` (cn), `lumen-foundation`.
- Builds: one set of files for both, but its dependencies come in Base UI and Radix builds. Install the one that matches the project (see Install): a free item's bare URL installs the Base UI build of it and its dependencies.
- Exports to keep: `Alert`, `AlertTitle / AlertDescription`, `AlertAction`, and every exported type.
- CSS: the install merges this item's rules (the registry `css` field) into your global stylesheet, in `@layer components`, and adds the lumen foundation (tokens, keyframes, motion levels) once. Nothing to import by hand.
- Re-running `add` (or `--overwrite`) re-applies those rules: put overrides in your own CSS, never in the installed rules.
- Tokens: retheme with the `--lumen-*` custom properties (`--lumen-accent`, `--lumen-accent-text`, `--lumen-bad`, `--lumen-bad-text`, `--lumen-focus`, `--lumen-good`, `--lumen-good-text`, `--lumen-hairline`, `--lumen-ink`, `--lumen-muted-ink`, `--lumen-series-1`, `--lumen-series-2`, `--lumen-series-3`, `--lumen-series-4`, `--lumen-series-5`, `--lumen-series-6`, `--lumen-warn`, `--lumen-warn-text`); this item's CSS also reads `--lumen-font-sans`, `--lumen-radius-k`. Never add Tailwind colour classes inside the component.

```tsx
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/lumen/alert";
```

## Parts

| Part | data-slot | What it is for |
|---|---|---|
| `Alert` | `alert` | The strip. |
| `AlertTitle / AlertDescription` | `alert-title` | The words. |
| `AlertAction` | `alert-action` | A button at the right. |

Style a part with `[data-slot="<slot>"]` selectors or its `className`; keep the attributes when editing.

## Sound
- Keep every `data-slot` and `data-sound` attribute: the sound layer reads them.
- Installing this item adds no audio. Nothing plays until the app mounts `GlassSoundProvider` once (install: `npx shadcn@latest add https://beautiful-ui.dev/r/glass-sound.json`, import from `@/components/beautiful-ui/glass-sound`); `GlassSoundToggle` is its mute control. Without a provider the audio engine never loads.

## Match the original
- Read `components/ui/lumen/alert.tsx` as the reference implementation before changing or recreating anything, and match it: sizes, colours per theme, motion timings, copy and behaviour.
- If you deviate (a prop you can't honour, a style you changed, a dependency you swapped), say so in your reply, part by part.
- Keep the accessibility contract, the keyboard map and the motion levels listed below.

## Use it when
- alert, callout, banner, notice, warning, error message, shadcn alert, Lumen
- A message about the page: a warning, an error, a tip

### Not when
- Transient news: use a toast

## Mistakes
- Don't use role=alert for static notes that were there on load

## Usage

```tsx
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/lumen/alert";

<Alert tone="warning">
  <AlertTitle>Stripe sync is 2 hours behind</AlertTitle>
  <AlertDescription>Revenue will catch up by 4 pm.</AlertDescription>
</Alert>
```

## Props

| Prop | Type | Default | What it does |
|---|---|---|---|
| `variant` | `"default" \| "destructive"` | `"default"` | shadcn's two. |
| `tone` | `"neutral" \| "info" \| "success" \| "warning"` |  | Beautiful UI: status that isn't an error. |

Full docs: https://beautiful-ui.dev/components/lumen-alert

## Customising
- Colours: set the `--lumen-*` tokens on `:root`, or on a container with the `lumen-scope` class to retheme one area. Add the `lumen-inherit` class to follow your shadcn palette instead (`--chart-N`, `--destructive`).
- Dark mode follows the `.dark` class on an ancestor (the shadcn and next-themes convention).
- Update later by re-running the install with `--overwrite` (review the diff if you edited it). Changelog: https://beautiful-ui.dev/r/changelog.json

## Keyboard

| Keys | Action |
|---|---|
| — | Not focusable (its action is) |

## Motion inventory

| Interaction | What moves |
|---|---|
| None | Still |

## Accessibility contract (preserve when editing)
- role="alert" by default, as in shadcn: announced when it appears. For a static note that is on the page from the start, pass role="note" so it isn't announced on load
- The title states the status in words

## Install

Base UI project (a base-* style in components.json):

```bash
npx shadcn@latest add https://beautiful-ui.dev/r/lumen-alert.json
```

Radix project (a radix-*, new-york or default style):

```bash
npx shadcn@latest add https://beautiful-ui.dev/r/radix-nova/lumen-alert.json
```

Or add the `@beautiful-ui` registry to components.json and run `npx shadcn@latest add @beautiful-ui/lumen-alert`: the CLI picks the build from your style.

## Credits
- Built on shadcn/ui (https://ui.shadcn.com)

## Source (Base UI build)

### components/ui/lumen/alert.tsx

```tsx
/**
 * Alert (Lumen Halo) v1.0.0 · Beautiful UI
 * Docs: https://beautiful-ui.dev/components/lumen-alert · Agent prompt: https://beautiful-ui.dev/md/lumen-alert.md
 * Licensed to the purchaser under the Beautiful UI license: https://beautiful-ui.dev/license
 */
import * as React from "react";
import { cva, type VariantProps } from "class-variance-authority";
import { cn } from "@/lib/utils";

/*
 * Lumen Alert. shadcn's Alert in Lumen Halo: a strip of glass whose status shows as a lit cell and a
 * tinted rim, never colour alone (the title says it). shadcn's variants (default, destructive), plus
 * Beautiful UI's tones (info, success, warning) for status that isn't an error. Same exports and
 * data-slots as shadcn; server-safe.
 */

const alertVariants = cva(`lumen-alert`, {
  variants: {
    variant: { default: "", destructive: `lumen-alert-destructive` },
    tone: { neutral: "", info: `lumen-alert-info`, success: `lumen-alert-success`, warning: `lumen-alert-warning` },
  },
  defaultVariants: { variant: "default", tone: "neutral" },
});

function Alert({ className, variant, tone, ...props }: React.ComponentProps<"div"> & VariantProps<typeof alertVariants>) {
  return <div data-slot="alert" role="alert" data-variant={variant ?? "default"} className={cn(alertVariants({ variant, tone }), className)} {...props} />;
}

function AlertTitle({ className, ...props }: React.ComponentProps<"div">) {
  return <div data-slot="alert-title" className={cn(`lumen-alert-title`, className)} {...props} />;
}

function AlertDescription({ className, ...props }: React.ComponentProps<"div">) {
  return <div data-slot="alert-description" className={cn(`lumen-alert-description`, className)} {...props} />;
}

function AlertAction({ className, ...props }: React.ComponentProps<"div">) {
  return <div data-slot="alert-action" className={cn(`lumen-alert-action`, className)} {...props} />;
}

export { Alert, AlertTitle, AlertDescription, AlertAction, alertVariants };
```

### CSS (the registry `css` / `cssVars`, merged into the global stylesheet by the shadcn CLI)

```css
@layer components {
  .lumen-alert {
    --la-c: var(--gc-m45);
    --la-t: var(--gc-ink);
    position: relative;
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 12px;
    row-gap: 3px;
    box-sizing: border-box;
    width: 100%;
    padding: 12px 14px 12px 12px;
    border-radius: calc(14px * var(--lumen-radius-k, 1));
    background: var(--gc-glassB);
    box-shadow: inset 0 0 0 1px color-mix(in srgb,var(--la-c) 30%,var(--gc-glassR));
    color: var(--gc-ink);
    font: 400 13.5px/1.5 var(--lumen-font-sans, var(--font-sans, var(--font-geist, var(--font-geist-sans, 'Geist')))), system-ui, sans-serif;
  }
  .lumen-alert::before {
    content: "";
    grid-row: 1 / span 2;
    width: 7px;
    height: 7px;
    margin-top: 6px;
    border-radius: calc(2px * var(--lumen-radius-k, 1));
    background: var(--la-c);
    box-shadow: 0 0 8px color-mix(in srgb,var(--la-c) 55%,transparent);
  }
  .lumen-alert:has(>svg)::before {
    display: none;
  }
  .lumen-alert>svg {
    grid-row: 1 / span 2;
    width: 16px;
    height: 16px;
    margin-top: 2px;
    color: var(--la-c);
  }
  .lumen-alert-destructive {
    --la-c: var(--gc-bad);
    --la-t: var(--gc-bad-ui);
  }
  .lumen-alert-info {
    --la-c: var(--gc-acc);
    --la-t: var(--gc-acc-ui);
  }
  .lumen-alert-success {
    --la-c: var(--gc-good);
    --la-t: var(--gc-good-ui);
  }
  .lumen-alert-warning {
    --la-c: var(--gc-warn);
    --la-t: var(--gc-warn-ui);
  }
  .lumen-alert-title {
    grid-column: 2;
    font-weight: 600;
    color: var(--la-t);
  }
  .lumen-alert-description {
    grid-column: 2;
    color: var(--gc-sec);
  }
  .lumen-alert-description p:not(:last-child) {
    margin-bottom: 12px;
  }
  .lumen-alert :is(.lumen-alert-title,.lumen-alert-description) a {
    text-decoration: underline;
    text-underline-offset: 3px;
  }
  .lumen-alert:has(>.lumen-alert-action) {
    padding-inline-end: 88px;
  }
  .lumen-alert-action {
    position: absolute;
    top: 10px;
    inset-inline-end: 10px;
  }
}
```

The lumen foundation (the tokens listed above, keyframes and motion levels) installs once with the first component; its CSS is public at https://beautiful-ui.dev/r/lumen-foundation.json.
