Alert

Alerts display important messages to the user and can be dismissible or contain icons.

Alert Component Documentation

Simple alert with info styling

Complete Installation Guide

Comprehensive step-by-step instructions to install and use the Alertcomponent in your React/Next.js project with TypeScript and JavaScript support.

Step 1: Install Component

Description: Install the component using our CLI tool

Type: cli

TypeScript Installation Command:

npx screenui add alert --lang ts --path src/components

JavaScript Installation Command:

npx screenui add alert --lang js --path src/components

Step 2: Usage Example

Description: Copy and use the component in your project

Type: usage

TypeScript Implementation

Complete TypeScript code examples for the Alert component with full type safety, props interface, and implementation details.

File: Alert.tsx

Language: tsx

File Type: TypeScript React Component


import { Alert, AlertTitle, AlertDescription } from "@/components/Alert";
export function Example() {
  return (
    <Alert dismissible className="border-blue-500 text-blue-700">
      <AlertTitle>Info</AlertTitle>
      <AlertDescription>This is an informational alert.</AlertDescription>
    </Alert>
);
}

JavaScript Implementation

Complete JavaScript code examples for the Alert component with ES6+ syntax, modern React patterns, and compatibility notes.

File: Alert.jsx

Language: jsx

File Type: JavaScript React Component


import { Alert, AlertTitle, AlertDescription } from "@/components/Alert";
export function Example() {
  return (
    <Alert dismissible className="border-blue-500 text-blue-700">
      <AlertTitle>Info</AlertTitle>
      <AlertDescription>This is an informational alert.</AlertDescription>
    </Alert>
);
}

Required Dependencies and Prerequisites

The following packages and tools are required to use this component. Ensure all dependencies are installed and properly configured.

  • react - Core React library for component functionality
  • tailwindcss - Utility-first CSS framework for styling
  • lucide-react - Icon library for visual elements

Usage Examples and Best Practices

Practical examples and recommended patterns for implementing and customizing the Alert component in your React/Next.js application.

Basic Usage

Import and use the Alert component in your React components. The component supports both TypeScript and JavaScript projects.

Advanced Configuration

Customize the component with props, styling, event handlers, and advanced patterns as shown in the code examples above.

Integration Notes

This component is designed to work seamlessly with Next.js, Tailwind CSS, and modern React patterns. It supports server-side rendering, static generation, and client-side hydration.

Accessibility Features

The component includes built-in accessibility features such as ARIA labels, keyboard navigation, screen reader support, and focus management.

Performance Considerations

Optimized for performance with React.memo, efficient re-rendering, and minimal bundle impact. Supports code splitting and lazy loading.

Frequently Asked Questions

How do I customize the styling?

Use Tailwind CSS classes via the className prop, or apply custom CSS using CSS modules or styled-components.

Is this component accessible?

Yes, the component follows WCAG guidelines and includes proper ARIA attributes, keyboard navigation, and screen reader support.

Can I use this with other frameworks?

This component is designed for React/Next.js, but the patterns can be adapted for other frameworks like Vue.js or Angular.

Basic Alert

Feedbackv1.0.0

Simple alert with info styling

Last updated: 2025-09-19

Alert Examples

Alert Component Documentation

Alert component with filled variant and dismissible functionality.

Complete Installation Guide

Comprehensive step-by-step instructions to install and use the Alertcomponent in your React/Next.js project with TypeScript and JavaScript support.

Step 1: Usage Example

Description: Copy and use the component in your project

Type: usage

TypeScript Implementation

Complete TypeScript code examples for the Alert component with full type safety, props interface, and implementation details.

File: Alert.tsx

Language: tsx

File Type: TypeScript React Component


import { Alert, AlertTitle, AlertDescription } from "@/components/Alert";
export function Example() {
return (
<Alert 
  variant="filled" 
  className="bg-red-500 text-white" 
  dismissible
>
  <AlertTitle>Error</AlertTitle>
  <AlertDescription>Something went wrong!</AlertDescription>
</Alert>
);
}

JavaScript Implementation

Complete JavaScript code examples for the Alert component with ES6+ syntax, modern React patterns, and compatibility notes.

File: Alert.jsx

Language: jsx

File Type: JavaScript React Component


