Components/AI

Tag Button

Interactive tag button with dropdown support, smooth animations, and customizable variants

Live Preview
Open in

Example

export default function TagButtonExample() {
  const items = [
    "JavaScript",
    "Python", 
    "Java",
    "C++",
    "Go",
    "Rust",
  ]

  const handleItemClick = (item: string) => {
    console.log('Selected item:', item)
  }

  const handleClick = () => {
    console.log('Button clicked')
  }

  return (
    <TagButton
      title="Programming Languages"
      variant="default"
      items={items}
      onItemClick={handleItemClick}
      onClick={handleClick}
 
    />
  )
}

Documentation

PropTypeDefaultDescription
iconReactNodeundefinedIcon to display next to the title
titlestring""Text displayed on the button
variant"default" | "outline" | "ghost""default"Visual style variant of the button
onClick() => voidundefinedCallback when the button is clicked
itemsstring[][]Array of items to display in the dropdown
onItemClick(item: string) => voidundefinedCallback when an item is clicked

Types

interface TagButtonProps {
  icon?: ReactNode;
  title: string;
  variant: "default" | "outline" | "ghost";
  onClick?: () => void;
  items?: string[];
  onItemClick?: (item: string) => void;
}

Features

  • Dropdown Support: Expandable dropdown with smooth animations
  • Multiple Variants: Default, outline, and ghost button styles
  • Item Selection: Click to select items with visual feedback
  • Custom Icons: Support for custom icons for each item
  • Smooth Animations: Framer Motion powered animations
  • Responsive Design: Adapts to different screen sizes with proper scaling
  • Dark Mode Support: Full dark mode compatibility with appropriate styling
  • Accessibility Focused: Proper ARIA labels and keyboard navigation support