# Alert preview

Interactive preview of the CyberSpec Alert component. An inline notice on a spined frame: info, success, warning or danger, each with its own glyph.

[View Alert preview on CyberSpec](https://www.cyberspec.dev/preview/alert)

## About this preview

Alert belongs to the Data group in the CyberSpec catalog. It uses markup and CSS.

## Installation

Use a React 19 project with shadcn configured. Render the installed components inside the Cyber root, and import your global stylesheet in the app entry point.

```sh
bunx --bun shadcn@latest add https://www.cyberspec.dev/r/alert.json
```

## Example

```tsx
"use client"

import { Alert } from "@/components/ui/alert"
import { Button } from "@/components/ui/button"

export default function AlertDemo() {
  return (
    <>
      <Alert tone="info" title="Handshake complete">
        Vanta relay 3F:A2 accepted the key. Traffic is routed through Glasswater.
      </Alert>
      <Alert tone="success" title="Route cleared">
        Dex is parked two blocks out with the engine running.
      </Alert>
      <Alert
        tone="warning"
        title="Trace in progress"
        action={
          <Button size="sm" tone="flag">
            Reroute
          </Button>
        }
      >
        Someone on Meridian's side is walking the link back. About ninety seconds.
      </Alert>
      <Alert
        tone="danger"
        title="Deck overheating"
        action={
          <Button size="sm" tone="primary">
            Vent
          </Button>
        }
      >
        Core is at 96% of its thermal limit. Daemons will be dropped to protect the hardware.
      </Alert>
    </>
  )
}
```

## Install this example

```sh
bunx --bun shadcn@latest add https://www.cyberspec.dev/r/alert-demo.json
```

## Resources

- [Alert documentation](https://www.cyberspec.dev/components/sidebar/alert.md)
- [Component catalog](https://www.cyberspec.dev/components.md)
- [Alert source code](https://github.com/agnelnieves/cyberspec/blob/main/registry/cyber/ui/alert.tsx)
- [Shadcn registry item](https://www.cyberspec.dev/r/alert.json)
