Skip to content
NewService Map: 30 components for hosts, ports and routes
<PxAlert />ReactActions & feedbackFree

Inline alert

Inline alert in four tones with a pixel icon and a glowing stripe; dismissing scatters the stripe and collapses the alert.

View as Markdown
<PxAlert />

Playground

Change a prop and the component re-renders. Props marked remounts set an initial value, so the component starts over.

Loading <PxAlert />
Props
typelive
headinglive
dismissiblelive
React
<PxAlert type="warning" heading="Usage at 85%" dismissible>You’ve used most of this week’s limit.</PxAlert>

Installation

pnpm dlx shadcn@latest add @lumesec/px-alert
First timeRegister the @lumesec registry once, or install by URL+

Adds @lumesec to your components.json:

pnpm dlx shadcn@latest registry add @lumesec=https://elements.lumesec.ai/r/{name}.json

Or skip the setup and install by URL:

npx shadcn@latest add https://elements.lumesec.ai/r/px-alert.json

Usage

px-alert-example.tsx
import { PxAlert } from "@/components/lumesec/px-alert";

export function Example() {
  return (
    <PxAlert type="warning" heading="Usage at 85%" dismissible>
      You’ve used most of this week’s limit.
    </PxAlert>
  );
}

Behaviour

Info, success, warning and error, each with a pixel icon and a glowing stripe. Dismissing scatters the stripe and collapses the alert.

API reference

Props

Also accepts every prop of <div> (React.ComponentProps<"div">), spread onto the root element.

openTypeboolean

Controlled visibility. Use with onOpenChange; turning it off plays the dismiss animation before the alert hides.

defaultOpenTypebooleanDefaulttrue

Initial visibility when uncontrolled.

typeType"info" | "success" | "warning" | "error"Default"info"

Colour, icon and ARIA role.

headingTypeReact.ReactNode

Bold title above the message; left out when empty.

childrenTypeReact.ReactNode

The message.

dismissibleTypebooleanDefaultfalse

Shows a dismiss button.

onOpenChangeType(open: boolean) => void

Called with false when the dismiss button is pressed.

Ref

ref points at the root HTMLDivElement.

Accessibility

  • error and warning alerts have role="alert"; info and success alerts have role="status".
  • The dismiss button is a native button labelled "Dismiss".
  • The icon and stripe are drawn on an aria-hidden canvas; the tone is not conveyed as text.
  • Once dismissed the root is hidden and leaves the accessibility tree.
  • Reduced motion: the stripe glow stops, and dismissing hides the alert at once without scattering pixels.

Theming

Styled with Tailwind classes on your shadcn theme tokens, so light and dark follow your theme. The accent comes from --lumesec. See Theming.

This component reads --lumesec, --lumesec-shine, --lumesec-success, --lumesec-warning, --destructive, --border, --card, --foreground and --muted-foreground.

Notes

  • Uncontrolled alerts stay hidden after dismissal; control open to show one again.
  • The root carries data-state="open" or data-state="closed" and data-type.

Was this page helpful?