Error Card

GitHub

Centered card for an error state with a status icon, label, and description for every HttpStatus, translation support, and manual overrides.

Installation

bash
pnpm dlx shadcn@latest add @cs/error-card

Usage

tsx
import { ErrorCard } from "@/components/cs/error-card"
import { HttpStatus } from "@/lib/cs/http-status"
tsx
<ErrorCard httpStatus={HttpStatus.NotFound} />

API Reference

ErrorCard

Centered card for an error state, with built-in icon, label, and description for every HttpStatus.

Props

NameTypeDefaultDescription
childrenReactNode-Content rendered below the description.
classNamestring-Additional CSS classes applied to the card.
descriptionReactNode-Card description. Takes precedence over translationsRootKey and httpStatus.
httpStatusHttpStatus-HTTP status used to look up a default label, description, and icon.
iconReactNode-Icon displayed above the title. Defaults to an icon matching httpStatus.
labelReactNode-Card title. Takes precedence over translationsRootKey and httpStatus.
translationsRootKeystring-Namespace used to resolve {httpStatus}label and {httpStatus}description keys, such as 404label and 404description. Takes precedence over the built-in httpStatus messages; missing keys are ignored.