8
Components

Sonner Toaster

A customizable and accessible notification system for displaying toasts.

Introduction

The Sonner Toaster is an accessible notification component built with the sonner library. It provides customizable toast styles and themes, and it integrates seamlessly with next-themes.


Example: Success Toast


Installation

Install the sonner component:

npx axionjs-ui add sonner

File Structure

toaster.tsx

Features

  • Custom Variants:
    • Includes default, success, warning, destructive, and info.
  • Dark and Light Themes:
    • Integrates with next-themes to automatically adjust theme.
  • Custom Styling:
    • Flexible customization using Tailwind utilities.

Conclusion

The Sonner Toaster component offers a flexible, accessible, and easy-to-use notification system. Its integration with next-themes and support for multiple variants make it a robust choice for React applications.

On this page