Docs Components Feedback

Alert

React example follows below.
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>
);
}
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>
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;
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>
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
Prop
variant
Type
"info" | "success" | "warning" | "error" | undefined
Default
"info"
Requirement
optional

Content regions

  • children
  • icon
  • title

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
title
string | undefined
optional
icon
boolean | undefined
true
optional
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

  • default
  • icon
  • title

Import

import { Component } from "@angular/core";
import { GrassrootAlert } from "@grassroot/ui-angular";

Props

Prop
Type
Default
Requirement
variant
"info" | "success" | "warning" | "error"
"info"
optional
title
string
optional
icon
boolean
true
optional
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

  • default
  • icon
  • title

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

  • children
  • icon
  • title

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
className
string
optional
Prop
variant
Type
"info" | "success" | "warning" | "error"
Default
"info"
Requirement
optional
Prop
className
Type
string
Default
Requirement
optional

Content regions

  • children
  • icon
  • title