import { Alert, AlertTitle, AlertDescription } from "@/components/Alert";
export function Example() {
return (
<Alert 
  variant="filled" 
  className="bg-red-500 text-white" 
  dismissible
>
  <AlertTitle>Error</AlertTitle>
  <AlertDescription>Something went wrong!</AlertDescription>
</Alert>
);
}

Required Dependencies and Prerequisites

The following packages and tools are required to use this component. Ensure all dependencies are installed and properly configured.

  • react - Core React library for component functionality
  • tailwindcss - Utility-first CSS framework for styling
  • lucide-react - Icon library for visual elements

Usage Examples and Best Practices

Practical examples and recommended patterns for implementing and customizing the Alert component in your React/Next.js application.

Basic Usage

Import and use the Alert component in your React components. The component supports both TypeScript and JavaScript projects.

Advanced Configuration

Customize the component with props, styling, event handlers, and advanced patterns as shown in the code examples above.

Integration Notes

This component is designed to work seamlessly with Next.js, Tailwind CSS, and modern React patterns. It supports server-side rendering, static generation, and client-side hydration.

Accessibility Features

The component includes built-in accessibility features such as ARIA labels, keyboard navigation, screen reader support, and focus management.

Performance Considerations

Optimized for performance with React.memo, efficient re-rendering, and minimal bundle impact. Supports code splitting and lazy loading.

Frequently Asked Questions

How do I customize the styling?

Use Tailwind CSS classes via the className prop, or apply custom CSS using CSS modules or styled-components.

Is this component accessible?

Yes, the component follows WCAG guidelines and includes proper ARIA attributes, keyboard navigation, and screen reader support.

Can I use this with other frameworks?

This component is designed for React/Next.js, but the patterns can be adapted for other frameworks like Vue.js or Angular.

Alert with Dismiss

Feedbackv1.0.0

Alert component with filled variant and dismissible functionality.

Last updated: 2025-09-19

Alert Examples

Alert Component Documentation

Soft styled alert for less intrusive notifications

Complete Installation Guide

Comprehensive step-by-step instructions to install and use the Alertcomponent in your React/Next.js project with TypeScript and JavaScript support.

Step 1: Usage Example

Description: Copy and use the component in your project

Type: usage

TypeScript Implementation

Complete TypeScript code examples for the Alert component with full type safety, props interface, and implementation details.

File: Alert.tsx

Language: tsx

File Type: TypeScript React Component


import { Alert, AlertTitle, AlertDescription } from "@/components/Alert";
export function Example() {
return (
<Alert 
  variant="soft" 
  className="bg-green-100 text-green-800 border-green-200"
>
  <AlertTitle>Success</AlertTitle>
  <AlertDescription>Operation completed successfully.</AlertDescription>
</Alert>
);
}

JavaScript Implementation

Complete JavaScript code examples for the Alert component with ES6+ syntax, modern React patterns, and compatibility notes.

File: Alert.jsx

Language: jsx

File Type: JavaScript React Component


import { Alert, AlertTitle, AlertDescription } from "@/components/Alert";
export function Example() {
return (
<Alert 
  variant="soft" 
  className="bg-green-100 text-green-800 border-green-200"
>
  <AlertTitle>Success</AlertTitle>
  <AlertDescription>Operation completed successfully.</AlertDescription>
</Alert>
);
}

Required Dependencies and Prerequisites

The following packages and tools are required to use this component. Ensure all dependencies are installed and properly configured.

  • react - Core React library for component functionality
  • tailwindcss - Utility-first CSS framework for styling
  • lucide-react - Icon library for visual elements

Usage Examples and Best Practices

Practical examples and recommended patterns for implementing and customizing the Alert component in your React/Next.js application.

Basic Usage

Import and use the Alert component in your React components. The component supports both TypeScript and JavaScript projects.

Advanced Configuration

Customize the component with props, styling, event handlers, and advanced patterns as shown in the code examples above.

Integration Notes

This component is designed to work seamlessly with Next.js, Tailwind CSS, and modern React patterns. It supports server-side rendering, static generation, and client-side hydration.

Accessibility Features

The component includes built-in accessibility features such as ARIA labels, keyboard navigation, screen reader support, and focus management.

Performance Considerations

Optimized for performance with React.memo, efficient re-rendering, and minimal bundle impact. Supports code splitting and lazy loading.

