- Prop
variant- Type
"info" | "success" | "warning" | "error" | undefined- Default
"info"- Requirement
- optional
Docs Components Feedback
Alert
React example follows below.
Vue example follows below.
Angular example follows below.
Svelte example follows below.
Solid example follows below.
- parts
- —
- nodes
- —
- size
- —
- part
- —
ts
const alertFixture = { id: "alert", alerts: [ { variant: "info", message: "Region us-east-1 has a maintenance window Sunday 02:00–04:00 UTC." }, { variant: "success", message: "ledger-api v2.4.1 is live in prod. Health checks passed." }, { variant: "error", message: "analytics-ingest is returning 503s in us-west-2." }, ],} satisfies { id: string; alerts: Array<{ variant: "info" | "success" | "warning" | "error"; message: string }>;}; import { Alert } from "@grassroot/ui-react"; export default function AlertDemo() { return ( <div> {alertFixture.alerts.map((alert) => ( <Alert key={alert.variant} variant={alert.variant}> {alert.message} </Alert> ))} </div> );}- parts
- —
- nodes
- —
- size
- —
- part
- —
ts
<script setup lang="ts">import { Alert } from "@grassroot/ui-vue";const alertFixture = { id: "alert", alerts: [ { variant: "info", message: "Region us-east-1 has a maintenance window Sunday 02:00–04:00 UTC." }, { variant: "success", message: "ledger-api v2.4.1 is live in prod. Health checks passed." }, { variant: "error", message: "analytics-ingest is returning 503s in us-west-2." }, ],} satisfies { id: string; alerts: Array<{ variant: "info" | "success" | "warning" | "error"; message: string }>;}; </script> <template> <div> <Alert v-for="alert in alertFixture.alerts" :key="alert.variant" :variant="alert.variant">{{ alert.message }}</Alert> </div></template>- parts
- —
- nodes
- —
- size
- —
- part
- —
ts
import { Component } from "@angular/core";import { GrassrootAlert } from "@grassroot/ui-angular";const alertFixture = { id: "alert", alerts: [ { variant: "info", message: "Region us-east-1 has a maintenance window Sunday 02:00–04:00 UTC." }, { variant: "success", message: "ledger-api v2.4.1 is live in prod. Health checks passed." }, { variant: "error", message: "analytics-ingest is returning 503s in us-west-2." }, ],} satisfies { id: string; alerts: Array<{ variant: "info" | "success" | "warning" | "error"; message: string }>;}; @Component({ selector: "app-alert-demo", standalone: true, imports: [GrassrootAlert], template: ` <div> @for (alert of fixture.alerts; track alert.variant) { <grassroot-alert [variant]="alert.variant">{{ alert.message }}</grassroot-alert> } </div> `,})export class AlertDemoComponent { protected readonly fixture = alertFixture;} export default AlertDemoComponent;- parts
- —
- nodes
- —
- size
- —
- part
- —
ts
<script lang="ts"> import { Alert } from "@grassroot/ui-svelte"; const alertFixture = { id: "alert", alerts: [ { variant: "info", message: "Region us-east-1 has a maintenance window Sunday 02:00–04:00 UTC." }, { variant: "success", message: "ledger-api v2.4.1 is live in prod. Health checks passed." }, { variant: "error", message: "analytics-ingest is returning 503s in us-west-2." }, ], } satisfies { id: string; alerts: Array<{ variant: "info" | "success" | "warning" | "error"; message: string }>; }; </script> <div> {#each alertFixture.alerts as alert (alert.variant)} <Alert variant={alert.variant}>{alert.message}</Alert> {/each}</div>- parts
- —
- nodes
- —
- size
- —
- part
- —
ts
/** @jsxImportSource solid-js */import { Alert } from "@grassroot/ui-solid";const alertFixture = { id: "alert", alerts: [ { variant: "info", message: "Region us-east-1 has a maintenance window Sunday 02:00–04:00 UTC." }, { variant: "success", message: "ledger-api v2.4.1 is live in prod. Health checks passed." }, { variant: "error", message: "analytics-ingest is returning 503s in us-west-2." }, ],} satisfies { id: string; alerts: Array<{ variant: "info" | "success" | "warning" | "error"; message: string }>;}; import type { JSX } from "solid-js"; export default function AlertDemo(): JSX.Element { return ( <div> {alertFixture.alerts.map((alert) => ( <Alert variant={alert.variant}>{alert.message}</Alert> ))} </div> );}Installation
API Reference
Import
import { Alert } from "@grassroot/ui-react";
Props
Prop
Type
Default
Requirement
variant"info" | "success" | "warning" | "error" | undefined"info"optional
Content regions
childrenicontitle
Native attributes
Standard DOM and ARIA attributes not listed above spread onto the root element.
Import
import { Alert } from "@grassroot/ui-vue";
Props
Prop
Type
Default
Requirement
variant"info" | "success" | "warning" | "error" | undefined"info"optional
titlestring | undefined—
optional
iconboolean | undefinedtrueoptional
- Prop
variant- Type
"info" | "success" | "warning" | "error" | undefined- Default
"info"- Requirement
- optional
- Prop
title- Type
string | undefined- Default
- —
- Requirement
- optional
- Prop
icon- Type
boolean | undefined- Default
true- Requirement
- optional
Content regions
defaulticontitle
Import
import { Component } from "@angular/core";
import { GrassrootAlert } from "@grassroot/ui-angular";
Props
Prop
Type
Default
Requirement
variant"info" | "success" | "warning" | "error""info"optional
titlestring—
optional
iconbooleantrueoptional
- Prop
variant- Type
"info" | "success" | "warning" | "error"- Default
"info"- Requirement
- optional
- Prop
title- Type
string- Default
- —
- Requirement
- optional
- Prop
icon- Type
boolean- Default
true- Requirement
- optional
Content regions
defaulticontitle
Import
import { Alert } from "@grassroot/ui-svelte";
Props
Prop
Type
Default
Requirement
variant"info" | "success" | "warning" | "error""info"optional
- Prop
variant- Type
"info" | "success" | "warning" | "error"- Default
"info"- Requirement
- optional
Content regions
childrenicontitle
Import
import { Alert } from "@grassroot/ui-solid";
import type { JSX } from "solid-js";
Props
Prop
Type
Default
Requirement
variant"info" | "success" | "warning" | "error""info"optional
classNamestring—
optional
- Prop
variant- Type
"info" | "success" | "warning" | "error"- Default
"info"- Requirement
- optional
- Prop
className- Type
string- Default
- —
- Requirement
- optional
Content regions
childrenicontitle