#104
Closable
Two dismissible alerts, an info one with a title and a warning one, that are replaced by a short dismissed note once closed.
Hand this to your AI. It names the exact library parts, timings and accessibility promises of this demo.
Build the "Closable" pattern (@codeatlasdev/ui demo #104, display/alert) in my app.
Call get_demo({ ids: ["#104"] }) first and keep its structure. It needs @codeatlasdev/[email protected].
Use: Inline notices the user can dismiss, such as beta-feature banners or storage warnings.
Keep these library parts, with the props and tokens the demo uses:
- Alert from "@codeatlasdev/ui"
Behaviour to keep:
- `<Alert severity="info" title="Heads up" closable onclose={() => (closedInfo = true)}>` with beta-feature text
- `<Alert severity="warning" closable onclose={() => (closedWarn = true)}>` with a storage 85% full message, no title
- `let closedInfo = $state(false)` and `let closedWarn = $state(false)` track each alert
- `{#if !closedInfo}` and `{#if !closedWarn}` render the alert, `{:else}` renders a `<p class="dismissed">` note
- Wrapper `.col` has `max-width: 560px`
Reduced motion: the demo handles it; keep that branch.
Keyboard: operable; keep the focus order and key handling.
Change only the copy and the data. Use the theme tokens (--ca-*), never raw colours. Library parts
- Alert
@codeatlasdev/ui
How it is built
- `<Alert severity="info" title="Heads up" closable onclose={() => (closedInfo = true)}>` with beta-feature text
- `<Alert severity="warning" closable onclose={() => (closedWarn = true)}>` with a storage 85% full message, no title
- `let closedInfo = $state(false)` and `let closedWarn = $state(false)` track each alert
- `{#if !closedInfo}` and `{#if !closedWarn}` render the alert, `{:else}` renders a `<p class="dismissed">` note
- Wrapper `.col` has `max-width: 560px`
Related
Loading source.