--- name: heroui-components description: Add or customize HeroUI components in the web application. Use when implementing new UI features with HeroUI design system or updating component styling. allowed-tools: Read, Edit, Write, mcp__heroui-react__list_components, mcp__heroui-react__get_component_info, mcp__heroui-react__get_component_examples --- # HeroUI Components Skill This skill helps you work with HeroUI (Hero UI / NextUI v3) components in `apps/web/`. ## When to Use This Skill - Adding new HeroUI components to pages - Customizing HeroUI component variants - Implementing forms with HeroUI inputs - Creating modal dialogs and drawers - Building navigation with HeroUI components - Debugging HeroUI styling issues ## HeroUI Overview HeroUI is a modern React UI library built on Tailwind CSS and React Aria, providing accessible components. ## Discovery and Research ### List Available Components ```typescript // Use MCP tool to discover components mcp__heroui-react__list_components() ``` ### Get Component Information ```typescript // Get details about a specific component mcp__heroui-react__get_component_info({ component: "Button" }) mcp__heroui-react__get_component_info({ component: "Input" }) ``` ### Get Usage Examples ```typescript // Get examples for a component mcp__heroui-react__get_component_examples({ component: "Modal" }) ``` ## Installation and Setup HeroUI is already installed in the web app. Import from `@heroui/react`: ```typescript import { Button, Input, Card } from "@heroui/react"; ``` ## Common Components ### 1. Button Component ```typescript import { Button } from "@heroui/react"; export function ActionButton() { return ( <> {/* Basic button */} {/* Color variants */} {/* Size variants */} {/* Variants */} {/* With icon */} {/* Loading state */} {/* Disabled */} ); } ``` ### 2. Input Component ```typescript import { Input } from "@heroui/react"; export function SearchForm() { return ( <> {/* Basic input */} {/* With validation */} {/* With start/end content */} $} endContent={SGD} /> {/* Variants */} {/* Colors */} ); } ``` ### 3. Card Component ```typescript import { Card, CardHeader, CardBody, CardFooter, Button } from "@heroui/react"; export function CarCard({ car }: { car: Car }) { return (

{car.make}

{car.model}

Year: {car.year}

Price: ${car.price?.toLocaleString()}

); } ``` ### 4. Modal Component ```typescript "use client"; import { Modal, ModalContent, ModalHeader, ModalBody, ModalFooter, Button, useDisclosure, } from "@heroui/react"; export function CarDetailsModal({ car }: { car: Car }) { const { isOpen, onOpen, onOpenChange } = useDisclosure(); return ( <> {(onClose) => ( <> {car.make} {car.model}

Year: {car.year}

Registration: {car.registrationDate}

Fuel Type: {car.fuelType}

)}
); } ``` ### 5. Table Component ```typescript import { Table, TableHeader, TableColumn, TableBody, TableRow, TableCell, } from "@heroui/react"; export function CarTable({ cars }: { cars: Car[] }) { return ( MAKE MODEL YEAR PRICE {cars.map((car) => ( {car.make} {car.model} {car.year} ${car.price?.toLocaleString()} ))}
); } ``` ### 6. Tabs Component ```typescript import { Tabs, Tab } from "@heroui/react"; export function DataTabs() { return ( ); } ``` ### 7. Select Component ```typescript import { Select, SelectItem } from "@heroui/react"; export function CarMakeSelector() { const makes = ["Toyota", "Honda", "BMW", "Mercedes"]; return ( ); } ``` ### 8. Dropdown Component ```typescript import { Dropdown, DropdownTrigger, DropdownMenu, DropdownItem, Button, } from "@heroui/react"; export function ActionsDropdown() { return ( View Edit Delete ); } ``` ## Form Handling ### Complete Form Example ```typescript "use client"; import { useState } from "react"; import { Input, Button, Textarea } from "@heroui/react"; import { createBlogPost } from "@/actions/blog"; export function CreatePostForm() { const [isLoading, setIsLoading] = useState(false); async function handleSubmit(e: React.FormEvent) { e.preventDefault(); setIsLoading(true); const formData = new FormData(e.currentTarget); const result = await createBlogPost(formData); setIsLoading(false); if (result.success) { // Handle success } } return (