Alert
Inline status message with an icon, title, and actions.
Heads up
Review before publishing
Import
Section titled “Import”import { Alert, AlertRow, AlertIcon, AlertBody, AlertTitle, AlertDescription, AlertClose, AlertActions, AlertAction,} from "@pelagornis/page/components";Example
Section titled “Example”The preview above renders this file. Copy it into src/components/ to start from it.
import { Alert, AlertAction, AlertActions, AlertBody, AlertClose, AlertDescription, AlertIcon, AlertRow, AlertTitle, Stack,} from "@pelagornis/page/components";
export default function AlertDemo() { return ( <Stack gap="sizeMedium" className="w-full"> <Alert variant="info"> <AlertRow> <AlertIcon /> <AlertBody> <AlertTitle>Heads up</AlertTitle> <AlertDescription>The plugin injects RefineUI styles for you.</AlertDescription> </AlertBody> </AlertRow> </Alert> <Alert variant="warning"> <AlertRow> <AlertIcon /> <AlertBody> <AlertTitle>Review before publishing</AlertTitle> <AlertDescription>Two pages have no description.</AlertDescription> </AlertBody> <AlertClose type="button" /> </AlertRow> <AlertActions> <AlertAction type="button">Review</AlertAction> </AlertActions> </Alert> </Stack> );}Use in MDX
Section titled “Use in MDX”Alert is composed from parts that share React state. Children written in MDX are rendered as separate islands, so the parts can’t reach each other. Put the composition in a .tsx file, like the example above, and import that file instead.
---title: Example---
import AlertExample from "../../components/AlertExample";
<AlertExample client:load />client:load hydrates the island on page load. Use client:visible for content far down the page.
Use in Markdoc
Section titled “Use in Markdoc”Markdoc tags render Astro components, and this one needs client state. Wrap the example in an .astro file that hydrates it, then register that file as a tag.
---import AlertExample from "../AlertExample";---
<AlertExample client:load />import { component, defineMarkdocConfig } from "@astrojs/markdoc/config";import starlightMarkdoc from "@astrojs/starlight-markdoc";import pageMarkdoc from "@pelagornis/page/markdoc";
export default defineMarkdocConfig({ extends: [starlightMarkdoc(), pageMarkdoc()], tags: { "alert-example": { render: component("./src/components/markdoc/AlertExample.astro"), selfClosing: true, }, },});{% alert-example /%}Variants
Section titled “Variants”Values the component accepts for each variant prop.
| Prop | Values |
|---|---|
variant | default info success warning danger custom |
Anatomy
Section titled “Anatomy”Parts of the component and the data-refineui role each one renders.
| Part | Role |
|---|---|
root | alert |
icon | alert-icon |
content | alert-content |
row | alert-row |
body | alert-body |
title | alert-title |
description | alert-description |
actions | alert-actions |
action | alert-action |
close | alert-close |
States
Section titled “States”States the component styles. Component states are exposed as data attributes.
| Kind | States |
|---|---|
| Pseudo | focus-visible |
Reference
Section titled “Reference”- RefineUI · Alert for design guidance and token detail.
- Use in MDX and Use in Markdoc for the general rules.