Components/AI
Tag Button
Interactive tag button with dropdown support, smooth animations, and customizable variants
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
Prop | Type | Default | Description |
---|---|---|---|
icon | ReactNode | undefined | Icon to display next to the title |
title | string | "" | Text displayed on the button |
variant | "default" | "outline" | "ghost" | "default" | Visual style variant of the button |
onClick | () => void | undefined | Callback when the button is clicked |
items | string[] | [] | Array of items to display in the dropdown |
onItemClick | (item: string) => void | undefined | Callback 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