DocsComponentsFeedback
Alert
React example follows below.
ts
import { Alert } from "@grassroot/ui-react"; <Alert title="Scheduled maintenance"> Region us-east-1 has a maintenance window Sunday 02:00–04:00 UTC.</Alert><Alert variant="success" title="Deploy succeeded"> ledger-api v2.4.1 is live in prod. Health checks passed.</Alert><Alert variant="error" title="Health check failed"> analytics-ingest is returning 503s in us-west-2.</Alert>ts
<script setup lang="ts">import { Alert } from "@grassroot/ui-vue";</script> <template> <Alert title="Scheduled maintenance" > Region us-east-1 has a maintenance window Sunday 02:00–04:00 UTC. </Alert> <Alert variant="success" title="Deploy succeeded" > ledger-api v2.4.1 is live in prod. Health checks passed. </Alert> <Alert variant="error" title="Health check failed" > analytics-ingest is returning 503s in us-west-2. </Alert></template>ts
import { Component } from "@angular/core";import { GrassrootAlert } from "@grassroot/ui-angular"; @Component({ selector: "app-example", standalone: true, imports: [GrassrootAlert], template: ` <grassroot-alert title="Scheduled maintenance" > Region us-east-1 has a maintenance window Sunday 02:00–04:00 UTC. </grassroot-alert> <grassroot-alert variant="success" title="Deploy succeeded" > ledger-api v2.4.1 is live in prod. Health checks passed. </grassroot-alert> <grassroot-alert variant="error" title="Health check failed" > analytics-ingest is returning 503s in us-west-2. </grassroot-alert> `,})export class ExampleComponent {}ts
<script lang="ts"> import { Alert } from "@grassroot/ui-svelte";</script> <Alert title="Scheduled maintenance"> Region us-east-1 has a maintenance window Sunday 02:00–04:00 UTC.</Alert><Alert variant="success" title="Deploy succeeded"> ledger-api v2.4.1 is live in prod. Health checks passed.</Alert><Alert variant="error" title="Health check failed"> analytics-ingest is returning 503s in us-west-2.</Alert>ts
import { Alert } from "@grassroot/ui-solid"; export function Example() { return ( <> <Alert title="Scheduled maintenance" > Region us-east-1 has a maintenance window Sunday 02:00–04:00 UTC. </Alert> <Alert variant="success" title="Deploy succeeded" > ledger-api v2.4.1 is live in prod. Health checks passed. </Alert> <Alert variant="error" title="Health check failed" > analytics-ingest is returning 503s in us-west-2. </Alert> </> );}Installation
bash
pnpm dlx grassroot add ui/alertbash
npx grassroot@latest add ui/alertbash
yarn dlx grassroot add ui/alertbash
bunx grassroot add ui/alertAPI Reference
| Prop | Type | Default |
|---|---|---|
variant | "info" | "success" | "warning" | "error" | undefined | "info" |
titleBold first line above the body. | React.ReactNode | — |
iconReplace the default variant icon (or pass null to drop it). | React.ReactNode | — |