### Basic Description List Example Source: https://catalyst.tailwindui.com/docs/description-list This example shows how to use the Description List components to create a basic list of terms and details. ```javascript import { DescriptionDetails, DescriptionList, DescriptionTerm } from '@/components/description-list' function Example() { return ( Customer Leslie Alexander Email leslie.alexander@example.com Access Admin ) } ``` -------------------------------- ### Install Heroicons React Package Source: https://catalyst.tailwindui.com/docs Install the Heroicons React package using npm. This is the first step to using Heroicons in your project. ```bash npm install @heroicons/react ``` ```bash npm install @heroicons/react ``` -------------------------------- ### Complete Sidebar Example Source: https://catalyst.tailwindui.com/docs/sidebar A full example demonstrating the integration of Sidebar, SidebarFooter, Dropdown, DropdownMenu, DropdownItem, and DropdownDivider components. This structure is useful for creating navigation panels with nested options. ```jsx function SidebarNavigation() { return ( Dashboard Analytics Projects Documents Teams
Denise Smith
denise.smith@example.com
Account settings Privacy policy Share feedback Sign out
) } ``` -------------------------------- ### Basic Dropdown Example Source: https://catalyst.tailwindui.com/docs/dropdown This example demonstrates a basic dropdown with options for viewing, editing, and deleting a user. It uses href for navigation and onClick for actions. Ensure the necessary components are imported. ```javascript import { Dropdown, DropdownButton, DropdownItem, DropdownMenu } from '@/components/dropdown' import { ChevronDownIcon } from '@heroicons/react/16/solid' function Example() { function deleteUser() { if (confirm('Are you sure you want to delete this user?')) { // ... } } return ( Options View Edit deleteUser()}>Delete ) } ``` -------------------------------- ### Install Catalyst Dependencies Source: https://catalyst.tailwindui.com/docs Install the necessary npm packages for Catalyst components. These include Headless UI, motion, and clsx. ```bash npm install @headlessui/react motion clsx ``` ```bash npm install @headlessui/react motion clsx ``` -------------------------------- ### Description List Example Source: https://catalyst.tailwindui.com/docs/description-list This snippet demonstrates the basic usage of the Description List component to display various details. ```javascript import { DescriptionDetails, DescriptionList, DescriptionTerm } from '@/components/description-list' function Example() { return ( Customer Michael Foster Event Bear Hug: Live in Concert Amount $150.00 USD Amount after exchange rate US$150.00 → CA$199.79 Fee $4.79 USD Net $1,955.00 ) } ``` -------------------------------- ### Basic Navbar Example Source: https://catalyst.tailwindui.com/docs/navbar Build a basic navbar with navigation links using Navbar, NavbarSection, and NavbarItem components. Ensure necessary components are imported. ```jsx import { Navbar, NavbarItem, NavbarSection } from '@/components/navbar' function Example() { return ( Home Events Orders ) } ``` ```jsx import { Navbar, NavbarItem, NavbarSection } from '@/components/navbar' function Example() { return ( Home Events Orders ) } ``` -------------------------------- ### Stacked Layout with Navbar and Sidebar Source: https://catalyst.tailwindui.com/docs/stacked-layout This example demonstrates how to use the StackedLayout component, integrating a Navbar with dropdowns and navigation items, and a Sidebar with similar navigation elements. It includes examples of avatars, dropdowns, and icons for a complete UI. ```jsx import { Avatar } from '@/components/avatar' import { Dropdown, DropdownButton, DropdownDivider, DropdownItem, DropdownLabel, DropdownMenu, } from '@/components/dropdown' import { Navbar, NavbarDivider, NavbarItem, NavbarLabel, NavbarSection, NavbarSpacer } from '@/components/navbar' import { Sidebar, SidebarBody, SidebarHeader, SidebarItem, SidebarLabel, SidebarSection } from '@/components/sidebar' import { StackedLayout } from '@/components/stacked-layout' import { ArrowRightStartOnRectangleIcon, ChevronDownIcon, Cog8ToothIcon, LightBulbIcon, PlusIcon, ShieldCheckIcon, UserIcon, } from '@heroicons/react/16/solid' import { InboxIcon, MagnifyingGlassIcon } from '@heroicons/react/20/solid' const navItems = [ { label: 'Home', url: '/' }, { label: 'Events', url: '/events' }, { label: 'Orders', url: '/orders' }, { label: 'Broadcasts', url: '/broadcasts' }, { label: 'Settings', url: '/settings' }, ] function TeamDropdownMenu() { return ( Settings Tailwind Labs Workcation New team… ) } function Example() { return ( Tailwind Labs {navItems.map(({ label, url }) => ( {label} ))} My profile Settings Privacy policy Share feedback Sign out } sidebar={ Tailwind Labs {navItems.map(({ label, url }) => ( {label} ))} } > {children} ) } ``` -------------------------------- ### Basic Listbox Example Source: https://catalyst.tailwindui.com/docs/listbox This is a basic example of the Listbox component. Ensure you provide an aria-label for accessibility or connect the Listbox to a label using an id. ```javascript import { Listbox, ListboxLabel, ListboxOption } from '@/components/listbox' function Example() { return ( Active Paused Delayed Canceled ) } ``` -------------------------------- ### Sidebar with Sticky Footer Example Source: https://catalyst.tailwindui.com/docs/sidebar Use the `SidebarFooter` component after the `SidebarBody` component to add a sticky footer to the sidebar. This example shows a typical sidebar navigation with a user profile in the footer. ```jsx import { Avatar } from '@/components/avatar' import { Sidebar, SidebarBody, SidebarFooter, SidebarItem, SidebarLabel, SidebarSection } from '@/components/sidebar' import { ChevronRightIcon } from '@heroicons/react/16/solid' import { Cog6ToothIcon, HomeIcon, MegaphoneIcon, Square2StackIcon, TicketIcon } from '@heroicons/react/20/solid' function Example() { return ( Home Events Orders Broadcasts Settings Erica ) } ``` -------------------------------- ### Badge Colors Example Source: https://catalyst.tailwindui.com/docs/badge Demonstrates how to use the `color` prop to set different colors for badges. This is useful for categorizing or highlighting information. ```javascript import { Badge } from '@/components/badge' function Example() { return (
documentation help wanted bug
) } ``` -------------------------------- ### Basic Alert Example Source: https://catalyst.tailwindui.com/docs/alert Demonstrates how to use the Alert component with a title, description, and action buttons. Use this to prompt user confirmation for critical actions. ```javascript import { Alert, AlertActions, AlertDescription, AlertTitle } from '@/components/alert' import { Button } from '@/components/button' import { useState } from 'react' function Example() { let [isOpen, setIsOpen] = useState(false) return ( <> Are you sure you want to refund this payment? The refund will be reflected in the customer’s bank account 2 to 3 business days after processing. ) } ``` -------------------------------- ### Basic Combobox Example Source: https://catalyst.tailwindui.com/docs/combobox A fundamental example of the Combobox component, showcasing its core functionality for selecting an item. Ensure an aria-label or a connected label is provided for accessibility. ```jsx import { Combobox, ComboboxLabel, ComboboxOption } from '@/components/combobox' function Example({ currentUser, users }) { return ( user?.name} defaultValue={currentUser} aria-label="Assigned to" > {(user) => ( {user.name} )} ) } ``` ```jsx import { Combobox, ComboboxLabel, ComboboxOption } from '@/components/combobox' function Example({ currentUser, users }) { return ( user?.name} defaultValue={currentUser} aria-label="Assigned to" > {(user) => ( {user.name} )} ) } ``` -------------------------------- ### Badge Button Example Source: https://catalyst.tailwindui.com/docs/badge Shows how to render a badge as a clickable button using the `BadgeButton` component. This is suitable for interactive elements. ```javascript import { BadgeButton } from '@/components/badge' function Example() { return documentation } ``` -------------------------------- ### Basic Table Example Source: https://catalyst.tailwindui.com/docs/table This snippet demonstrates how to use the Table component with its sub-components to render a list of users. Ensure the necessary components are imported from '@/components/table'. ```jsx import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@/components/table' function Example({ users }) { return ( Name Email Role {users.map((user) => ( {user.name} {user.email} {user.access} ))}
) } ``` -------------------------------- ### Basic Fieldset Example Source: https://catalyst.tailwindui.com/docs/fieldset This example demonstrates a basic fieldset for shipping details, including street address, country selection, and delivery notes. It utilizes various form control components within the fieldset structure. ```jsx import { Description, Field, FieldGroup, Fieldset, Label, Legend } from '@/components/fieldset' import { Input } from '@/components/input' import { Select } from '@/components/select' import { Text } from '@/components/text' import { Textarea } from '@/components/textarea' function Example() { return (
{/* ... */}
Shipping details Without this your odds of getting your order are low. We currently only ship to North America.