Clidey UXDocs

Alert

Alert displays contextual messages such as informational notices, warnings, or error states inline on the page — without blocking interaction.

Interactive example#

Alert · Live example

Switch between an informative message and a failure with a recovery action.

The code uses shared demo presentation helpers. Their complete source and styling are included in the LLM build context.

Import#

TSX

import { Alert, AlertTitle, AlertDescription } from '@clidey/ux';

Variants#

TSX

<Alert>
  <AlertTitle>Heads up</AlertTitle>
  <AlertDescription>
    Your trial ends in 3 days. Upgrade to keep access.
  </AlertDescription>
</Alert>

<Alert variant="destructive">
  <AlertTitle>Payment failed</AlertTitle>
  <AlertDescription>
    We couldn't process your payment. Please update your billing details.
  </AlertDescription>
</Alert>
VariantUse case
defaultInformational notices, system messages
destructiveErrors, failures, or critical warnings

With an icon#

TSX

import { IconWarning as AlertTriangle, IconInfo as Info } from '@clidey/ux';

<Alert>
  <Info className="size-4" />
  <AlertTitle>New feature available</AlertTitle>
  <AlertDescription>
    You can now export reports as CSV. Check it out in the Reports section.
  </AlertDescription>
</Alert>

<Alert variant="destructive">
  <AlertTriangle className="size-4" />
  <AlertTitle>Error</AlertTitle>
  <AlertDescription>
    The server returned a 500 error. Please try again later.
  </AlertDescription>
</Alert>

Dynamic alerts#

TSX

import { Alert, AlertTitle, AlertDescription } from '@clidey/ux';

type AlertProps = {
  type: 'success' | 'error' | 'info';
  message: string;
};

function StatusAlert({ type, message }: AlertProps) {
  return (
    <Alert variant={type === 'error' ? 'destructive' : 'default'}>
      <AlertTitle className="capitalize">{type}</AlertTitle>
      <AlertDescription>{message}</AlertDescription>
    </Alert>
  );
}

Form error example#

TSX

function RegisterForm() {
  const [error, setError] = useState('');

  return (
    <form className="space-y-4">
      {error && (
        <Alert variant="destructive">
          <AlertTitle>Registration failed</AlertTitle>
          <AlertDescription>{error}</AlertDescription>
        </Alert>
      )}
      {/* form fields */}
    </form>
  );
}

Props#

Alert

PropTypeDefaultDescription
variant"default" | "destructive""default"Visual style.
classNamestring—Additional CSS classes.
childrenReactNode—AlertTitle and/or AlertDescription.
rolestring"alert"ARIA role. Announces to screen readers.

AlertTitle

PropTypeDescription
classNamestringAdditional CSS classes.
childrenReactNodeTitle text.

AlertDescription

PropTypeDescription
classNamestringAdditional CSS classes.
childrenReactNodeDescription text or elements.

Was this page helpful?