Primitives
Alert
Five tones, four looks; the icon carries the tone too. Danger and warning are announced.
soft
Rates change on 1 November
Payout sent
Gate 2 camera is slow
Payout on hold
outline
Rates change on 1 November
Payout sent
Gate 2 camera is slow
Payout on hold
accent
Rates change on 1 November
Payout sent
Gate 2 camera is slow
Payout on hold
solid
Rates change on 1 November
Payout sent
Gate 2 camera is slow
Payout on hold
Payout on hold
Read-only
"use client";
import { Alert, Button, type AlertTone, type AlertVariant } from "@waveinno/ui";
import * as React from "react";
const COPY: Record<AlertTone, [string, string]> = {
info: ["Rates change on 1 November", "Cars pay ৳35 for the first hour from then. Monthly passes keep their price."],
success: ["Payout sent", "৳1,24,500 reached your bank account ending 4410."],
warning: ["Gate 2 camera is slow", "Plates are read in 4 s instead of 1 s. Attendants may need to type some."],
danger: ["Payout on hold", "Your bank rejected the transfer. Check the account number in Billing."],
neutral: ["Read-only", "You are viewing Gulshan as an auditor. Changes are turned off."],
};
export default function AlertDemo() {
const [shown, setShown] = React.useState(true);
return (
<div className="space-y-6">
{(["soft", "outline", "accent", "solid"] as AlertVariant[]).map((variant) => (
<div key={variant} className="space-y-2">
<p className="text-[12px] text-muted">{variant}</p>
<div className="grid gap-2.5 md:grid-cols-2">
{(["info", "success", "warning", "danger"] as AlertTone[]).map((tone) => (
<Alert key={tone} tone={tone} variant={variant} title={COPY[tone][0]}>
{COPY[tone][1]}
</Alert>
))}
</div>
</div>
))}
<div className="grid gap-2.5 md:grid-cols-2">
{shown ? (
<Alert
tone="danger"
title={COPY.danger[0]}
onDismiss={() => setShown(false)}
action={
<>
<Button size="sm">Fix in Billing</Button>
<Button size="sm" variant="ghost">
Contact support
</Button>
</>
}
>
{COPY.danger[1]}
</Alert>
) : (
<Button variant="secondary" onClick={() => setShown(true)} className="justify-self-start">
Show the dismissed alert again
</Button>
)}
<Alert tone="neutral" variant="outline" title={COPY.neutral[0]}>
{COPY.neutral[1]}
</Alert>
</div>
</div>
);
}Examples#
Each one on its own: copy its code into your app, or copy it to Figma and paste it on the canvas as layers.
Soft
The default: a tinted panel for most messages on a page.
Rates change on 1 November
"use client";
import { Alert, type AlertTone } from "@waveinno/ui";
const COPY: Record<AlertTone, [string, string]> = {
info: ["Rates change on 1 November", "Cars pay ৳35 for the first hour from then. Monthly passes keep their price."],
success: ["Payout sent", "৳1,24,500 reached your bank account ending 4410."],
warning: ["Gate 2 camera is slow", "Plates are read in 4 s instead of 1 s. Attendants may need to type some."],
danger: ["Payout on hold", "Your bank rejected the transfer. Check the account number in Billing."],
neutral: ["Read-only", "You are viewing Gulshan as an auditor. Changes are turned off."],
};
export default function AlertSoftExample() {
return (
<div className="w-full max-w-xl">
<Alert tone="info" title={COPY.info[0]}>
{COPY.info[1]}
</Alert>
</div>
);
}Outline
A hairline in the tone: calmer, for a list of notices.
Gate 2 camera is slow
"use client";
import { Alert, type AlertTone } from "@waveinno/ui";
const COPY: Record<AlertTone, [string, string]> = {
info: ["Rates change on 1 November", "Cars pay ৳35 for the first hour from then. Monthly passes keep their price."],
success: ["Payout sent", "৳1,24,500 reached your bank account ending 4410."],
warning: ["Gate 2 camera is slow", "Plates are read in 4 s instead of 1 s. Attendants may need to type some."],
danger: ["Payout on hold", "Your bank rejected the transfer. Check the account number in Billing."],
neutral: ["Read-only", "You are viewing Gulshan as an auditor. Changes are turned off."],
};
export default function AlertOutlineExample() {
return (
<div className="w-full max-w-xl">
<Alert tone="warning" variant="outline" title={COPY.warning[0]}>
{COPY.warning[1]}
</Alert>
</div>
);
}Accent
A bar of colour on the edge: for alerts inside cards and tables.
Payout sent
"use client";
import { Alert, type AlertTone } from "@waveinno/ui";
const COPY: Record<AlertTone, [string, string]> = {
info: ["Rates change on 1 November", "Cars pay ৳35 for the first hour from then. Monthly passes keep their price."],
success: ["Payout sent", "৳1,24,500 reached your bank account ending 4410."],
warning: ["Gate 2 camera is slow", "Plates are read in 4 s instead of 1 s. Attendants may need to type some."],
danger: ["Payout on hold", "Your bank rejected the transfer. Check the account number in Billing."],
neutral: ["Read-only", "You are viewing Gulshan as an auditor. Changes are turned off."],
};
export default function AlertAccentExample() {
return (
<div className="w-full max-w-xl">
<Alert tone="success" variant="accent" title={COPY.success[0]}>
{COPY.success[1]}
</Alert>
</div>
);
}Solid
Filled with the tone: the one message nobody may miss.
Payout on hold
"use client";
import { Alert, type AlertTone } from "@waveinno/ui";
const COPY: Record<AlertTone, [string, string]> = {
info: ["Rates change on 1 November", "Cars pay ৳35 for the first hour from then. Monthly passes keep their price."],
success: ["Payout sent", "৳1,24,500 reached your bank account ending 4410."],
warning: ["Gate 2 camera is slow", "Plates are read in 4 s instead of 1 s. Attendants may need to type some."],
danger: ["Payout on hold", "Your bank rejected the transfer. Check the account number in Billing."],
neutral: ["Read-only", "You are viewing Gulshan as an auditor. Changes are turned off."],
};
export default function AlertSolidExample() {
return (
<div className="w-full max-w-xl">
<Alert tone="danger" variant="solid" title={COPY.danger[0]}>
{COPY.danger[1]}
</Alert>
</div>
);
}With actions and dismiss
Give the fix right there, and let people close it.
Payout on hold
"use client";
import { Alert, Button, type AlertTone } from "@waveinno/ui";
const COPY: Record<AlertTone, [string, string]> = {
info: ["Rates change on 1 November", "Cars pay ৳35 for the first hour from then. Monthly passes keep their price."],
success: ["Payout sent", "৳1,24,500 reached your bank account ending 4410."],
warning: ["Gate 2 camera is slow", "Plates are read in 4 s instead of 1 s. Attendants may need to type some."],
danger: ["Payout on hold", "Your bank rejected the transfer. Check the account number in Billing."],
neutral: ["Read-only", "You are viewing Gulshan as an auditor. Changes are turned off."],
};
export default function AlertActionsExample() {
return (
<div className="w-full max-w-xl">
<Alert
tone="danger"
title={COPY.danger[0]}
onDismiss={() => {}}
action={
<>
<Button size="sm">Fix in Billing</Button>
<Button size="sm" variant="ghost">
Contact support
</Button>
</>
}
>
{COPY.danger[1]}
</Alert>
</div>
);
}Neutral
For state rather than news: read-only, archived, a preview.
Read-only
"use client";
import { Alert, type AlertTone } from "@waveinno/ui";
const COPY: Record<AlertTone, [string, string]> = {
info: ["Rates change on 1 November", "Cars pay ৳35 for the first hour from then. Monthly passes keep their price."],
success: ["Payout sent", "৳1,24,500 reached your bank account ending 4410."],
warning: ["Gate 2 camera is slow", "Plates are read in 4 s instead of 1 s. Attendants may need to type some."],
danger: ["Payout on hold", "Your bank rejected the transfer. Check the account number in Billing."],
neutral: ["Read-only", "You are viewing Gulshan as an auditor. Changes are turned off."],
};
export default function AlertNeutralExample() {
return (
<div className="w-full max-w-xl">
<Alert tone="neutral" variant="outline" title={COPY.neutral[0]}>
{COPY.neutral[1]}
</Alert>
</div>
);
}Animated#
Motion that earns its place: free ones to copy now, and Pro ones whose code and Figma copy come with a Wavi Pro licence. They respect the visitor's reduced-motion setting.
Rise inFree
Arrives with a short rise, so the eye finds it.
Payout sent
"use client";
import { Alert, Button, type AlertTone } from "@waveinno/ui";
import * as React from "react";
const COPY: Record<AlertTone, [string, string]> = {
info: ["Rates change on 1 November", "Cars pay ৳35 for the first hour from then. Monthly passes keep their price."],
success: ["Payout sent", "৳1,24,500 reached your bank account ending 4410."],
warning: ["Gate 2 camera is slow", "Plates are read in 4 s instead of 1 s. Attendants may need to type some."],
danger: ["Payout on hold", "Your bank rejected the transfer. Check the account number in Billing."],
neutral: ["Read-only", "You are viewing Gulshan as an auditor. Changes are turned off."],
};
export default function AlertRiseExample() {
const [key, setKey] = React.useState(0);
return (
<div className="w-full max-w-xl space-y-3">
<Alert key={key} tone="success" title={COPY.success[0]} className="animate-wv-rise">
{COPY.success[1]}
</Alert>
<Button size="sm" variant="ghost" onClick={() => setKey((k) => k + 1)}>
Show it again
</Button>
</div>
);
}Shake on errorFree
A failed retry shakes the alert instead of adding a second one.
Payout on hold
"use client";
import { Alert, Button, type AlertTone } from "@waveinno/ui";
import * as React from "react";
const COPY: Record<AlertTone, [string, string]> = {
info: ["Rates change on 1 November", "Cars pay ৳35 for the first hour from then. Monthly passes keep their price."],
success: ["Payout sent", "৳1,24,500 reached your bank account ending 4410."],
warning: ["Gate 2 camera is slow", "Plates are read in 4 s instead of 1 s. Attendants may need to type some."],
danger: ["Payout on hold", "Your bank rejected the transfer. Check the account number in Billing."],
neutral: ["Read-only", "You are viewing Gulshan as an auditor. Changes are turned off."],
};
export default function AlertShakeExample() {
const [tries, setTries] = React.useState(0);
return (
<div className="w-full max-w-xl">
<Alert
key={tries}
tone="danger"
title={COPY.danger[0]}
className={tries ? "animate-wv-shake" : undefined}
action={
<Button size="sm" onClick={() => setTries((t) => t + 1)}>
Retry payout
</Button>
}
>
{COPY.danger[1]}
</Alert>
</div>
);
}Closes itself Pro
A draining bar shows the seconds left; hover pauses it. For confirmations that need no click.
Report exported
This example's code comes with Wavi Pro
One payment for every Pro component, block and template, with every update.
Import#
Everything comes from the package root. The example above uses:
import { Alert, Button, type AlertTone, type AlertVariant } from "@waveinno/ui";Props#
Read from the source of this version, so they match the code exactly.
<Alert>
src/components/ui/alert.tsx| Prop | Type | Default | Description |
|---|---|---|---|
tone | "info" | "success" | "warning" | "danger" | "neutral" | "info" | |
variant | "soft" | "outline" | "solid" | "accent" | "soft" | |
title | React.ReactNode | — | |
icon | React.ReactNode | false | — | Replace the tone's icon, or `false` for none. |
action | React.ReactNode | — | Buttons under the text: "Retry", "Review". |
onDismiss | () => void | — | Shows a close button; called when it is pressed. |
Also takes Omit<React.HTMLAttributes<HTMLDivElement>, "title">.
<Button>
src/components/ui/button.tsx| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean | false | |
loading | boolean | — |
Also takes ButtonHTMLAttributes<HTMLButtonElement> & VariantProps<typeof buttonVariants>.
Install#
If the project does not have the package yet, add it, then follow the setup for Next.js or Vite once.
$ npm install @waveinno/ui