Measured entry

shadcn-alert

alertunclassified

A small React alert primitive shipped as TypeScript source, with separate container, title, and description exports plus default and destructive variants. It depends on class-variance-authority, a local cn helper, and the Tailwind theme utilities used by the shadcn styling system.

Specimen
Harness screenshot of shadcn-alert at 375 pixels wide
Harness screenshot at 375 pixels wide. No horizontal overflow recorded.
Harness screenshot of shadcn-alert at 768 pixels wide
Harness screenshot at 768 pixels wide. No horizontal overflow recorded.
Harness screenshot of shadcn-alert at 1440 pixels wide
Harness screenshot at 1440 pixels wide. No horizontal overflow recorded.

Measured

Every value below was written by the harness on the run that produced the frames above. None of it is derived from the prose.

Harness measurements recorded for shadcn-alert
BuildOK
MountOK
Console errors0
Uncaught page errors0
Horizontal overflowclean at 375, 768, 1440
Axe critical0
Axe serious0
Axe moderate0
Axe minor0
Gzip marginal12.5 KB (77.1 KB build, 64.6 KB baseline)
Bare modeFAIL
Provider requiredNO
Demo usedwritten from the component source API

What the harness recorded

BARE BUILD

✗ Build failed in 926ms
error during build:
[vite]: Rollup failed to resolve import "class-variance-authority" from "<sandbox>/src/cut/components/ui/alert.tsx".

Verdict

A solid, focused alert primitive for an existing shadcn codebase. It builds, mounts, and adapts cleanly in the prepared harness, but it needs a shadcn-style setup and does not work as a bare copy because its variant helper and local styling utilities are assumed.

Use it if

  • You need an inline status or error notice with a built-in alert role.
  • Your app already uses shadcn conventions and Tailwind theme tokens.
  • You want source-owned markup that can accept custom classes and optional icons.

Skip it if

  • You need dismiss, action, timeout, or toast behavior without building it yourself.
  • Your project does not use Tailwind utilities or shadcn theme tokens.
  • You want a dependency-free component that can be copied into a bare React app.

Install

Installation record for shadcn-alert
Declared dependenciesnone declared
Missing on installnone
Bare installfails once the shadcn-style helpers are removed, so it needs that setup
Providerno provider required in the harness

In a non-shadcn project, add class-variance-authority, provide the cn class-merging helper and its import alias, configure Tailwind to scan the component, and define the card, foreground, destructive, border, and muted theme utilities it references.

Source and credit

This page is a review, not a copy. The component source lives with its author and this site does not republish it. Read the license before you use anything.

Author repository

github.com/shadcn-ui/ui
License
MIT
Record published
2026-08-12

Alternatives

Other published entries for the alert pattern, ordered by what they measured: mounts first, then clean axe scans, then bare-mode passes, then the smaller bundle.