Frequently Asked Questions

How do I customize the styling?

Use Tailwind CSS classes via the className prop, or apply custom CSS using CSS modules or styled-components.

Is this component accessible?

Yes, the component follows WCAG guidelines and includes proper ARIA attributes, keyboard navigation, and screen reader support.

Can I use this with other frameworks?

This component is designed for React/Next.js, but the patterns can be adapted for other frameworks like Vue.js or Angular.

Alert with Soft Variant

Feedbackv1.0.0

Soft styled alert for less intrusive notifications

Last updated: 2025-09-19

Alert Examples

Alert Component Documentation

Outlined alert with hover effects

Complete Installation Guide

Comprehensive step-by-step instructions to install and use the Alertcomponent in your React/Next.js project with TypeScript and JavaScript support.

Step 1: Usage Example

Description: Copy and use the component in your project

Type: usage

TypeScript Implementation

Complete TypeScript code examples for the Alert component with full type safety, props interface, and implementation details.

File: Alert.tsx

Language: tsx

File Type: TypeScript React Component


import { Alert, AlertTitle, AlertDescription } from "@/components/Alert";
export function Example() {
return (
<Alert 
  variant="outlined" 
  className="border-yellow-400 text-yellow-700 hover:bg-yellow-50"
>
  <AlertTitle>Warning</AlertTitle>
  <AlertDescription>Please review your settings.</AlertDescription>
</Alert>
);
}

JavaScript Implementation

Complete JavaScript code examples for the Alert component with ES6+ syntax, modern React patterns, and compatibility notes.

File: Alert.jsx

Language: jsx

File Type: JavaScript React Component


import { Alert, AlertTitle, AlertDescription } from "@/components/Alert";
export function Example() {
return (
<Alert 
  variant="outlined" 
  className="border-yellow-400 text-yellow-700 hover:bg-yellow-50"
>
  <AlertTitle>Warning</AlertTitle>
  <AlertDescription>Please review your settings.</AlertDescription>
</Alert>
);
}

Required Dependencies and Prerequisites

The following packages and tools are required to use this component. Ensure all dependencies are installed and properly configured.

  • react - Core React library for component functionality
  • tailwindcss - Utility-first CSS framework for styling
  • lucide-react - Icon library for visual elements

Usage Examples and Best Practices

Practical examples and recommended patterns for implementing and customizing the Alert component in your React/Next.js application.

Basic Usage

Import and use the Alert component in your React components. The component supports both TypeScript and JavaScript projects.

Advanced Configuration

Customize the component with props, styling, event handlers, and advanced patterns as shown in the code examples above.

Integration Notes

This component is designed to work seamlessly with Next.js, Tailwind CSS, and modern React patterns. It supports server-side rendering, static generation, and client-side hydration.

Accessibility Features

The component includes built-in accessibility features such as ARIA labels, keyboard navigation, screen reader support, and focus management.

Performance Considerations

Optimized for performance with React.memo, efficient re-rendering, and minimal bundle impact. Supports code splitting and lazy loading.

Frequently Asked Questions

How do I customize the styling?

Use Tailwind CSS classes via the className prop, or apply custom CSS using CSS modules or styled-components.

Is this component accessible?

Yes, the component follows WCAG guidelines and includes proper ARIA attributes, keyboard navigation, and screen reader support.

Can I use this with other frameworks?

This component is designed for React/Next.js, but the patterns can be adapted for other frameworks like Vue.js or Angular.

Alert with Outlined Variant

Feedbackv1.0.0

Outlined alert with hover effects

Last updated: 2025-09-19

Alert Examples

Usage Notes

Variants

  • default : Standard alert, use for general messages.
  • filled : Filled background, ideal for high-emphasis alerts.
  • outlined : Outline style, use for subtle alerts.
  • soft : Soft background for gentle emphasis.

Sizes

  • sm : Compact size, fits tight layouts like modals.
  • md : Default size for standard use.
  • lg : Larger size for prominent alerts.

Dismissible

To allow users to close the alert manually, use the dismissible prop.

<Alert dismissible>...</Alert>

With Icons

Add an icon before the content to visually indicate the alert type. Icons inherit colors from the user-defined classes.

<Alert>{<AlertCircle />} Message...</Alert>