Starwind UI
Astro components and design-system primitives installed as source code into the user's project via the Starwind CLI. Starwind UI is designed for Astro v6 and Tailwind CSS v4.
IMPORTANT: Run CLI commands from the user's project root using the project's package runner:
,
/
, or
, based on
, lockfiles,
, or user instruction.
Examples below use
, but substitute the correct runner for the project.
Current Project Context
Build project context from local files before editing:
- , lockfiles, and -> package runner and dependency commands.
- -> Astro project shape and Tailwind/Vite setup.
- -> , , base color, and installed component list.
- Active Starwind CSS file -> global tokens, , , , and sidebar tokens.
- Installed component directory, commonly -> available imports and local source.
- Local component exports -> final authority for component part names when docs and local code differ.
Principles
- Use existing components first. Check Starwind docs, MCP, search, local components, or registry metadata before writing custom UI.
- Compose, don't reinvent. Settings page = Tabs + Card + form controls. Dashboard = Sidebar + Card + Table + feedback primitives. Searchable select = Select + SelectSearch.
- Use built-in variants before custom styles. , , , etc.
- Use semantic colors and tokens. , , , ; avoid raw palette utilities when a semantic token exists.
- Astro syntax first. Use , , browser scripts, and component imports unless the local project intentionally uses a framework island.
Critical Rules
These rules are always enforced. Each links to a focused reference file.
Styling & Tailwind -> styling.md
- is for layout and scoped exceptions. Do not override component colors or typography with long utility strings when variants or tokens exist.
- No or in new code. Use or with .
- Use when width and height are equal. , not .
- Use shorthand. Do not spell out
overflow-hidden text-ellipsis whitespace-nowrap
.
- No manual color overrides for global themes. Change and variables in the active Starwind CSS file.
Forms & Inputs -> forms.md
- Astro forms use semantic markup, Label, controls, and ARIA. Starwind does not use shadcn's React / API.
- Use , not . Match to the control .
- Preserve on controls that submit.
- uses or . Never put raw or inside .
- Buttons inside inputs use and .
- Validation pairs with . Do not rely on color alone.
Component Structure -> composition.md
- Items stay inside groups. -> , -> , -> , -> .
- Use only when the Starwind component documents it. Common triggers support it, but verify from current docs or local exports.
- Dialog, Sheet, and AlertDialog need titles. Use , , or ; is fine when visually hidden.
- Use full Card composition. , , , , , and when relevant.
- Button has no / . Compose loading with , , and .
- belongs inside .
- always needs .
Use Components, Not Custom Markup -> composition.md
- Use existing components before custom markup.
- Callouts use .
- Toast uses Starwind + one , not a custom toast stack.
- Use instead of raw or border-only dividers.
- Use for loading placeholders.
- Use for active progress.
- Use for status labels.
- Combobox is the Select pattern. Install , then use ; do not run .
Icons -> icons.md
- Prefer the project's existing icon system. Do not assume Tabler just because Starwind examples often use .
- Do not import React icon packages in plain Astro components unless the project uses a React island for that component.
- Icon-only buttons need an accessible name. Use or visible text.
- Let components size common SVG children unless a specific documented override is needed.
Customization -> customization.md
- Theme globally through CSS variables first.
- Edit the active Starwind CSS file from ; do not create a second theme file.
- Preserve , , , sidebar tokens, keyframes, and component-specific variables.
- Starwind dark mode is class-based through . Do not switch to a data-theme system unless the app already bridges that model.
- For shadcn-style theme migration, merge semantic values into Starwind tokens. See shadcn-migration.md.
CLI -> cli.md
- Only use documented Starwind commands and flags.
- Do not invent shadcn CLI features such as , , , presets, templates, , , , or .
- overwrites local component changes. Only update when the user asks or accepts overwrite risk.
- After , read the added files and fix alias drift, icon-library drift, missing imports, and rule violations.
Key Patterns
These are common patterns that differentiate correct Starwind UI code.
astro
---
import { Button } from "@/components/starwind/button";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/starwind/card";
import { Input } from "@/components/starwind/input";
import { Label } from "@/components/starwind/label";
import { Spinner } from "@/components/starwind/spinner";
---
<!-- Astro syntax: class + for, not className + htmlFor -->
<div class="grid gap-2">
<Label for="email">Email</Label>
<Input id="email" name="email" type="email" aria-invalid="false" />
</div>
<!-- Loading button: compose with Spinner, not isLoading/isPending -->
<Button disabled aria-busy="true">
<Spinner />
Saving...
</Button>
<!-- Card composition: header/content parts, not one generic bordered div -->
<Card>
<CardHeader>
<CardTitle>Workspace</CardTitle>
</CardHeader>
<CardContent>Project settings</CardContent>
</Card>
Component Selection
| Need | Use |
|---|
| Button/action | with documented variants and sizes |
| Form inputs | , , , , , , , , , , |
| Searchable select / combobox | with |
| Option toggle | ; use documented group/patterns if the local project has one |
| Data display | , , , , , |
| Navigation | , , , , |
| Overlays | , , , , , |
| Menus | , |
| Feedback | , , , , |
| Media | , , , |
| Layout/disclosure | , , , |
| Theme toggle | |
Key Fields
- -> source of , , base color, and installed component list.
- -> active Starwind CSS file for theme variables. Always edit this file for global theme work.
- -> component install root. The Starwind subdirectory is commonly .
- -> installed component names when present in config.
- / lockfiles -> use this for the Starwind runner and dependency installs.
- -> confirms Astro/Vite/Tailwind setup.
- Local exports -> exact import names for installed component parts.
- Icon imports in nearby files -> preferred icon package and import style.
Component Docs, Examples, And Usage
Use the freshest Starwind context available:
bash
npx starwind@latest docs button dialog select --json
Then fetch and read the returned docs or Markdown URLs before implementing. When tools are available, prefer Starwind MCP
for live docs and
for install command generation. Local project source remains the final authority for already-installed components.
When creating, fixing, debugging, or using a component, always read the relevant docs or local component source first. Do not guess props, events, or composition from memory.
Workflow
- Get project context -> read , lockfiles, Astro config, , active Starwind CSS, installed component directory, and local exports.
- Check installed components first -> do not import components that have not been added, and do not re-add ones already installed unless the user asked to update.
- Find components -> use Starwind MCP,
npx starwind@latest search
, docs, , , , or installed registry metadata.
- Get docs and examples -> use Starwind MCP or
npx starwind@latest docs <component> --json
, then fetch the docs content.
- Install missing components -> use
npx starwind@latest add <component>
with the correct package runner and documented flags.
- Review added files -> read new component/block files before wiring them in. Fix import aliases, icon imports, missing subcomponents, Astro syntax, and Critical Rules violations.
- Compose before editing internals -> use documented props, variants, , semantic tokens, and wrappers before changing installed component source.
- Keep changes scoped -> preserve project patterns and avoid unrelated refactors.
Updating Components
Starwind components are local source files after installation.
CAUTION: npx starwind@latest update
overwrites local component changes.
When the user asks to update a component while preserving local changes:
- Read the local component files and where they are imported.
- Read current docs or source for the target component.
- Decide whether to manually merge the needed upstream changes or ask approval to run .
- Use
npx starwind@latest update <component>
only when the user asks for it or accepts overwrite risk.
- Use only when the user explicitly wants every installed component updated.
Quick Reference
bash
# Initialize Starwind UI
npx starwind@latest init
npx starwind@latest init --defaults
npx starwind@latest init --pro
# Add components
npx starwind@latest add button card dialog
npx starwind@latest add select
npx starwind@latest add theme-toggle
# Add all components
npx starwind@latest add --all
# Search components and Pro blocks
npx starwind@latest search select
npx starwind@latest search hero --json
npx starwind@latest search pricing --plan free --category pricing --limit 10 --json
# Get docs references
npx starwind@latest docs button dialog select --json
# Configure Starwind Pro in an existing project
npx starwind@latest setup
npx starwind@latest setup --yes
# Update or remove components
npx starwind@latest update button
npx starwind@latest remove button
Detailed References
- rules/forms.md -> labels, controls, InputGroup, Select, validation
- rules/composition.md -> groups, overlays, Card, Tabs, Avatar, Toast, Separator, Skeleton, Spinner, Badge, Button loading
- rules/icons.md -> Astro icon imports, icon buttons, icon-library drift
- rules/styling.md -> semantic colors, variants, class, spacing, size, truncate, dark mode, z-index
- cli.md -> Starwind commands, flags, Pro setup, and missing shadcn CLI features
- customization.md -> theming, CSS variables, dark mode, extending components
- shadcn-migration.md -> mapping shadcn-style theme tokens to Starwind
- mcp.md -> MCP and AI docs source priority
Load only the references needed for the current task.