Feedback
Alert
Inline alert for sync issues, limits and compliance notes. Four tones plus feature, three styles (soft, solid, outline) and two sizes.
react-aria-componentslucide-react
Soft
Salesforce sync runs every 15 minutes
Last sync 4 min ago · 2,318 accounts mapped.
Domain verified
Emails will now send from vantu.dev.
80% of AI credits used
Credits reset Oct 1. Upgrade to keep enriching.
HubSpot disconnected
Reconnect to resume syncing contacts.
import { Alert } from "@/components/ui/alert";
export default function Example() {
return (
<div className="flex w-full max-w-lg flex-col gap-3">
<Alert tone="info" title="Salesforce sync runs every 15 minutes">Last sync 4 min ago · 2,318 accounts mapped.</Alert>
<Alert tone="success" title="Domain verified">Emails will now send from vantu.dev.</Alert>
<Alert tone="warning" title="80% of AI credits used">Credits reset Oct 1. Upgrade to keep enriching.</Alert>
<Alert tone="error" title="HubSpot disconnected">Reconnect to resume syncing contacts.</Alert>
</div>
);
}Solid and outline with actions
Link actions and a dismiss button.
HubSpot disconnected
Contacts stopped syncing 2h ago.
ReconnectLearn more
AI research is here
Generate an account brief from 20+ sources in one click.
Try it
80% of AI credits used
Credits reset Oct 1.
Domain verified
Emails now send from vantu.dev.
"use client";
import { Alert } from "@/components/ui/alert";
import { LinkButton } from "@/components/ui/link-button";
export default function Example() {
return (
<div className="grid w-full max-w-3xl gap-3 md:grid-cols-2">
<Alert variant="solid" tone="error" title="HubSpot disconnected" onDismiss={() => {}} actions={<><LinkButton tone="black" size="sm" underline>Reconnect</LinkButton><LinkButton tone="black" size="sm">Learn more</LinkButton></>}>
Contacts stopped syncing 2h ago.
</Alert>
<Alert variant="outline" tone="feature" title="AI research is here" onDismiss={() => {}} actions={<LinkButton size="sm" underline>Try it</LinkButton>}>
Generate an account brief from 20+ sources in one click.
</Alert>
<Alert variant="soft" tone="warning" title="80% of AI credits used" onDismiss={() => {}}>
Credits reset Oct 1.
</Alert>
<Alert variant="solid" tone="success" title="Domain verified" onDismiss={() => {}}>
Emails now send from vantu.dev.
</Alert>
</div>
);
}Compact
Single 36px line for toolbars, forms and table headers.
Salesforce sync runs every 15 minutes.
Upgrade24 prospects enriched · 22 verified emails.
You’re close to your enrichment limit.
Upgrade2 emails bounced in “UK Revenue Leaders”.
UpgradeNew: AI research briefs.
Upgrade"use client";
import { Alert } from "@/components/ui/alert";
import { LinkButton } from "@/components/ui/link-button";
export default function Example() {
const action = () => (
<LinkButton tone="black" size="sm" underline>
Upgrade
</LinkButton>
);
return (
<div className="flex w-full max-w-xl flex-col gap-2">
<Alert size="sm" variant="solid" tone="info" title="Salesforce sync runs every 15 minutes." actions={action()} onDismiss={() => {}} />
<Alert size="sm" variant="soft" tone="success" title="24 prospects enriched · 22 verified emails." onDismiss={() => {}} />
<Alert size="sm" variant="soft" tone="warning" title="You’re close to your enrichment limit." actions={action()} onDismiss={() => {}} />
<Alert size="sm" variant="outline" tone="error" title="2 emails bounced in “UK Revenue Leaders”." actions={action()} onDismiss={() => {}} />
<Alert size="sm" variant="soft" tone="feature" title="New: AI research briefs." actions={action()} onDismiss={() => {}} />
</div>
);
}Installation
Components are copied into your project — no runtime package.
Install the following dependencies:
terminalnpm install react-aria-components lucide-reactCreate a
alert.tsxfile and paste the following code into it.src/components/ui/alert.tsx"use client"; import { AlertTriangle, CheckCircle2, Info, Sparkles, X, XCircle } from "lucide-react"; import type { ReactNode } from "react"; import { Button as AriaButton } from "react-aria-components"; import { cx } from "@/utils/cx"; export type StatusTone = "info" | "success" | "warning" | "error" | "feature"; export type AlertVariant = "soft" | "solid" | "outline"; const tones: Record<StatusTone, { soft: string; solid: string; icon: string; Icon: typeof Info }> = { info: { soft: "bg-info-soft border-info-border", solid: "bg-info", icon: "text-info", Icon: Info }, success: { soft: "bg-success-soft border-success-border", solid: "bg-success", icon: "text-success", Icon: CheckCircle2 }, warning: { soft: "bg-warning-soft border-warning-border", solid: "bg-warning", icon: "text-warning", Icon: AlertTriangle }, error: { soft: "bg-error-soft border-error-border", solid: "bg-error", icon: "text-error", Icon: XCircle }, feature: { soft: "bg-accent-soft border-accent-soft-border", solid: "bg-linear-to-b from-accent-light to-accent", icon: "text-accent", Icon: Sparkles }, }; export interface AlertProps { tone?: StatusTone; /** `soft` tinted surface (default) · `solid` filled · `outline` white with border and shadow. */ variant?: AlertVariant; /** `md` stacks title + description; `sm` is a single 36px line. */ size?: "sm" | "md"; title: ReactNode; children?: ReactNode; /** Inline actions, typically <LinkButton>s. */ actions?: ReactNode; /** Deprecated alias of `actions` kept for compatibility. */ action?: ReactNode; onDismiss?: () => void; className?: string; } /** Inline alert for sync issues, limits and compliance notes. Four tones + feature, three styles, two sizes. */ export function Alert({ tone = "info", variant = "soft", size = "md", title, children, actions, action, onDismiss, className }: AlertProps) { const t = tones[tone]; const solid = variant === "solid"; const acts = actions ?? action; const dismiss = onDismiss && ( <AriaButton aria-label="Dismiss" onPress={onDismiss} className={cx( "-m-0.5 inline-flex size-5 shrink-0 items-center justify-center rounded-xs outline-none data-focus-visible:shadow-focus", solid ? "text-white/70 data-hovered:text-white" : "text-fg-muted data-hovered:text-fg", )} > <X className="size-3.5" /> </AriaButton> ); return ( <div role={tone === "error" ? "alert" : "status"} className={cx( "flex gap-2.5 rounded-md", variant === "soft" && ["border", t.soft], variant === "outline" && "border border-line bg-surface shadow-card", solid && [t.solid, "text-white [&_a]:!text-white [&_[role=link]]:!text-white"], size === "sm" ? "min-h-9 items-center px-3 py-2" : "items-start px-3.5 py-3", className, )} > <t.Icon aria-hidden className={cx("size-4 shrink-0", size === "md" && "mt-px", solid ? "text-white" : t.icon)} /> {size === "sm" ? ( <> <div className={cx("min-w-0 flex-1 truncate text-sm font-medium", solid ? "text-white" : "text-fg")}>{title}</div> {acts} {dismiss} </> ) : ( <> <div className="min-w-0 flex-1"> <div className={cx("text-base font-medium", solid ? "text-white" : "text-fg")}>{title}</div> {children && <div className={cx("mt-0.5 text-sm", solid ? "text-white/80" : "text-fg-secondary")}>{children}</div>} {acts && <div className="mt-2.5 flex flex-wrap items-center gap-3">{acts}</div>} </div> {dismiss} </> )} </div> ); }Create a
link-button.tsxfile and paste the following code into it.src/components/ui/link-button.tsx"use client"; import type { ReactNode } from "react"; import { Link as AriaLink, type LinkProps as AriaLinkProps } from "react-aria-components"; import { cx } from "@/utils/cx"; export interface LinkButtonProps extends Omit<AriaLinkProps, "className" | "children"> { tone?: "gray" | "black" | "accent" | "error"; size?: "sm" | "md"; underline?: boolean; leadingIcon?: ReactNode; trailingIcon?: ReactNode; className?: string; children: ReactNode; } const tones = { gray: "text-fg-secondary data-hovered:text-fg", black: "text-fg data-hovered:text-fg-secondary", accent: "text-accent-text data-hovered:text-accent-pressed", error: "text-error-text data-hovered:text-error-hover", }; /** Inline text action. Underline on hover, or always with `underline`. */ export function LinkButton({ tone = "accent", size = "md", underline, leadingIcon, trailingIcon, className, children, ...props }: LinkButtonProps) { return ( <AriaLink {...props} className={cx( "inline-flex cursor-pointer items-center gap-1 rounded-xs font-medium underline-offset-[3px] outline-none transition-colors", "data-hovered:underline data-focus-visible:shadow-focus data-disabled:cursor-default data-disabled:text-fg-disabled data-disabled:no-underline", size === "md" ? "text-base [&_svg]:size-4" : "text-sm [&_svg]:size-3.5", underline && "underline decoration-current/40", tones[tone], className, )} > {leadingIcon} {children} {trailingIcon} </AriaLink> ); }Add the theme tokens and the
cxhelper from Installation if you haven’t yet, then update the import paths to match your project setup.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| tone | "info" | "success" | "warning" | "error" | "feature" | "info" | Status color and icon. |
| variant | "soft" | "solid" | "outline" | "soft" | Surface style. |
| size | "sm" | "md" | "md" | Single line or stacked. |
| actions | ReactNode | — | Inline link buttons. |
| onDismiss | () => void | — | Shows the close button. |