Game One

Alert

Inline alert surface for success, warning, and destructive messaging.

Installation

npx shadcn@latest add @gameone/alert

Registry dependencies: gameone-utils

Usage

Import
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"
Example
<Alert>
  <AlertTitle>Heads up</AlertTitle>
  <AlertDescription>
    Important information goes here.
  </AlertDescription>
</Alert>

Examples

Default

import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"

export function AlertDefault() {
  return (
    <Alert>
      <AlertTitle>Heads up</AlertTitle>
      <AlertDescription>This is a default alert.</AlertDescription>
    </Alert>
  )
}

Destructive

import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"

export function AlertDestructive() {
  return (
    <Alert variant="destructive">
      <AlertTitle>Error</AlertTitle>
      <AlertDescription>Something went wrong.</AlertDescription>
    </Alert>
  )
}

Success

import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"

export function AlertSuccess() {
  return (
    <Alert variant="success">
      <AlertTitle>Success</AlertTitle>
      <AlertDescription>Your changes have been saved.</AlertDescription>
    </Alert>
  )
}

Warning

import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"

export function AlertWarning() {
  return (
    <Alert variant="warning">
      <AlertTitle>Warning</AlertTitle>
      <AlertDescription>Please review before continuing.</AlertDescription>
    </Alert>
  )
}

Info

import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"

export function AlertInfo() {
  return (
    <Alert variant="info">
      <AlertTitle>Note</AlertTitle>
      <AlertDescription>This is an informational message.</AlertDescription>
    </Alert>
  )
}