Success
Confirms the thing the user just did actually landed.
import { Alert } from '@/components/Alert';
<Alert tone="success">
<Alert.Icon />
<Alert.Body>
<Alert.Title>Payment processed</Alert.Title>Tells the user what just happened, or what is about to.
import { Alert } from "@/fragments/ui";Sourceimport { Alert } from '@/components/Alert';
<Alert tone="info">
<Alert.Icon />
<Alert.Body>
<Alert.Content>npx @usefragments/cli add alertWrites src/fragments/ui/components/Alert plus what it imports, the globals stylesheet, and .fragments/registry-lock.json, then prints the packages to add. No account, no key.
Your own registry: publish from Fragments Cloud and add --registry org/name. Connect a workspace.
Alert is a compound: import the root and reach its parts through dot notation.
Alert.IconAlert.BodyAlert.TitleAlert.ContentAlert.ActionsAlert.ActionAlert.CloseNeutral context — nothing went wrong, nothing needs doing.
import { Alert } from '@/components/Alert';
<Alert tone="info">
<Alert.Icon />
<Alert.Body>
<Alert.Content>
Your session will expire in 15 minutes. Save your work to avoid losing changes.
</Alert.Content>
</Alert.Body>
</Alert>Confirms the thing the user just did actually landed.
import { Alert } from '@/components/Alert';
<Alert tone="success">
<Alert.Icon />
<Alert.Body>
<Alert.Title>Payment processed</Alert.Title>Nothing is broken yet — act before it is.
import { Alert } from '@/components/Alert';
<Alert tone="warning">
<Alert.Icon />
<Alert.Body>
<Alert.Title>Storage almost full</Alert.Title>Something failed; say what to do about it.
import { Alert } from '@/components/Alert';
<Alert tone="danger">
<Alert.Icon />
<Alert.Body>
<Alert.Title>Upload failed</Alert.Title>One button, one job — more than one stalls the reader.
import { Alert } from '@/components/Alert';
<Alert tone="warning">
<Alert.Icon />
<Alert.Body>
<Alert.Title>Update available</Alert.Title>A close button suits news the user can safely ignore.
import { Alert } from '@/components/Alert';
<Alert tone="info">
<Alert.Icon />
<Alert.Body>
<Alert.Content>Prop | Type | Default | Description |
|---|---|---|---|
childrenRequired | node | Not set | Alert content - use Alert.Icon, Alert.Body, Alert.Title, Alert.Content, Alert.Actions, Alert.Close sub-components |
tone | enuminfosuccesswarningdanger | info | Tone; controls colour, icon and live-region role |
emphasis | enumtintsurface | tint | How much surface the tone claims. `tint` washes the card in the tone colour; `surface` keeps the page background and colours only the hairline and title. |