Command Palette

Search for a command to run...

Docs
Smart Notify Button

Smart Notify Button

A button component that triggers customizable toast notifications with actions and different types.

Loading...

Installation

Props

PropTypeDefaultDescription
labelstring"Notify"The button label text
messagestring"This is a notification!"The toast notification message
descriptionstring""Additional description text
type"success" | "error" | "info""info"The notification type and icon
actionLabelstringundefinedLabel for action button in toast
actionCallback() => voidundefinedCallback function for action button
variant"default" | "outline" | "ghost""default"Button variant style
durationnumber4000Toast display duration in ms
positionany"top-right"Position of toast on screen

Features

  • Multiple Types: Success, error, and info notification types with appropriate icons
  • Action Support: Add action buttons to notifications with custom callbacks
  • Customizable Duration: Control how long notifications stay visible
  • Position Control: Choose where notifications appear on screen
  • Toast Integration: Uses Sonner for smooth toast animations
  • Button Variants: Support for different button styles

Usage

import SmartNotifyButton from "@/components/ui/smart-notify-button";
 
export default function Example() {
  return (
    <div className="space-y-4">
      {/* Basic notification */}
      <SmartNotifyButton />
 
      {/* Success notification with action */}
      <SmartNotifyButton
        label="Save Changes"
        message="Data saved successfully!"
        description="Your changes have been stored."
        type="success"
        actionLabel="Undo"
        actionCallback={() => console.log("Undo clicked")}
        position="bottom-left"
      />
 
      {/* Error notification */}
      <SmartNotifyButton
        label="Delete Item"
        message="Failed to delete item"
        type="error"
        variant="outline"
      />
    </div>
  );
}