# Starwind UI > Starwind UI is a layered UI system with styled components, Primitive adapters, a framework-agnostic Runtime, and a raw HTML surface. ## Choose A Usage Surface - [Styled Components](https://starwind.dev/docs/components/): User-facing styled components with Starwind visual defaults, slots, variants, framework availability, and Behavior Foundation metadata. - [Primitive Adapters](https://starwind.dev/docs/primitives/): Framework-specific unstyled adapter packages that render Runtime primitive anatomy for Astro and React. - [Runtime](https://starwind.dev/docs/runtime/): Framework-agnostic behavior controllers, create* factories, lifecycle cleanup, and theme helpers. - [Raw HTML Surface](https://starwind.dev/docs/runtime/#raw-html): Direct DOM usage where authors provide data-sw-* markup and initialize behavior with initStarwind or create* factories. Styled component pages document their additional styled API first, including variants, wrapper props, defaults, and inheritance. They then link to the Primitive and Runtime API for behavior, state, events, form participation, and imperative setters. Behavior Foundation metadata explains the relationship between those layers. Check framework availability before recommending a component. ## CLI Essentials `starwind init` configures a project. `starwind migrate` moves a legacy Astro project to Runtime-backed styled components. Use `starwind add `, `starwind update `, `starwind docs `, and `starwind search ` for styled components. Use `starwind primitives add `, `starwind primitives update `, `starwind primitives list`, and `starwind search --primitives` for vendored Primitive source. Runtime and framework adapter packages remain package-manager dependencies. ## Installable Styled Components - [Accordion](https://starwind.dev/docs/components/accordion/) ([Markdown](https://starwind.dev/docs/components/accordion.md)): Direct primitive; Astro available; React available; 4 documented styled exports. - [Alert](https://starwind.dev/docs/components/alert/) ([Markdown](https://starwind.dev/docs/components/alert.md)): Styled only; Astro available; React available; 3 documented styled exports. - [Alert Dialog](https://starwind.dev/docs/components/alert-dialog/) ([Markdown](https://starwind.dev/docs/components/alert-dialog.md)): Direct primitive; Astro available; React available; 9 documented styled exports. - [Aspect Ratio](https://starwind.dev/docs/components/aspect-ratio/) ([Markdown](https://starwind.dev/docs/components/aspect-ratio.md)): Styled only; Astro available; React available; 1 documented styled export. - [Avatar](https://starwind.dev/docs/components/avatar/) ([Markdown](https://starwind.dev/docs/components/avatar.md)): Direct primitive; Astro available; React available; 3 documented styled exports. - [Badge](https://starwind.dev/docs/components/badge/) ([Markdown](https://starwind.dev/docs/components/badge.md)): Styled only; Astro available; React available; 1 documented styled export. - [Breadcrumb](https://starwind.dev/docs/components/breadcrumb/) ([Markdown](https://starwind.dev/docs/components/breadcrumb.md)): Styled only; Astro available; React available; 7 documented styled exports. - [Button](https://starwind.dev/docs/components/button/) ([Markdown](https://starwind.dev/docs/components/button.md)): Mixed conditional; Astro available; React available; 1 documented styled export. - [Button Group](https://starwind.dev/docs/components/button-group/) ([Markdown](https://starwind.dev/docs/components/button-group.md)): Styled only; Astro available; React available; 3 documented styled exports. - [Card](https://starwind.dev/docs/components/card/) ([Markdown](https://starwind.dev/docs/components/card.md)): Styled only; Astro available; React available; 7 documented styled exports. - [Carousel](https://starwind.dev/docs/components/carousel/) ([Markdown](https://starwind.dev/docs/components/carousel.md)): Direct primitive; Astro available; React available; 5 documented styled exports. - [Checkbox](https://starwind.dev/docs/components/checkbox/) ([Markdown](https://starwind.dev/docs/components/checkbox.md)): Direct primitive; Astro available; React available; 1 documented styled export. - [Checkbox Group](https://starwind.dev/docs/components/checkbox-group/) ([Markdown](https://starwind.dev/docs/components/checkbox-group.md)): Direct primitive; Astro available; React available; 1 documented styled export. - [Collapsible](https://starwind.dev/docs/components/collapsible/) ([Markdown](https://starwind.dev/docs/components/collapsible.md)): Direct primitive; Astro available; React available; 3 documented styled exports. - [Color Picker](https://starwind.dev/docs/components/color-picker/) ([Markdown](https://starwind.dev/docs/components/color-picker.md)): Direct primitive; Astro available; React available; 12 documented styled exports. - [Combobox](https://starwind.dev/docs/components/combobox/) ([Markdown](https://starwind.dev/docs/components/combobox.md)): Direct primitive; Astro available; React available; 15 documented styled exports. - [Context Menu](https://starwind.dev/docs/components/context-menu/) ([Markdown](https://starwind.dev/docs/components/context-menu.md)): Direct primitive; Astro available; React available; 16 documented styled exports. - [Dialog](https://starwind.dev/docs/components/dialog/) ([Markdown](https://starwind.dev/docs/components/dialog.md)): Direct primitive; Astro available; React available; 8 documented styled exports. - [Dropdown](https://starwind.dev/docs/components/dropdown/) ([Markdown](https://starwind.dev/docs/components/dropdown.md)): Renamed primitive; Astro available; React available; 17 documented styled exports. - [Dropzone](https://starwind.dev/docs/components/dropzone/) ([Markdown](https://starwind.dev/docs/components/dropzone.md)): Direct primitive; Astro available; React available; 4 documented styled exports. - [Field](https://starwind.dev/docs/components/field/) ([Markdown](https://starwind.dev/docs/components/field.md)): Composite; Astro available; React available; 13 documented styled exports. - [Form](https://starwind.dev/docs/components/form/) ([Markdown](https://starwind.dev/docs/components/form.md)): Direct primitive; Astro available; React available; 2 documented styled exports. - [Hover Card](https://starwind.dev/docs/components/hover-card/) ([Markdown](https://starwind.dev/docs/components/hover-card.md)): Renamed primitive; Astro available; React available; 3 documented styled exports. - [Image](https://starwind.dev/docs/components/image/) ([Markdown](https://starwind.dev/docs/components/image.md)): Styled only; Astro available; React framework native; 1 documented styled export. - [Input](https://starwind.dev/docs/components/input/) ([Markdown](https://starwind.dev/docs/components/input.md)): Direct primitive; Astro available; React available; 1 documented styled export. - [Input Group](https://starwind.dev/docs/components/input-group/) ([Markdown](https://starwind.dev/docs/components/input-group.md)): Styled only; Astro available; React available; 6 documented styled exports. - [Input Otp](https://starwind.dev/docs/components/input-otp/) ([Markdown](https://starwind.dev/docs/components/input-otp.md)): Direct primitive; Astro available; React available; 4 documented styled exports. - [Item](https://starwind.dev/docs/components/item/) ([Markdown](https://starwind.dev/docs/components/item.md)): Styled only; Astro available; React available; 10 documented styled exports. - [Kbd](https://starwind.dev/docs/components/kbd/) ([Markdown](https://starwind.dev/docs/components/kbd.md)): Styled only; Astro available; React available; 2 documented styled exports. - [Label](https://starwind.dev/docs/components/label/) ([Markdown](https://starwind.dev/docs/components/label.md)): Styled only; Astro available; React available; 1 documented styled export. - [Native Select](https://starwind.dev/docs/components/native-select/) ([Markdown](https://starwind.dev/docs/components/native-select.md)): Styled only; Astro available; React available; 3 documented styled exports. - [Navigation Menu](https://starwind.dev/docs/components/navigation-menu/) ([Markdown](https://starwind.dev/docs/components/navigation-menu.md)): Direct primitive; Astro available; React available; 8 documented styled exports. - [Pagination](https://starwind.dev/docs/components/pagination/) ([Markdown](https://starwind.dev/docs/components/pagination.md)): Styled only; Astro available; React available; 7 documented styled exports. - [Popover](https://starwind.dev/docs/components/popover/) ([Markdown](https://starwind.dev/docs/components/popover.md)): Direct primitive; Astro available; React available; 6 documented styled exports. - [Progress](https://starwind.dev/docs/components/progress/) ([Markdown](https://starwind.dev/docs/components/progress.md)): Direct primitive; Astro available; React available; 1 documented styled export. - [Prose](https://starwind.dev/docs/components/prose/) ([Markdown](https://starwind.dev/docs/components/prose.md)): Styled only; Astro available; React available; 1 documented styled export. - [Radio Group](https://starwind.dev/docs/components/radio-group/) ([Markdown](https://starwind.dev/docs/components/radio-group.md)): Composite; Astro available; React available; 2 documented styled exports. - [Scroll Area](https://starwind.dev/docs/components/scroll-area/) ([Markdown](https://starwind.dev/docs/components/scroll-area.md)): Direct primitive; Astro available; React available; 6 documented styled exports. - [Select](https://starwind.dev/docs/components/select/) ([Markdown](https://starwind.dev/docs/components/select.md)): Direct primitive; Astro available; React available; 12 documented styled exports. - [Separator](https://starwind.dev/docs/components/separator/) ([Markdown](https://starwind.dev/docs/components/separator.md)): Styled only; Astro available; React available; 1 documented styled export. - [Sheet](https://starwind.dev/docs/components/sheet/) ([Markdown](https://starwind.dev/docs/components/sheet.md)): Renamed primitive; Astro available; React available; 8 documented styled exports. - [Sidebar](https://starwind.dev/docs/components/sidebar/) ([Markdown](https://starwind.dev/docs/components/sidebar.md)): Direct primitive; Astro available; React available; 23 documented styled exports. - [Skeleton](https://starwind.dev/docs/components/skeleton/) ([Markdown](https://starwind.dev/docs/components/skeleton.md)): Styled only; Astro available; React available; 1 documented styled export. - [Slider](https://starwind.dev/docs/components/slider/) ([Markdown](https://starwind.dev/docs/components/slider.md)): Direct primitive; Astro available; React available; 1 documented styled export. - [Spinner](https://starwind.dev/docs/components/spinner/) ([Markdown](https://starwind.dev/docs/components/spinner.md)): Styled only; Astro available; React available; 1 documented styled export. - [Switch](https://starwind.dev/docs/components/switch/) ([Markdown](https://starwind.dev/docs/components/switch.md)): Direct primitive; Astro available; React available; 1 documented styled export. - [Table](https://starwind.dev/docs/components/table/) ([Markdown](https://starwind.dev/docs/components/table.md)): Styled only; Astro available; React available; 8 documented styled exports. - [Tabs](https://starwind.dev/docs/components/tabs/) ([Markdown](https://starwind.dev/docs/components/tabs.md)): Direct primitive; Astro available; React available; 4 documented styled exports. - [Textarea](https://starwind.dev/docs/components/textarea/) ([Markdown](https://starwind.dev/docs/components/textarea.md)): Styled only; Astro available; React available; 1 documented styled export. - [Theme Toggle](https://starwind.dev/docs/components/theme-toggle/) ([Markdown](https://starwind.dev/docs/components/theme-toggle.md)): Styled only; Astro available; React available; 1 documented styled export. - [Toast](https://starwind.dev/docs/components/toast/) ([Markdown](https://starwind.dev/docs/components/toast.md)): Direct primitive; Astro available; React available; 8 documented styled exports. - [Toggle](https://starwind.dev/docs/components/toggle/) ([Markdown](https://starwind.dev/docs/components/toggle.md)): Direct primitive; Astro available; React available; 1 documented styled export. - [Toggle Group](https://starwind.dev/docs/components/toggle-group/) ([Markdown](https://starwind.dev/docs/components/toggle-group.md)): Composite; Astro available; React available; 2 documented styled exports. - [Tooltip](https://starwind.dev/docs/components/tooltip/) ([Markdown](https://starwind.dev/docs/components/tooltip.md)): Direct primitive; Astro available; React available; 3 documented styled exports. - [Video](https://starwind.dev/docs/components/video/) ([Markdown](https://starwind.dev/docs/components/video.md)): Styled only; Astro available; React available; 1 documented styled export. ## AI And Documentation Links - [Components](https://starwind.dev/docs/components/) - [Primitive adapters](https://starwind.dev/docs/primitives/) - [Runtime and raw HTML](https://starwind.dev/docs/runtime/) - [Theming](https://starwind.dev/docs/getting-started/theming/) - [Astro installation](https://starwind.dev/docs/frameworks/astro/) - [Vite React installation](https://starwind.dev/docs/frameworks/vite-react/) - [Next.js installation](https://starwind.dev/docs/frameworks/nextjs/) - [TanStack Start installation](https://starwind.dev/docs/frameworks/tanstack-start/) - [React Router installation](https://starwind.dev/docs/frameworks/react-router/) - Per-page Markdown: append `.md` to a docs URL. - Structured manifest: [ai-manifest.json](https://starwind.dev/ai-manifest.json) ## Full Documentation The following sections are generated from the same normalized Markdown pipeline as each page's public `.md` route. --- Source: [https://starwind.dev/docs/components/](https://starwind.dev/docs/components/) · [Markdown](https://starwind.dev/docs/components.md) # Components Overview Browse 55 CLI-installed styled components for Astro and React. Open any component for installation, copy-paste examples, and API details. > **Image is the one exception.** It integrates directly with Astro's image pipeline, so React > projects should use their framework-native image component. ## Browse All Components Every component page includes installation commands, copy-paste examples, and its public API. ## Form & Input Collect and validate user input. | Component | Astro | React | | --- | --- | --- | | [Button](/docs/components/button/) | Available | Available | | [Button Group](/docs/components/button-group/) | Available | Available | | [Checkbox](/docs/components/checkbox/) | Available | Available | | [Checkbox Group](/docs/components/checkbox-group/) | Available | Available | | [Color Picker](/docs/components/color-picker/) | Available | Available | | [Combobox](/docs/components/combobox/) | Available | Available | | [Dropzone](/docs/components/dropzone/) | Available | Available | | [Field](/docs/components/field/) | Available | Available | | [Form](/docs/components/form/) | Available | Available | | [Input](/docs/components/input/) | Available | Available | | [Input Group](/docs/components/input-group/) | Available | Available | | [Input Otp](/docs/components/input-otp/) | Available | Available | | [Label](/docs/components/label/) | Available | Available | | [Native Select](/docs/components/native-select/) | Available | Available | | [Radio Group](/docs/components/radio-group/) | Available | Available | | [Select](/docs/components/select/) | Available | Available | | [Slider](/docs/components/slider/) | Available | Available | | [Switch](/docs/components/switch/) | Available | Available | | [Textarea](/docs/components/textarea/) | Available | Available | | [Toggle](/docs/components/toggle/) | Available | Available | | [Toggle Group](/docs/components/toggle-group/) | Available | Available | ## Navigation Move users through pages, sections, and app states. | Component | Astro | React | | --- | --- | --- | | [Breadcrumb](/docs/components/breadcrumb/) | Available | Available | | [Dropdown](/docs/components/dropdown/) | Available | Available | | [Navigation Menu](/docs/components/navigation-menu/) | Available | Available | | [Pagination](/docs/components/pagination/) | Available | Available | | [Sidebar](/docs/components/sidebar/) | Available | Available | | [Tabs](/docs/components/tabs/) | Available | Available | | [Theme Toggle](/docs/components/theme-toggle/) | Available | Available | ## Overlay & Disclosure Reveal additional information or contextual actions. | Component | Astro | React | | --- | --- | --- | | [Accordion](/docs/components/accordion/) | Available | Available | | [Alert Dialog](/docs/components/alert-dialog/) | Available | Available | | [Collapsible](/docs/components/collapsible/) | Available | Available | | [Context Menu](/docs/components/context-menu/) | Available | Available | | [Dialog](/docs/components/dialog/) | Available | Available | | [Hover Card](/docs/components/hover-card/) | Available | Available | | [Popover](/docs/components/popover/) | Available | Available | | [Sheet](/docs/components/sheet/) | Available | Available | | [Tooltip](/docs/components/tooltip/) | Available | Available | ## Feedback & Status Communicate progress, outcomes, and loading states. | Component | Astro | React | | --- | --- | --- | | [Alert](/docs/components/alert/) | Available | Available | | [Progress](/docs/components/progress/) | Available | Available | | [Skeleton](/docs/components/skeleton/) | Available | Available | | [Spinner](/docs/components/spinner/) | Available | Available | | [Toast](/docs/components/toast/) | Available | Available | ## Layout & Structure Build consistent spatial structure and content organization. | Component | Astro | React | | --- | --- | --- | | [Aspect Ratio](/docs/components/aspect-ratio/) | Available | Available | | [Card](/docs/components/card/) | Available | Available | | [Item](/docs/components/item/) | Available | Available | | [Scroll Area](/docs/components/scroll-area/) | Available | Available | | [Separator](/docs/components/separator/) | Available | Available | | [Table](/docs/components/table/) | Available | Available | ## Content & Media Present media, rich text, and supporting UI metadata. | Component | Astro | React | | --- | --- | --- | | [Avatar](/docs/components/avatar/) | Available | Available | | [Badge](/docs/components/badge/) | Available | Available | | [Carousel](/docs/components/carousel/) | Available | Available | | [Image](/docs/components/image/) | Available | Framework native — React projects should use the framework or app router image primitive instead. | | [Kbd](/docs/components/kbd/) | Available | Available | | [Prose](/docs/components/prose/) | Available | Available | | [Video](/docs/components/video/) | Available | Available | ## Installation Initialize Starwind for Astro once, then add an individual component or install the complete bundled styled registry. See the [installation guide](/docs/getting-started/installation/) and [CLI reference](/docs/getting-started/cli/) for configuration and update workflows. ```bash npx starwind@latest init --framework astro npx starwind@latest add button npx starwind@latest add --all ``` ## Import Pattern The CLI copies styled component source into `src/components/starwind` by default. Import each public component from its local folder: ```ts import { ComponentName } from "@/components/starwind/component-name"; ``` ## Class Overrides Installed components support class overrides through the Astro `class` prop. Tailwind Variants and Tailwind Merge combine the component defaults with project-specific classes. ```astro --- import { Button } from "@/components/starwind/button"; --- ``` --- Source: [https://starwind.dev/docs/components/accordion/](https://starwind.dev/docs/components/accordion/) · [Markdown](https://starwind.dev/docs/components/accordion.md) # Accordion
```astro --- import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "@/components/starwind/accordion"; --- What is Astro? Astro is an web framework for building fast, scalable, and secure websites. Why should I use Astro? Astro provides a set of features that make it an ideal choice for building fast, scalable, and secure websites. How do I get started with Astro? To get started with Astro, follow the instructions in the documentation. ```
```tsx import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "@/components/starwind/accordion"; export function Example() { return ( What is Astro? Astro is an web framework for building fast, scalable, and secure websites. Why should I use Astro? Astro provides a set of features that make it an ideal choice for building fast, scalable, and secure websites. How do I get started with Astro? To get started with Astro, follow the instructions in the documentation. ); } ```
## Installation ```bash npx starwind@latest add accordion ``` ## Usage ### multiple Use `type="multiple"` to allow multiple accordion items to be open at the same time.
```astro --- import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "@/components/starwind/accordion"; --- What is Astro? Astro is an web framework for building fast, scalable, and secure websites. Why should I use Astro? Astro provides a set of features that make it an ideal choice for building fast, scalable, and secure websites. How do I get started with Astro? To get started with Astro, follow the instructions in the documentation. ```
```tsx import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "@/components/starwind/accordion"; export function Example() { return ( <> What is Astro? Astro is an web framework for building fast, scalable, and secure websites. Why should I use Astro? Astro provides a set of features that make it an ideal choice for building fast, scalable, and secure websites. How do I get started with Astro? To get started with Astro, follow the instructions in the documentation. ); } ```
### defaultValue Use the `defaultValue` prop to set the default open item. If the prop is not provided, no items will be open by default.
```astro --- import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "@/components/starwind/accordion"; --- What is Astro? Astro is an web framework for building fast, scalable, and secure websites. Why should I use Astro? Astro provides a set of features that make it an ideal choice for building fast, scalable, and secure websites. How do I get started with Astro? To get started with Astro, follow the instructions in the documentation. ```
```tsx import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "@/components/starwind/accordion"; export function Example() { return ( <> What is Astro? Astro is an web framework for building fast, scalable, and secure websites. Why should I use Astro? Astro provides a set of features that make it an ideal choice for building fast, scalable, and secure websites. How do I get started with Astro? To get started with Astro, follow the instructions in the documentation. ); } ```
## API Reference ### Accordion | Prop | Type | Required | Default | Kind | Description | | --- | --- | --- | --- | --- | --- | | `defaultValue` | `string \| string[]` | No | - | Primitive override | Sets the initial value when the component is uncontrolled. | - Inherits div attributes. ### AccordionItem | Prop | Type | Required | Default | Kind | Description | | --- | --- | --- | --- | --- | --- | | `value` | `string` | Yes | - | Wrapper prop | Controls or identifies the component value. | - Inherits div attributes. ### AccordionTrigger - Inherits button attributes. ### AccordionContent - Inherits div attributes. ### Primitive And Runtime API Behavior, state, events, form participation, and imperative methods are documented in the lower-level references. - Primitive: [Accordion Primitive](/docs/primitives/accordion/) - Runtime factory: [`createAccordion`](/docs/runtime/#create-accordion) from `@starwind-ui/runtime/accordion` ## Changelog ### v2.0.3 - Named the generated aggregate default export so React and Astro tooling can identify the installed component cleanly. ### v2.0.2 - Applied divider borders only to non-last Accordion items in the generated Astro and React components. ### v2.0.1 - Single accordions now default to collapsible. ### v2.0.0 - Rebuilt Accordion on Starwind Runtime for disclosure state and keyboard behavior; - See the [Accordion Primitive](/docs/primitives/accordion/) for the underlying unstyled anatomy and behavior API. ### v1.3.5 - Refactor tailwind variants functions into separate `variants.ts` file ### v1.3.3 - Add `starwind:init` event listener to enable initialization of additional Accordions loaded after an initial page load, such as when using server islands - Update the opening animation so that it does not play on initial accordion load ### v1.3.2 - add named slot "icon" to `AccordionTrigger` to enable easy icon swapping ### v1.3.1 - simplified default styling to enable easier custom styling ### v1.3.0 - style and focus state updates ### v1.2.0 - Add a `data-slot` attribute to all components to enable global styling updates ### v1.1.0 - `tailwind-variants` now implemented. This uses `tailwind-merge` under the hood to merge Tailwind classes without style conflicts, allowing you to override any existing classes using the `class` prop. --- Source: [https://starwind.dev/docs/components/alert/](https://starwind.dev/docs/components/alert/) · [Markdown](https://starwind.dev/docs/components/alert.md) # Alert
```astro --- import { Alert, AlertDescription, AlertTitle } from "@/components/starwind/alert"; --- Heads up! A simple alert with an "AlertTitle" and an "AlertDescription". ```
```tsx import { Alert, AlertDescription, AlertTitle } from "@/components/starwind/alert"; export function Example() { return ( Heads up! A simple alert with an "AlertTitle" and an "AlertDescription". ); } ```
## Installation ```bash npx starwind@latest add alert ``` ## Usage ### icon You can add any svg icon inside the `` component and it will be automatically styled.
```astro --- import { Alert, AlertDescription, AlertTitle } from "@/components/starwind/alert"; import Flame from "@tabler/icons/outline/flame.svg"; --- Danger! This action is destructive and may have unintended consequences. ```
```tsx import { Alert, AlertDescription, AlertTitle } from "@/components/starwind/alert"; import { IconFlame as Flame } from "@tabler/icons-react"; export function Example() { return ( <> Danger! This action is destructive and may have unintended consequences. ); } ```
### variant
```astro --- import { Alert, AlertDescription, AlertTitle } from "@/components/starwind/alert"; --- variant="default" A simple alert with an "AlertTitle" and an "AlertDescription". variant="primary" A simple alert with an "AlertTitle" and an "AlertDescription". variant="secondary" A simple alert with an "AlertTitle" and an "AlertDescription". variant="info" A simple alert with an "AlertTitle" and an "AlertDescription". variant="success" A simple alert with an "AlertTitle" and an "AlertDescription". variant="warning" A simple alert with an "AlertTitle" and an "AlertDescription". variant="error" A simple alert with an "AlertTitle" and an "AlertDescription". ```
```tsx import { Alert, AlertDescription, AlertTitle } from "@/components/starwind/alert"; export function Example() { return ( <> variant="default" A simple alert with an "AlertTitle" and an "AlertDescription". variant="primary" A simple alert with an "AlertTitle" and an "AlertDescription". variant="secondary" A simple alert with an "AlertTitle" and an "AlertDescription". variant="info" A simple alert with an "AlertTitle" and an "AlertDescription". variant="success" A simple alert with an "AlertTitle" and an "AlertDescription". variant="warning" A simple alert with an "AlertTitle" and an "AlertDescription". variant="error" A simple alert with an "AlertTitle" and an "AlertDescription". ); } ```
## API Reference ### Alert | Prop | Type | Required | Default | Kind | Description | | --- | --- | --- | --- | --- | --- | | `variant` | `"default" \| "primary" \| "secondary" \| "info" \| "success" \| "warning" \| "error"` | No | `"default"` | Styled variant | Selects the component's visual variant. | - Inherits div attributes. ### AlertTitle - Inherits h5 attributes. ### AlertDescription - Inherits p attributes. ## Changelog ### v1.4.1 - Named the generated aggregate default export so React and Astro tooling can identify the installed component cleanly. ### v1.4.0 - Added contract-generated Astro and React implementations while preserving the component's existing public API and styling. ### v1.3.2 - Refactor tailwind variants functions into separate `variants.ts` file ### v1.3.0 - style and focus state updates ### v1.2.0 - Add a `data-slot` attribute to all components to enable global styling updates - add `role="alert"` and other small accessibility improvements ### v1.1.1 - Adjust component to use type `VariantProps` from `tailwind-variants`. This provides greater type safety and cleans up component frontmatter. ### v1.1.0 - `tailwind-variants` now implemented. This uses `tailwind-merge` under the hood to merge Tailwind classes without style conflicts, allowing you to override any existing classes using the "class" prop. --- Source: [https://starwind.dev/docs/components/alert-dialog/](https://starwind.dev/docs/components/alert-dialog/) · [Markdown](https://starwind.dev/docs/components/alert-dialog.md) # Alert Dialog
```astro --- import { AlertDialog, AlertDialogTrigger, AlertDialogContent, AlertDialogHeader, AlertDialogFooter, AlertDialogTitle, AlertDialogDescription, AlertDialogCancel, AlertDialogAction } from "@/components/starwind/alert-dialog"; import { Button } from "@/components/starwind/button"; --- Are you absolutely sure? This action cannot be undone. This will permanently delete your account and remove your data from our servers. Cancel Continue ```
```tsx import { AlertDialog, AlertDialogTrigger, AlertDialogContent, AlertDialogHeader, AlertDialogFooter, AlertDialogTitle, AlertDialogDescription, AlertDialogCancel, AlertDialogAction } from "@/components/starwind/alert-dialog"; import { Button } from "@/components/starwind/button"; export function Example() { return ( Are you absolutely sure? This action cannot be undone. This will permanently delete your account and remove your data from our servers. Cancel Continue ); } ```
## Installation ```bash npx starwind@latest add alert-dialog ``` ## Usage ### General Notes Alert dialogs are used to interrupt the user with important information that requires a response. Alert dialogs are modal and should be used sparingly for critical actions like confirmations, warnings, or errors. The essential components are `AlertDialog`, `AlertDialogTrigger`, and `AlertDialogContent`. The `AlertDialogAction` and `AlertDialogCancel` components provide standard button behaviors for user responses. ### Destructive Actions Alert dialogs are commonly used to confirm destructive actions like deleting data.
```astro --- import { AlertDialog, AlertDialogTrigger, AlertDialogContent, AlertDialogHeader, AlertDialogFooter, AlertDialogTitle, AlertDialogDescription, AlertDialogCancel, AlertDialogAction } from "@/components/starwind/alert-dialog"; import { Button } from "@/components/starwind/button"; --- Delete Account Are you sure you want to delete your account? This action is permanent and cannot be undone. All your data, including projects, settings, and personal information will be permanently removed. Cancel Delete Account ```
```tsx import { AlertDialog, AlertDialogTrigger, AlertDialogContent, AlertDialogHeader, AlertDialogFooter, AlertDialogTitle, AlertDialogDescription, AlertDialogCancel, AlertDialogAction } from "@/components/starwind/alert-dialog"; import { Button } from "@/components/starwind/button"; export function Example() { return ( <> Delete Account Are you sure you want to delete your account? This action is permanent and cannot be undone. All your data, including projects, settings, and personal information will be permanently removed. Cancel Delete Account ); } ```
### Custom Styling You can customize the appearance of alert dialog components using the `class` prop.
```astro --- import { AlertDialog, AlertDialogTrigger, AlertDialogContent, AlertDialogHeader, AlertDialogFooter, AlertDialogTitle, AlertDialogDescription, AlertDialogCancel, AlertDialogAction } from "@/components/starwind/alert-dialog"; import { Button } from "@/components/starwind/button"; --- Custom Alert Dialog This alert dialog has custom styling applied to make it more compact and centered. Cancel Confirm ```
```tsx import { AlertDialog, AlertDialogTrigger, AlertDialogContent, AlertDialogHeader, AlertDialogFooter, AlertDialogTitle, AlertDialogDescription, AlertDialogCancel, AlertDialogAction } from "@/components/starwind/alert-dialog"; import { Button } from "@/components/starwind/button"; export function Example() { return ( <> Custom Alert Dialog This alert dialog has custom styling applied to make it more compact and centered. Cancel Confirm ); } ```
## API Reference ### AlertDialog - Inherits div attributes. ### AlertDialogTrigger | Prop | Type | Required | Default | Kind | Description | | --- | --- | --- | --- | --- | --- | | `asChild` | `boolean` | No | `false` | Wrapper prop | Merges the component behavior and props into its child element. | - Inherits button attributes. ### AlertDialogContent - Inherits dialog attributes. ### AlertDialogHeader - Inherits div attributes. ### AlertDialogFooter - Inherits div attributes. ### AlertDialogTitle - Inherits h2 attributes. ### AlertDialogDescription - Inherits p attributes. ### AlertDialogAction | Prop | Type | Required | Default | Kind | Description | | --- | --- | --- | --- | --- | --- | | `asChild` | `boolean` | No | `false` | Wrapper prop | Merges the component behavior and props into its child element. | - Inherits Button props. ### AlertDialogCancel | Prop | Type | Required | Default | Kind | Description | | --- | --- | --- | --- | --- | --- | | `asChild` | `boolean` | No | `false` | Wrapper prop | Merges the component behavior and props into its child element. | - Inherits Button props. ### Primitive And Runtime API Behavior, state, events, form participation, and imperative methods are documented in the lower-level references. - Primitive: [Alert Dialog Primitive](/docs/primitives/alert-dialog/) - Runtime factory: [`createAlertDialog`](/docs/runtime/#create-alert-dialog) from `@starwind-ui/runtime/alert-dialog` ## Changelog ### v2.0.2 - Named the generated aggregate default export so React and Astro tooling can identify the installed component cleanly. ### v2.0.0 - Rebuilt Alert Dialog on Starwind Runtime for modal state, focus management, and dismissal in confirmation workflows. - See the [Alert Dialog Primitive](/docs/primitives/alert-dialog/) for the underlying unstyled anatomy and behavior API. --- Source: [https://starwind.dev/docs/components/aspect-ratio/](https://starwind.dev/docs/components/aspect-ratio/) · [Markdown](https://starwind.dev/docs/components/aspect-ratio.md) # Aspect Ratio
```astro --- import { AspectRatio } from "@/components/starwind/aspect-ratio"; --- Photo by Drew Beamer ```
```tsx import { AspectRatio } from "@/components/starwind/aspect-ratio"; export function Example() { return ( Photo by Drew Beamer ); } ```
## Installation ```bash npx starwind@latest add aspect-ratio ``` ## Usage ### 16:9 Ratio (Default Video)
```astro --- import { AspectRatio } from "@/components/starwind/aspect-ratio"; ---
16:9 Aspect Ratio
```
```tsx import { AspectRatio } from "@/components/starwind/aspect-ratio"; export function Example() { return ( <>
16:9 Aspect Ratio
); } ```
### 4:3 Ratio (Classic Photo)
```astro --- import { AspectRatio } from "@/components/starwind/aspect-ratio"; --- Photo by Kari Shea ```
```tsx import { AspectRatio } from "@/components/starwind/aspect-ratio"; export function Example() { return ( <> Photo by Kari Shea ); } ```
### 1:1 Ratio (Square)
```astro --- import { AspectRatio } from "@/components/starwind/aspect-ratio"; --- Photo by Ayo Ogunseinde ```
```tsx import { AspectRatio } from "@/components/starwind/aspect-ratio"; export function Example() { return ( <> Photo by Ayo Ogunseinde ); } ```
### 21:9 Ratio (Ultrawide)
```astro --- import { AspectRatio } from "@/components/starwind/aspect-ratio"; --- Photo by Simon Berger ```
```tsx import { AspectRatio } from "@/components/starwind/aspect-ratio"; export function Example() { return ( <> Photo by Simon Berger ); } ```
### With Video
```astro --- import { AspectRatio } from "@/components/starwind/aspect-ratio"; --- ```
```tsx import { AspectRatio } from "@/components/starwind/aspect-ratio"; export function Example() { return ( <> ); } ```
## API Reference ### AspectRatio | Prop | Type | Required | Default | Kind | Description | | --- | --- | --- | --- | --- | --- | | `as` | `keyof HTMLElementTagNameMap` | No | `"div"` | Wrapper prop | Selects the rendered element or component. | | `ratio` | `number` | No | `1` | Wrapper prop | Sets the rendered width-to-height ratio. | - Inherits div attributes. ## Changelog ### v1.1.0 - Added contract-generated Astro and React implementations while preserving the component's existing public API and styling. ### v1.0.3 - Refactor tailwind variants functions into separate `variants.ts` file ### v1.0.0 - Initial release with starwind v1.10.0 --- Source: [https://starwind.dev/docs/components/avatar/](https://starwind.dev/docs/components/avatar/) · [Markdown](https://starwind.dev/docs/components/avatar.md) # Avatar
```astro --- import { Avatar, AvatarImage, AvatarFallback } from "@/components/starwind/avatar"; --- JD ```
```tsx import { Avatar, AvatarImage, AvatarFallback } from "@/components/starwind/avatar"; export function Example() { return ( JD ); } ```
## Installation ```bash npx starwind@latest add avatar ``` ## Usage ### size
```astro --- import { Avatar, AvatarImage, AvatarFallback } from "@/components/starwind/avatar"; --- JD JD JD ```
```tsx import { Avatar, AvatarImage, AvatarFallback } from "@/components/starwind/avatar"; export function Example() { return ( <> JD JD JD ); } ```
### variant
```astro --- import { Avatar, AvatarImage, AvatarFallback } from "@/components/starwind/avatar"; --- JD JD JD JD JD JD JD ```
```tsx import { Avatar, AvatarImage, AvatarFallback } from "@/components/starwind/avatar"; export function Example() { return ( <> JD JD JD JD JD JD JD ); } ```
### image Rather than passing an image URL, you can also pass an imported image to the `AvatarImage` component. This will optimize the image using the astro:assets `` component.
```astro --- import { Avatar, AvatarImage, AvatarFallback } from "@/components/starwind/avatar"; import GigaChad from "@/assets/images/giga-chad.jpg"; --- GC ```
```tsx import { Avatar, AvatarImage, AvatarFallback } from "@/components/starwind/avatar"; import GigaChad from "@/assets/images/giga-chad.jpg"; export function Example() { return ( <> GC ); } ```
### Fallback When an image fails to load or isn't provided, the fallback content will be displayed.
```astro --- import { Avatar, AvatarImage, AvatarFallback } from "@/components/starwind/avatar"; --- WR ```
```tsx import { Avatar, AvatarImage, AvatarFallback } from "@/components/starwind/avatar"; export function Example() { return ( <> WR ); } ```
## API Reference ### Avatar | Prop | Type | Required | Default | Kind | Description | | --- | --- | --- | --- | --- | --- | | `size` | `"sm" \| "md" \| "lg"` | No | `"md"` | Styled variant | Selects the component's visual size. | | `variant` | `"default" \| "primary" \| "secondary" \| "info" \| "success" \| "warning" \| "error"` | No | `"default"` | Styled variant | Selects the component's visual variant. | - Inherits span attributes. ### AvatarImage | Prop | Type | Required | Default | Kind | Description | | --- | --- | --- | --- | --- | --- | | `alt` | `string` | Yes | - | Wrapper prop | Provides alternative text for the rendered image. | | `image` | `ImageMetadata` | No | - | Wrapper prop | Provides Astro image metadata for optimized image rendering. | | `src` | `string` | No | - | Wrapper prop | Provides the media source URL. | - Inherits img attributes. Omits `children`. ### AvatarFallback - Inherits span attributes. ### Primitive And Runtime API Behavior, state, events, form participation, and imperative methods are documented in the lower-level references. - Primitive: [Avatar Primitive](/docs/primitives/avatar/) - Runtime factory: [`createAvatar`](/docs/runtime/#create-avatar) from `@starwind-ui/runtime/avatar` ## Changelog ### v2.0.2 - Named the generated aggregate default export so React and Astro tooling can identify the installed component cleanly. ### v2.0.1 - Rendered Avatar roots as inline flex containers so the small, medium, and large size variants produce exact circles while preserving image-loading and fallback visibility. ### v2.0.0 - Rebuilt Avatar on Starwind Runtime for image loading and fallback state. - See the [Avatar Primitive](/docs/primitives/avatar/) for the underlying unstyled anatomy and behavior API. ### v1.2.3 - Refactor tailwind variants functions into separate `variants.ts` file ### v1.2.1 - Add the ability to pass additional attributes to components ### v1.2.0 - Add a `data-slot` attribute to all components to enable global styling updates ### v1.1.1 - Adjust component to use type `VariantProps` from `tailwind-variants`. This provides greater type safety and cleans up component frontmatter. - Add eslint disable comment for using the "onerror" function which allows us to handle an image that doesn't load. This allows us to display the fallback content. ### v1.1.0 - `tailwind-variants` now implemented. This uses `tailwind-merge` under the hood to merge Tailwind classes without style conflicts, allowing you to override any existing classes using the "class" prop. --- Source: [https://starwind.dev/docs/components/badge/](https://starwind.dev/docs/components/badge/) · [Markdown](https://starwind.dev/docs/components/badge.md) # Badge
```astro --- import { Badge } from "@/components/starwind/badge"; --- Introducing Starwind UI v3 ```
```tsx import { Badge } from "@/components/starwind/badge"; export function Example() { return (
Introducing Starwind UI v3
); } ```
## Installation ```bash npx starwind@latest add badge ``` ## Usage Use `tone` to choose the semantic color and `appearance` to choose how strongly that color is presented. They can be combined independently, giving you more control than the original `variant` prop. ### Tone and appearance The available tones are `neutral`, `primary`, `primary-accent`, `secondary`, `secondary-accent`, `info`, `success`, `warning`, and `error`. Each tone supports `solid`, `soft`, `outline`, `text`, and `frosted` appearances.
```astro --- import { Badge } from "@/components/starwind/badge"; --- Primary Primary accent Success Warning Info ```
```tsx import { Badge } from "@/components/starwind/badge"; export function Example() { return ( <> Primary Primary accent Success Warning Info ); } ```
Providing either `tone` or `appearance` opts into the composable styling API. When one is omitted, the component uses `neutral` for the tone or `soft` for the appearance. ### Eyebrow Use `eyebrow` for compact labels that need an uppercase treatment with wider letter spacing. It can be combined with every tone, appearance, and size.
```astro --- import { Badge } from "@/components/starwind/badge"; --- Small eyebrow Medium eyebrow Large eyebrow ```
```tsx import { Badge } from "@/components/starwind/badge"; export function Example() { return ( <> Small eyebrow Medium eyebrow Large eyebrow ); } ```
### Size and icons
```astro --- import { Badge } from "@/components/starwind/badge"; import Mail from "@tabler/icons/outline/mail.svg"; --- Small Medium Large ```
```tsx import { Badge } from "@/components/starwind/badge"; import { IconMail as Mail } from "@tabler/icons-react"; export function Example() { return ( <> Small Medium Large ); } ```
### Link Provide an `href` to render the Badge as an `` element. Link badges receive hover styles suited to their selected appearance.
```astro --- import { Badge } from "@/components/starwind/badge"; --- Primary Secondary Primary accent Success ```
```tsx import { Badge } from "@/components/starwind/badge"; export function Example() { return ( <> Primary Secondary Primary accent Success ); } ```
### Legacy variants The `variant` prop is still supported to avoid breaking changes. For new usage, prefer `tone` and `appearance`, which separate semantic color from visual emphasis. If `tone` or `appearance` is provided, the composable styling API takes precedence over `variant`.
```astro --- import { Badge } from "@/components/starwind/badge"; --- Default Primary Secondary Outline Ghost Info Success Warning Error ```
```tsx import { Badge } from "@/components/starwind/badge"; export function Example() { return ( <> Default Primary Secondary Outline Ghost Info Success Warning Error ); } ```
## API Reference ### Badge | Prop | Type | Required | Default | Kind | Description | | --- | --- | --- | --- | --- | --- | | `appearance` | `"solid" \| "soft" \| "outline" \| "text" \| "frosted"` | No | - | Styled variant | Selects whether the Badge uses solid, soft, outlined, text, or frosted chrome. | | `eyebrow` | `boolean` | No | `false` | Styled variant | Applies uppercase tracking for compact eyebrow labels. | | `size` | `"sm" \| "md" \| "lg"` | No | `"md"` | Styled variant | Selects the component's visual size. | | `tone` | `"neutral" \| "primary" \| "primary-accent" \| "secondary" \| "secondary-accent" \| "info" \| "success" \| "warning" \| "error"` | No | - | Styled variant | Selects the semantic color family used by composed Badge appearances. | | `variant` | `"default" \| "primary" \| "secondary" \| "outline" \| "ghost" \| "info" \| "success" \| "warning" \| "error"` | No | `"default"` | Styled variant | Selects the component's visual variant. | - Inherits a attributes. Omits `type`. - Inherits div attributes. ## Changelog ### v1.5.0 - Added contract-generated Astro and React implementations. - Added `tone`, `appearance`, and `eyebrow` treatments while preserving the legacy `variant` API for backwards compatibility. ### v1.4.3 - Refactor tailwind variants functions into separate `variants.ts` file ### v1.4.0 - Add automatic styling for SVGs within badges ### v1.3.0 - Style and focus state updates ### v1.2.0 - Add a `data-slot` attribute to all components to enable global styling updates ### v1.1.1 - Adjust component to use type `VariantProps` from `tailwind-variants`. This provides greater type safety and cleans up component frontmatter. ### v1.1.0 - `tailwind-variants` now implemented. This uses `tailwind-merge` under the hood to merge Tailwind classes without style conflicts, allowing you to override any existing classes using the "class" prop. --- Source: [https://starwind.dev/docs/components/breadcrumb/](https://starwind.dev/docs/components/breadcrumb/) · [Markdown](https://starwind.dev/docs/components/breadcrumb.md) # Breadcrumb
```astro --- import { Breadcrumb, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, BreadcrumbEllipsis } from "@/components/starwind/breadcrumb"; --- Home Categories Electronics ```
```tsx import { Breadcrumb, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, BreadcrumbEllipsis } from "@/components/starwind/breadcrumb"; export function Example() { return ( Home Categories Electronics ); } ```
## Installation ```bash npx starwind@latest add breadcrumb ``` ## Usage ### Separator The `BreadcrumbSeparator` component is used to visually separate items in the breadcrumb trail. By default, it displays a chevron-right icon, but you can provide your own custom separator.
```astro --- import { Breadcrumb, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator } from "@/components/starwind/breadcrumb"; --- Home / Components / Breadcrumb ```
```tsx import { Breadcrumb, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator } from "@/components/starwind/breadcrumb"; export function Example() { return ( <> Home / Components / Breadcrumb ); } ```
### Interactive Ellipsis Use `BreadcrumbEllipsis` as a Dropdown trigger to reveal hidden path segments. Runtime owns focus, keyboard navigation, outside-click and Escape dismissal, and the popup's entry and exit animations.
```astro --- import { Breadcrumb, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, BreadcrumbEllipsis } from "@/components/starwind/breadcrumb"; import { Dropdown, DropdownContent, DropdownLinkItem, DropdownTrigger } from "@/components/starwind/dropdown"; --- Home Docs Components Breadcrumb Usage Interactive Ellipsis ```
```tsx import { Breadcrumb, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, BreadcrumbEllipsis } from "@/components/starwind/breadcrumb"; import { Dropdown, DropdownContent, DropdownLinkItem, DropdownTrigger } from "@/components/starwind/dropdown"; export function Example() { return ( <> Home Docs Components Breadcrumb Usage Interactive Ellipsis ); } ```
## API Reference ### Breadcrumb - Inherits nav attributes. ### BreadcrumbList - Inherits ol attributes. ### BreadcrumbItem - Inherits li attributes. ### BreadcrumbLink | Prop | Type | Required | Default | Kind | Description | | --- | --- | --- | --- | --- | --- | | `asChild` | `boolean` | No | `false` | Wrapper prop | Delegates markup and visual ownership to the child rather than preserving the native link recipe. | - Inherits a attributes. ### BreadcrumbPage - Inherits span attributes. ### BreadcrumbSeparator - Inherits li attributes. ### BreadcrumbEllipsis - Inherits span attributes. ## Changelog ### v1.2.1 - Named the generated aggregate default export so React and Astro tooling can identify the installed component cleanly. ### v1.2.0 - Added contract-generated Astro and React implementations while preserving the component's existing public API and styling. ### v1.1.3 - Refactor tailwind variants functions into separate `variants.ts` file ### v1.1.1 - Add named slot "icon" to `BreadcrumbEllipsis` to enable easy icon swapping, and a default slot for the `sr-only` label ### v1.1.0 - Add a `data-slot` attribute to all components to enable global styling updates ### v1.0.0 - Initial component release with starwind v1.5.0 --- Source: [https://starwind.dev/docs/components/button/](https://starwind.dev/docs/components/button/) · [Markdown](https://starwind.dev/docs/components/button.md) # Button
```astro --- import { Button } from "@/components/starwind/button"; --- ```
```tsx import { Button } from "@/components/starwind/button"; export function Example() { return ( ); } ```
## Installation ```bash npx starwind@latest add button ``` ## Link The Button component can also function as a link (`
` tag) by providing an `href` prop.
```astro --- import { Button } from "@/components/starwind/button"; --- ```
```tsx import { Button } from "@/components/starwind/button"; export function Example() { return ( <> ); } ```
## Usage ### variant
```astro --- import { Button } from "@/components/starwind/button"; --- ```
```tsx import { Button } from "@/components/starwind/button"; export function Example() { return ( <> ); } ```
### size
```astro --- import { Button } from "@/components/starwind/button"; import Mail from "@tabler/icons/outline/mail.svg"; --- ```
```tsx import { Button } from "@/components/starwind/button"; import { IconMail as Mail } from "@tabler/icons-react"; export function Example() { return ( <> ); } ```
### radius > **Info:** With v2.0.0 of this component, it no longer has a radius prop, and instead the classes you pass in will be merged with the component's default classes using `tailwind-variants`. This means you can simply pass the class `rounded-full` or similar.
```astro --- import { Button } from "@/components/starwind/button"; --- ```
```tsx import { Button } from "@/components/starwind/button"; export function Example() { return ( <> ); } ```
## API Reference ### Button | Prop | Type | Required | Default | Kind | Description | | --- | --- | --- | --- | --- | --- | | `as` | `"button" \| "a"` | No | - | Wrapper prop | Selects the rendered element or component. | | `focusableWhenDisabled` | `boolean` | No | - | Primitive override | Keeps the disabled control in the keyboard focus order. | | `size` | `"sm" \| "md" \| "lg" \| "icon-sm" \| "icon" \| "icon-lg"` | No | `"md"` | Styled variant | Selects the component's visual size. | | `variant` | `"default" \| "primary" \| "secondary" \| "outline" \| "ghost" \| "info" \| "success" \| "warning" \| "error"` | No | `"default"` | Styled variant | Selects the component's visual variant. | - Inherits a attributes. Omits `type`. - Inherits button attributes. ### Primitive And Runtime API Behavior, state, events, form participation, and imperative methods are documented in the lower-level references. - Primitive: [Button Primitive](/docs/primitives/button/) - Runtime factory: [`createButton`](/docs/runtime/#create-button) from `@starwind-ui/runtime/button` ## Changelog ### v3.0.1 - Named the generated aggregate default export so React and Astro tooling can identify the installed component cleanly. ### v3.0.0 - Rebuilt Button on Starwind Runtime while preserving styled variants and link rendering. - See the [Button Primitive](/docs/primitives/button/) for the underlying unstyled anatomy and behavior API. ### v2.3.3 - Refactor tailwind variants functions into separate `variants.ts` file ### v2.3.0 - Add `aria-invalid` styling - Update styling for SVGs within so it doesn't override any `size-*` classes on the SVG itself - Update style horizontal padding to more closely match shadcn aspect ratios ### v2.2.0 - add additional sizes "icon-sm" and "icon-lg" - style and focus state updates ### v2.1.0 - Add a `data-slot` attribute to all components to enable global styling updates ### v2.0.1 - Adjust component to use type `VariantProps` from `tailwind-variants`. This provides greater type safety and cleans up component frontmatter. ### v2.0.0 - `tailwind-variants` now implemented. This uses `tailwind-merge` under the hood to merge Tailwind classes without style conflicts. - Removed `radius` prop now that classes like "rounded-full" can be passed to the components to override, taking advantage of `tailwind-variants` --- Source: [https://starwind.dev/docs/components/button-group/](https://starwind.dev/docs/components/button-group/) · [Markdown](https://starwind.dev/docs/components/button-group.md) # Button Group
```astro --- import { Button } from "@/components/starwind/button"; import { ButtonGroup } from "@/components/starwind/button-group"; --- ```
```tsx import { Button } from "@/components/starwind/button"; import { ButtonGroup } from "@/components/starwind/button-group"; export function Example() { return ( ); } ```
## Installation ```bash npx starwind@latest add button-group ``` ## Usage ### Orientation Set the `orientation` prop to change the button group layout.
```astro --- import { Button } from "@/components/starwind/button"; import { ButtonGroup } from "@/components/starwind/button-group"; import IconPlus from "@tabler/icons/outline/plus.svg"; import IconMinus from "@tabler/icons/outline/minus.svg"; --- ```
```tsx import { Button } from "@/components/starwind/button"; import { ButtonGroup } from "@/components/starwind/button-group"; import { IconPlus as IconPlus } from "@tabler/icons-react"; import { IconMinus as IconMinus } from "@tabler/icons-react"; export function Example() { return ( <> ); } ```
### Size Control the size of buttons using the `size` prop on individual buttons.
```astro --- import { Button } from "@/components/starwind/button"; import { ButtonGroup } from "@/components/starwind/button-group"; import IconPlus from "@tabler/icons/outline/plus.svg"; ---
```
```tsx import { Button } from "@/components/starwind/button"; import { ButtonGroup } from "@/components/starwind/button-group"; import { IconPlus as IconPlus } from "@tabler/icons-react"; export function Example() { return ( <>
); } ```
### Nested Nest `ButtonGroup` components to create button groups with spacing.
```astro --- import { Button } from "@/components/starwind/button"; import { ButtonGroup } from "@/components/starwind/button-group"; import IconArrowLeft from "@tabler/icons/outline/arrow-left.svg"; import IconArrowRight from "@tabler/icons/outline/arrow-right.svg"; --- ```
```tsx import { Button } from "@/components/starwind/button"; import { ButtonGroup } from "@/components/starwind/button-group"; import { IconArrowLeft as IconArrowLeft } from "@tabler/icons-react"; import { IconArrowRight as IconArrowRight } from "@tabler/icons-react"; export function Example() { return ( <> ); } ```
### Separator The `ButtonGroupSeparator` component visually divides buttons within a group. Buttons with variant `outline` do not need a separator since they have a border. For other variants, a separator is recommended to improve the visual hierarchy.
```astro --- import { Button } from "@/components/starwind/button"; import { ButtonGroup, ButtonGroupSeparator } from "@/components/starwind/button-group"; import IconCopy from "@tabler/icons/outline/copy.svg"; import IconClipboard from "@tabler/icons/outline/clipboard.svg"; --- ```
```tsx import { Button } from "@/components/starwind/button"; import { ButtonGroup, ButtonGroupSeparator } from "@/components/starwind/button-group"; import { IconCopy as IconCopy } from "@tabler/icons-react"; import { IconClipboard as IconClipboard } from "@tabler/icons-react"; export function Example() { return ( <> ); } ```
### Split Create a split button group by adding two buttons separated by a `ButtonGroupSeparator`.
```astro --- import { Button } from "@/components/starwind/button"; import { ButtonGroup, ButtonGroupSeparator } from "@/components/starwind/button-group"; import IconPlus from "@tabler/icons/outline/plus.svg"; --- ```
```tsx import { Button } from "@/components/starwind/button"; import { ButtonGroup, ButtonGroupSeparator } from "@/components/starwind/button-group"; import { IconPlus as IconPlus } from "@tabler/icons-react"; export function Example() { return ( <> ); } ```
### Input Wrap an `Input` component with buttons.
```astro --- import { Button } from "@/components/starwind/button"; import { ButtonGroup } from "@/components/starwind/button-group"; import { Input } from "@/components/starwind/input"; import IconSearch from "@tabler/icons/outline/search.svg"; --- ```
```tsx import { Button } from "@/components/starwind/button"; import { ButtonGroup } from "@/components/starwind/button-group"; import { Input } from "@/components/starwind/input"; import { IconSearch as IconSearch } from "@tabler/icons-react"; export function Example() { return ( <> ); } ```
### Select Pair with a `Select` component.
```astro --- import { Button } from "@/components/starwind/button"; import { ButtonGroup } from "@/components/starwind/button-group"; import { Input } from "@/components/starwind/input"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/starwind/select"; import IconArrowRight from "@tabler/icons/outline/arrow-right.svg"; --- ```
```tsx import { Button } from "@/components/starwind/button"; import { ButtonGroup } from "@/components/starwind/button-group"; import { Input } from "@/components/starwind/input"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/starwind/select"; import { IconArrowRight as IconArrowRight } from "@tabler/icons-react"; export function Example() { return ( <> ); } ```
### Dropdown Menu Create a split button group with a dropdown menu.
```astro --- import { Button } from "@/components/starwind/button"; import { ButtonGroup } from "@/components/starwind/button-group"; import { Dropdown, DropdownContent, DropdownItem, DropdownSeparator, DropdownTrigger } from "@/components/starwind/dropdown"; import IconChevronDown from "@tabler/icons/outline/chevron-down.svg"; --- Mute Conversation Mark as Read Report Conversation Delete Conversation ```
```tsx import { Button } from "@/components/starwind/button"; import { ButtonGroup } from "@/components/starwind/button-group"; import { Dropdown, DropdownContent, DropdownItem, DropdownSeparator, DropdownTrigger } from "@/components/starwind/dropdown"; import { IconChevronDown as IconChevronDown } from "@tabler/icons-react"; export function Example() { return ( <> Mute Conversation Mark as Read Report Conversation Delete Conversation ); } ```
## API Reference ### ButtonGroup | Prop | Type | Required | Default | Kind | Description | | --- | --- | --- | --- | --- | --- | | `orientation` | `"horizontal" \| "vertical"` | No | `"horizontal"` | Styled variant | Selects the horizontal or vertical layout direction. | - Inherits div attributes. ### ButtonGroupSeparator - Inherits Separator props. ### ButtonGroupText - Inherits div attributes. ## Changelog ### v1.1.1 - Named the generated aggregate default export so React and Astro tooling can identify the installed component cleanly. ### v1.1.0 - Added contract-generated Astro and React implementations while preserving the component's existing public API and styling. ### v1.0.2 - Refactor tailwind variants functions into separate `variants.ts` file ### v1.0.0 - Initial release with starwind v1.12 --- Source: [https://starwind.dev/docs/components/card/](https://starwind.dev/docs/components/card/) · [Markdown](https://starwind.dev/docs/components/card.md) # Card
```astro --- import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@/components/starwind/card"; import { Button } from "@/components/starwind/button"; import { Input } from "@/components/starwind/input"; import { Label } from "@/components/starwind/label"; import { Select, SelectTrigger, SelectValue, SelectContent, SelectItem, SelectGroup, SelectLabel, SelectSeparator, } from "@/components/starwind/select"; --- Create project Deploy your new project in one-click.
```
```tsx import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@/components/starwind/card"; import { Button } from "@/components/starwind/button"; import { Input } from "@/components/starwind/input"; import { Label } from "@/components/starwind/label"; import { Select, SelectTrigger, SelectValue, SelectContent, SelectItem, SelectGroup, SelectLabel, SelectSeparator, } from "@/components/starwind/select"; export function Example() { return ( Create project Deploy your new project in one-click.
); } ```
## Installation ```bash npx starwind@latest add card ``` ## Usage ### Form Submission You can easily add a standard html form submission to your card. Here is a full example with the javascript submission code. > **Tip:** Open up your browser's dev tools and view the console to see the form data.
```astro --- import { Button } from "@/components/starwind/button"; import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, } from "@/components/starwind/card"; import { Input } from "@/components/starwind/input"; import { Label } from "@/components/starwind/label"; import { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectTrigger, SelectValue, } from "@/components/starwind/select"; --- Create project Deploy your new project in one-click.
```
```tsx import type { FormEvent } from "react"; import { Button } from "@/components/starwind/button"; import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, } from "@/components/starwind/card"; import { Input } from "@/components/starwind/input"; import { Label } from "@/components/starwind/label"; import { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectTrigger, SelectValue, } from "@/components/starwind/select"; export function Example() { function handleSubmit(event: FormEvent) { event.preventDefault(); console.log( "Form submission data:", Object.fromEntries(new FormData(event.currentTarget).entries()), ); } return ( Create project Deploy your new project in one-click.
); } ```
### Size Card supports `sm` and `md` sizes. It defaults to `md` when `size` is omitted; use `size="sm"` for tighter spacing.
```astro --- import { Button } from "@/components/starwind/button"; import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, } from "@/components/starwind/card"; --- Small Card This card uses the small size variant.

The card component supports a size prop that can be set to "sm" for a more compact appearance.

```
```tsx import { Button } from "@/components/starwind/button"; import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, } from "@/components/starwind/card"; export function Example() { return ( <> Small Card This card uses the small size variant.

The card component supports a size prop that can be set to "sm" for a more compact appearance.

); } ```
### Spacing Use the `--card-spacing` CSS variable to control both the spacing between sections and the inset of Card parts.
```astro --- import { Button } from "@/components/starwind/button"; import { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, } from "@/components/starwind/card"; import { Input } from "@/components/starwind/input"; import { Label } from "@/components/starwind/label"; import { ToggleGroup, ToggleGroupItem } from "@/components/starwind/toggle-group"; const spacingOptions = [ { className: "[--card-spacing:--spacing(4)]", label: "16px", value: "4" }, { className: "[--card-spacing:--spacing(5)]", label: "20px", value: "5" }, { className: "[--card-spacing:--spacing(6)]", label: "24px", value: "6" }, { className: "[--card-spacing:--spacing(8)]", label: "32px", value: "8" }, ] as const; --- ```
```tsx import { useState } from "react"; import { Button } from "@/components/starwind/button"; import { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, } from "@/components/starwind/card"; import { Input } from "@/components/starwind/input"; import { Label } from "@/components/starwind/label"; import { ToggleGroup, ToggleGroupItem } from "@/components/starwind/toggle-group"; const spacingOptions = [ { className: "[--card-spacing:--spacing(4)]", label: "16px", value: "4" }, { className: "[--card-spacing:--spacing(5)]", label: "20px", value: "5" }, { className: "[--card-spacing:--spacing(6)]", label: "24px", value: "6" }, { className: "[--card-spacing:--spacing(8)]", label: "32px", value: "8" }, ] as const; export function Example() { const [spacing, setSpacing] = useState("5"); const cardClassName = spacingOptions.find((option) => option.value === spacing)?.className; return (
setSpacing(values[0] ?? spacing)} variant="outline" size="sm" spacing={2} className="mx-auto" aria-label="Card spacing" > {spacingOptions.map((option) => ( {option.label} ))} Login to your account Enter your email below to login to your account.
); } ```
### Image Add an image before the card header to create a card with an image. Use the `CardAction` component to position a badge or other action in the header.
```astro --- import { Button } from "@/components/starwind/button"; import { Badge } from "@/components/starwind/badge"; import { Card, CardAction, CardDescription, CardFooter, CardHeader, CardTitle, } from "@/components/starwind/card"; --- Event cover Featured Design systems meetup A practical talk on component APIs, accessibility, and shipping faster. ```
```tsx import { Button } from "@/components/starwind/button"; import { Badge } from "@/components/starwind/badge"; import { Card, CardAction, CardDescription, CardFooter, CardHeader, CardTitle, } from "@/components/starwind/card"; export function Example() { return ( <> Event cover Featured Design systems meetup A practical talk on component APIs, accessibility, and shipping faster. ); } ```
## API Reference ### Card | Prop | Type | Required | Default | Kind | Description | | --- | --- | --- | --- | --- | --- | | `size` | `"sm" \| "md"` | No | `"md"` | Styled variant | Selects the component's visual size. | - Inherits div attributes. ### CardHeader - Inherits div attributes. ### CardTitle - Inherits div attributes. ### CardDescription - Inherits div attributes. ### CardContent - Inherits div attributes. ### CardFooter - Inherits div attributes. ### CardAction - Inherits div attributes. ## Changelog ### v2.3.1 - Named the generated aggregate default export so React and Astro tooling can identify the installed component cleanly. ### v2.3.0 - Renamed the standard Card size from `default` to `md`. Omitting `size` keeps the same medium spacing. ### v2.2.0 - Added the overridable `--card-spacing` CSS variable and default and small presets for coordinating section gaps and part insets consistently in Astro and React. ### v2.1.0 - Added contract-generated Astro and React implementations while preserving the component's existing public API and styling. ### v2.0.2 - Refactor tailwind variants functions into separate `variants.ts` file ### v2.0.0 - Added `size` prop to Card component (`"default"` | `"sm"`) - Added `CardAction` component for positioning actions in card headers - Added support for images within cards with automatic rounded corners - Update styling to more closely match the shadcn/ui card component ### v1.3.0 - style updates ### v1.2.0 - Add a `data-slot` attribute to all components to enable global styling updates ### v1.1.0 - `tailwind-variants` now implemented. This uses `tailwind-merge` under the hood to merge Tailwind classes without style conflicts, allowing you to override any existing classes using the "class" prop. --- Source: [https://starwind.dev/docs/components/carousel/](https://starwind.dev/docs/components/carousel/) · [Markdown](https://starwind.dev/docs/components/carousel.md) # Carousel
```astro --- import { Card, CardContent } from "@/components/starwind/card"; import { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, } from "@/components/starwind/carousel"; --- { Array.from({ length: 5 }).map((_, index) => (
{index + 1}
)) }
```
```tsx import { Card, CardContent } from "@/components/starwind/card"; import { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, } from "@/components/starwind/carousel"; export function Example() { return ( { Array.from({ length: 5 }).map((_, index) => (
{index + 1}
)) }
); } ```
## Installation ```bash npx starwind@latest add carousel ``` ## Usage ### General Notes The Carousel component is built on top of [Embla Carousel](https://www.embla-carousel.com/) and provides a responsive, touch-enabled carousel with smooth animations. It supports both horizontal and vertical orientations, multiple items per view, and various configuration options. The essential components are `Carousel`, `CarouselContent`, and `CarouselItem`. The `CarouselPrevious` and `CarouselNext` components provide navigation controls. ### Multiple Items Show multiple items at once by using responsive basis classes on carousel items.
```astro --- import { Card, CardContent } from "@/components/starwind/card"; import { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, } from "@/components/starwind/carousel"; --- { Array.from({ length: 5 }).map((_, index) => (
{index + 1}
)) }
```
```tsx import { Card, CardContent } from "@/components/starwind/card"; import { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, } from "@/components/starwind/carousel"; export function Example() { return ( <> { Array.from({ length: 5 }).map((_, index) => (
{index + 1}
)) }
); } ```
### Vertical Carousel Carousels can be oriented vertically by setting the `orientation` prop.
```astro --- import { Card, CardContent } from "@/components/starwind/card"; import { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, } from "@/components/starwind/carousel"; --- { Array.from({ length: 5 }).map((_, index) => (
{index + 1}
)) }
```
```tsx import { Card, CardContent } from "@/components/starwind/card"; import { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, } from "@/components/starwind/carousel"; export function Example() { return ( <> { Array.from({ length: 5 }).map((_, index) => (
{index + 1}
)) }
); } ```
### Looping Carousel Enable infinite looping with the `loop` option.
```astro --- import { Card, CardContent } from "@/components/starwind/card"; import { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, } from "@/components/starwind/carousel"; ---
Loop
```
```tsx import { Card, CardContent } from "@/components/starwind/card"; import { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, } from "@/components/starwind/carousel"; export function Example() { return ( <>
Loop
); } ```
### Plugins Extend carousel functionality with Embla Carousel plugins. First install the plugin package, then manually initialize the Runtime primitive with `createCarousel`. > **Info:** You need to set `autoInit={false}` on the Carousel component, so that you can manually initialize it with your plugins and any additional options. ```bash # Install the autoplay plugin npm install embla-carousel-autoplay ```
```astro --- import { Card, CardContent } from "@/components/starwind/card"; import { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, } from "@/components/starwind/carousel"; --- { Array.from({ length: 5 }).map((_, index) => (
{index + 1}
)) }
```
```tsx import Autoplay from "embla-carousel-autoplay"; import { Card, CardContent } from "@/components/starwind/card"; import { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, } from "@/components/starwind/carousel"; const autoplayPlugins = [Autoplay({ delay: 2000 })]; export function Example() { return ( {Array.from({ length: 5 }, (_, index) => (
{index + 1}
))}
); } ```
## API Reference ### Carousel | Prop | Type | Required | Default | Kind | Description | | --- | --- | --- | --- | --- | --- | | `autoInit` | `boolean` | No | - | Primitive override | Controls whether Runtime behavior initializes automatically. | | `opts` | `CarouselOptions["opts"]` | No | - | Primitive override | Provides options to the underlying carousel engine. | - Inherits div attributes. ### CarouselContent - Inherits div attributes. ### CarouselItem - Inherits div attributes. ### CarouselPrevious | Prop | Type | Required | Default | Kind | Description | | --- | --- | --- | --- | --- | --- | | `size` | `"sm" \| "md" \| "lg" \| "icon-sm" \| "icon" \| "icon-lg"` | No | `"icon"` | Styled variant | Selects the component's visual size. | | `variant` | `"default" \| "primary" \| "secondary" \| "outline" \| "ghost" \| "info" \| "success" \| "warning" \| "error"` | No | `"outline"` | Styled variant | Selects the component's visual variant. | - Inherits button attributes. ### CarouselNext | Prop | Type | Required | Default | Kind | Description | | --- | --- | --- | --- | --- | --- | | `size` | `"sm" \| "md" \| "lg" \| "icon-sm" \| "icon" \| "icon-lg"` | No | `"icon"` | Styled variant | Selects the component's visual size. | | `variant` | `"default" \| "primary" \| "secondary" \| "outline" \| "ghost" \| "info" \| "success" \| "warning" \| "error"` | No | `"outline"` | Styled variant | Selects the component's visual variant. | - Inherits button attributes. ### Primitive And Runtime API Behavior, state, events, form participation, and imperative methods are documented in the lower-level references. - Primitive: [Carousel Primitive](/docs/primitives/carousel/) - Runtime factory: [`createCarousel`](/docs/runtime/#create-carousel) from `@starwind-ui/runtime/carousel` ## Changelog ### v2.0.1 - Named the generated aggregate default export so React and Astro tooling can identify the installed component cleanly. ### v2.0.0 - Rebuilt Carousel on Starwind Runtime for navigation, orientation, looping, and plugin lifecycle. - See the [Carousel Primitive](/docs/primitives/carousel/) for the underlying unstyled anatomy and behavior API. --- Source: [https://starwind.dev/docs/components/checkbox/](https://starwind.dev/docs/components/checkbox/) · [Markdown](https://starwind.dev/docs/components/checkbox.md) # Checkbox
```astro --- import { Checkbox } from "@/components/starwind/checkbox"; --- ```
```tsx import { Checkbox } from "@/components/starwind/checkbox"; export function Example() { return ( ); } ```
## Installation ```bash npx starwind@latest add checkbox ``` ## Usage ### variant
```astro --- import { Checkbox } from "@/components/starwind/checkbox"; --- ```
```tsx import { Checkbox } from "@/components/starwind/checkbox"; export function Example() { return ( <> ); } ```
### size
```astro --- import { Checkbox } from "@/components/starwind/checkbox"; --- ```
```tsx import { Checkbox } from "@/components/starwind/checkbox"; export function Example() { return ( <> ); } ```
### disabled
```astro --- import { Checkbox } from "@/components/starwind/checkbox"; --- ```
```tsx import { Checkbox } from "@/components/starwind/checkbox"; export function Example() { return ( <> ); } ```
## API Reference ### Checkbox | Prop | Type | Required | Default | Kind | Description | | --- | --- | --- | --- | --- | --- | | `defaultChecked` | `boolean` | No | - | Primitive override | Sets the initial checked state when the choice is uncontrolled. | | `label` | `string` | No | - | Wrapper prop | Provides accessible text for the component. | | `size` | `"sm" \| "md" \| "lg"` | No | `"md"` | Styled variant | Selects the component's visual size. | | `variant` | `"default" \| "primary" \| "secondary" \| "info" \| "success" \| "warning" \| "error"` | No | `"default"` | Styled variant | Selects the component's visual variant. | - Inherits span attributes. Omits `defaultChecked`, `id`, and `onChange`. ### Primitive And Runtime API Behavior, state, events, form participation, and imperative methods are documented in the lower-level references. - Primitive: [Checkbox Primitive](/docs/primitives/checkbox/) - Runtime factory: [`createCheckbox`](/docs/runtime/#create-checkbox) from `@starwind-ui/runtime/checkbox` ## Changelog ### v2.0.1 - Updated React Runtime state synchronization so canceled proposals stay uncommitted and accepted changes remain aligned. ### v2.0.0 - Rebuilt Checkbox on Starwind Runtime for checked state, native form participation, and checked-change events. - See the [Checkbox Primitive](/docs/primitives/checkbox/) for the underlying unstyled anatomy and behavior API. ### v1.4.3 - Refactor tailwind variants functions into separate `variants.ts` file ### v1.4.1 - add `aria-invalid` styling ### v1.4.0 - style and focus state updates ### v1.3.0 - Add a `data-slot` attribute to all components to enable global styling updates ### v1.2.0 - No longer require an "id" prop - Adjust component to use type `VariantProps` from `tailwind-variants`. This provides greater type safety and cleans up component frontmatter. ### v1.1.0 - `tailwind-variants` now implemented. This uses `tailwind-merge` under the hood to merge Tailwind classes without style conflicts, allowing you to override any existing classes using the "class" prop. --- Source: [https://starwind.dev/docs/components/checkbox-group/](https://starwind.dev/docs/components/checkbox-group/) · [Markdown](https://starwind.dev/docs/components/checkbox-group.md) # Checkbox Group
```astro --- import { Checkbox } from "@/components/starwind/checkbox"; import { CheckboxGroup } from "@/components/starwind/checkbox-group"; --- ```
```tsx import { Checkbox } from "@/components/starwind/checkbox"; import { CheckboxGroup } from "@/components/starwind/checkbox-group"; export function Example() { return ( ); } ```
## Installation ```bash npx starwind@latest add checkbox-group ``` ## Usage Use `disabled` on the group to disable every child without repeating the prop.
```astro ```
```tsx import { Checkbox } from "@/components/starwind/checkbox"; import { CheckboxGroup } from "@/components/starwind/checkbox-group"; export function Example() { return ( <> ); } ```
## API Reference ### CheckboxGroup | Prop | Type | Required | Default | Kind | Description | | --- | --- | --- | --- | --- | --- | | `defaultValue` | `string[]` | No | - | Primitive override | Sets the initial value when the component is uncontrolled. | - Inherits div attributes. Omits `defaultValue` and `onChange`. ### Primitive And Runtime API Behavior, state, events, form participation, and imperative methods are documented in the lower-level references. - Primitive: [Checkbox Group Primitive](/docs/primitives/checkbox-group/) - Runtime factory: [`createCheckboxGroup`](/docs/runtime/#create-checkbox-group) from `@starwind-ui/runtime/checkbox-group` ## Changelog ### v1.0.1 - Updated React Runtime state synchronization so canceled proposals stay uncommitted and accepted changes remain aligned. ### v1.0.0 - Added Checkbox Group as a Runtime-backed component with grouped ownership and native form participation. - See the [Checkbox Group Primitive](/docs/primitives/checkbox-group/) for the underlying unstyled anatomy and behavior API. --- Source: [https://starwind.dev/docs/components/collapsible/](https://starwind.dev/docs/components/collapsible/) · [Markdown](https://starwind.dev/docs/components/collapsible.md) # Collapsible Collapsible, CollapsibleContent, CollapsibleTrigger, } from "@/components/starwind/collapsible";
```astro --- import { Button } from "@/components/starwind/button"; import { Collapsible, CollapsibleContent, CollapsibleTrigger, } from "@/components/starwind/collapsible"; import IconSelector from "@tabler/icons/outline/selector.svg"; ---

@starwind-ui starred 3 repositories

astro
tailwindcss
starwind-ui
```
```tsx import { Button } from "@/components/starwind/button"; import { Collapsible, CollapsibleContent, CollapsibleTrigger, } from "@/components/starwind/collapsible"; import { IconSelector } from "@tabler/icons-react"; export function Example() { return (

@starwind-ui starred 3 repositories

astro
tailwindcss
starwind-ui
); } ```
## Installation ```bash npx starwind@latest add collapsible ``` ## Usage ### General Notes The Collapsible component provides a way to show and hide content with a trigger button. It's useful for FAQs, expandable sections, and progressive disclosure patterns. The essential components are `Collapsible`, `CollapsibleTrigger`, and `CollapsibleContent`. ## API Reference ### Collapsible - Inherits div attributes. ### CollapsibleTrigger | Prop | Type | Required | Default | Kind | Description | | --- | --- | --- | --- | --- | --- | | `asChild` | `boolean` | No | `false` | Primitive override | Merges the component behavior and props into its child element. | - Inherits button attributes. ### CollapsibleContent - Inherits div attributes. ### Primitive And Runtime API Behavior, state, events, form participation, and imperative methods are documented in the lower-level references. - Primitive: [Collapsible Primitive](/docs/primitives/collapsible/) - Runtime factory: [`createCollapsible`](/docs/runtime/#create-collapsible) from `@starwind-ui/runtime/collapsible` ## Changelog ### v2.0.1 - Named the generated aggregate default export so React and Astro tooling can identify the installed component cleanly. ### v2.0.0 - Rebuilt Collapsible on Starwind Runtime for open state and panel lifecycle. - See the [Collapsible Primitive](/docs/primitives/collapsible/) for the underlying unstyled anatomy and behavior API. --- Source: [https://starwind.dev/docs/components/color-picker/](https://starwind.dev/docs/components/color-picker/) · [Markdown](https://starwind.dev/docs/components/color-picker.md) # Color Picker
```astro --- import { ColorPicker } from "@/components/starwind/color-picker"; const swatches = [ { value: "#ef4444", label: "Red" }, { value: "#f59e0b", label: "Amber" }, { value: "#10b981", label: "Emerald" }, { value: "#0ea5e9", label: "Sky" }, { value: "#8b5cf6", label: "Violet" }, ]; --- ```
```tsx import { ColorPicker } from "@/components/starwind/color-picker"; const swatches = [ { value: "#ef4444", label: "Red" }, { value: "#f59e0b", label: "Amber" }, { value: "#10b981", label: "Emerald" }, { value: "#0ea5e9", label: "Sky" }, { value: "#8b5cf6", label: "Violet" }, ]; export function Example() { return ( ); } ```
`ColorPicker` renders a complete popover editor when it has no children. The default editor includes the color area, hue and alpha sliders, exact value input, styled format selector, EyeDropper action, and any supplied swatches. It also appends the hidden form input automatically. ## Installation ```bash npx starwind@latest add color-picker ``` To vendor the unstyled adapter source for raw anatomy customization, run `starwind primitives add color-picker`. The [Runtime controller reference](/docs/runtime/#create-color-picker) documents the underlying behavior API. ## Usage ### Sizes `ColorPicker` owns trigger-side and inline anatomy. `ColorPickerContent` independently owns the portaled editor, because it cannot inherit styling state across the portal boundary. Both scopes accept `sm`, `md` (the default), or `lg`. Default composition passes the root size to its owned content automatically. `ColorPickerInput` accepts `formatContentSize` only for its nested Select popup. Use it when a custom editor needs that second portal to differ from the editor scope.
```astro --- import { ColorPicker, ColorPickerContent, ColorPickerTrigger, } from "@/components/starwind/color-picker"; ---

Small

Large

Independent popup size

Compact trigger
```
```tsx import { ColorPicker, ColorPickerContent, ColorPickerTrigger, } from "@/components/starwind/color-picker"; export function Example() { return (

Small

Large

Independent popup size

Compact trigger
); } ```
### Respond to color changes Use value changes for immediate UI such as previews. In React, control the picker with `value` and `onValueChange`. In Astro, listen for `starwind:value-change` on the root and read `event.detail.valueAsString`. For work that should happen only after an interaction finishes—such as persisting a preference—use React's `onValueCommitted` or Astro's `starwind:value-committed` event instead.
```astro --- import type { ColorPickerValueChangeDetails } from "@starwind-ui/astro/color-picker"; import { ColorPicker } from "@/components/starwind/color-picker"; const swatches = [ { value: "#10b981", label: "Emerald" }, { value: "#0ea5e9", label: "Sky" }, { value: "#8b5cf6", label: "Violet" }, ]; ---
```
```tsx import { parseColor, type ColorPickerColor, type ColorPickerFormat, } from "@starwind-ui/react/color-picker"; import { useState } from "react"; import { ColorPicker } from "@/components/starwind/color-picker"; export function Example() { const [value, setValue] = useState(parseColor("#4f46e5")); const [format, setFormat] = useState("hex"); const color = value?.toString("hex") ?? "transparent"; return (
); } ```
### Inline editor Set `inline` when people benefit from seeing the full editor without opening a popover, such as in a theme builder or design settings panel.
```astro --- import { ColorPicker } from "@/components/starwind/color-picker"; ---

Theme accent

Used for links, focus rings, and primary actions.

```
```tsx import { ColorPicker } from "@/components/starwind/color-picker"; export function Example() { return (

Theme accent

Used for links, focus rings, and primary actions.

); } ```
### Format controls and optional features - `format` accepts `"hex"`, `"rgb"`, `"hsl"`, or `"hsb"` and defaults to `"hex"`. - `formatControl="select"` uses the styled selector and is the default. Use `"native"` for a browser `
```
```tsx import type { FormEvent } from "react"; import { Button } from "@/components/starwind/button"; import { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, } from "@/components/starwind/dialog"; import { Input } from "@/components/starwind/input"; import { Label } from "@/components/starwind/label"; export function Example() { function handleSubmit(event: FormEvent) { event.preventDefault(); console.log( "Form submission values:", Object.fromEntries(new FormData(event.currentTarget).entries()), ); } return (
Edit profile Make changes to your profile here. Click save when you're done.
); } ```
### Multiple Triggers You can have multiple triggers open the same dialog, including external triggers outside the Dialog wrapper. Add an `id` to `` and pass that ID through `targetId` on each external ``.
```astro --- import { Button } from "@/components/starwind/button"; import { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, } from "@/components/starwind/dialog"; import { Input } from "@/components/starwind/input"; import { Label } from "@/components/starwind/label"; import { Textarea } from "@/components/starwind/textarea"; ---
Contact Us Send us a message and we'll get back to you shortly.