Skip to content
AstroCraft Docs
On this theme

Components Reference

The complete inventory of src/components/ui/. Each entry lists what the folder exports, its variant axes with every option, and the defaults. For the contract these all follow, see UI Components.

Import either way:

import { Button } from "@components/ui/button";
import { Card, CardHeader, CardTitle } from "@components/ui/card";

Each folder exports its tv() config for composition. A handful of components have no config of their own because they reuse another’s — those are noted.

Layout and surface

pixel-panelPixelPanel. elevated: true, false — default false (shadow-pixel-lg vs shadow-pixel). Takes an as prop to render as a section, article or div. The signature 8-BitQuest surface: bg-card with a 4px black frame and the hard offset pixel shadow.

cardCard, CardImage, CardHeader, CardTitle, CardDescription, CardAction, CardContent, CardFooter.

  • variant: default, elevated, outline, interactive — default default
  • size: sm, md, lg — default md

size works by setting a --card-p custom property the padded parts read, so a per-part padding override still wins. CardHeader reflows to two columns automatically when a CardAction is present.

separatorSeparator. orientation: horizontal, vertical — default horizontal.

tableTable, TableHeader, TableBody, TableFooter, TableRow, TableHead, TableCell, TableCaption. No variants. Table wraps itself in a horizontally scrollable container.

listList, ListItem.

  • marker: none, disc, decimal — default none. decimal renders an <ol>.
  • orientation: vertical, horizontal — default vertical. Horizontal is dot-separated inline.

ListItem takes an icon slot; the icon treatment is driven by slot presence, not a prop.

accordionAccordion, AccordionItem, AccordionTrigger, AccordionContent. No variants. Built on native <details>, so exclusive behaviour (a shared name) and keyboard support are free. The trigger chevron rotates on open.

skeletonSkeleton. No variants. animate-pulse with motion-reduce:animate-none.

avatarAvatar. size: sm, md, lg — default md. Takes src (a bundled ImageMetadata or a URL) and requires alt whenever src is set — it throws at build otherwise.

Actions and feedback

buttonButton.

  • variant: primary, secondary, outline, ghost — default primary
  • size: sm, md, lg — default md
  • icon: true — square, for icon-only buttons

Pass href and it renders an <a> instead of a <button>. Reused by DialogTrigger, DialogClose, DropdownTrigger, PaginationLink and the InputNumber steppers.

badgeBadge. variant: primary, secondary, muted, outline, info, success, warning, error — default primary. Plus a boolean pixel (default false) for the retro 2px-frame uppercase treatment.

alertAlert. variant: info, success, warning, error — default info. role="alert".

spinnerSpinner. size: sm, md, lg — default md. CSS-only, motion-reduce:animate-none, role="status".

progressProgress. size: sm, md, lg — default md. Props value and max. Determinate only.

tooltipTooltip. side: top, bottom, left, right — default top. CSS-only, revealed on hover and focus-within.

Forms

The text-entry primitives share a base and three states from _field.ts, so state behaves identically across them.

inputInput. size: sm, md, lg — default md. state: default, error, success — default default.

textareaTextarea. Same two axes, same defaults.

selectSelect. Same two axes, same defaults. A native <select> with a custom chevron.

labelLabel. size: sm, md, lg — default md.

checkboxCheckbox. No variants. A native input styled with appearance-none and peer.

radioRadio. No variants.

switchSwitch. No variants. A native checkbox styled role="switch"; the exported config is switchTrack (the track slot), and your class merges onto the root label. Zero JavaScript.

sliderSlider. size: sm, md — default md (no lg). A native range input styled through its pseudo-elements; WebKit has no progress pseudo-element, so only Firefox fills the track behind the thumb.

input-numberInputNumber. Reuses the input config (size, state); its steppers reuse Button. Ships a small script driving stepUp()/stepDown().

passwordPasswordInput, PasswordStrength, plus the exported scorePassword function and Strength type. PasswordInput reuses the input config. PasswordStrength has a size of sm or md (default md) and renders a four-segment meter.

comboboxComboBox, ComboBoxOption. ComboBox reuses the input config for size/state; the list wrapper’s recipe is comboboxList. Autocomplete over a filterable listbox.

advanced-selectAdvancedSelect. size: sm, md, lg — default md; state: default, error, success — default default. Backed by a visually hidden real <select>, so it submits in a plain form. Ships a script.

searchboxSearchbox, SearchboxItem. No variants; the exported searchbox recipe is just the outer wrapper. A ⌘K/Ctrl+K command palette built on the Dialog shell.

toggle-countToggleCount, ToggleCountValue. No variants. A Monthly/Annual-style toggle built on the Switch primitive; each ToggleCountValue swaps between its min/max text on toggle.

navNav, NavItem, NavLink.

  • Navorientation: horizontal, vertical — default horizontal
  • NavLinkvariant: underline, pills, segment, retro — default underline

retro is the theme’s pixel-menu link treatment. The active state is the caller’s aria-current="page"; the primitive only styles it. NavLink is reused by MegaMenuTrigger.

breadcrumbBreadcrumb, BreadcrumbItem, BreadcrumbLink, BreadcrumbPage, BreadcrumbSeparator. No variants. Used on the blog article, paired with the breadcrumb schema.

paginationPagination, PaginationItem, PaginationLink, PaginationEllipsis. No variants; PaginationLink reuses Button and takes isActive.

dropdownDropdown, DropdownTrigger, DropdownMenu, DropdownItem. DropdownMenu takes an align of start or end. DropdownTrigger reuses Button (default outline). Built on the native Popover API with arrow-key roving.

mega-menuMegaMenu, MegaMenuTrigger, MegaMenuPanel, MegaMenuItem. MegaMenuPanel takes columns: 1, 2 or 3 (default 3) and an align. The trigger reuses NavLink. Click-to-open, natural Tab order.

dialogDialog, DialogTrigger, DialogClose, DialogHeader, DialogTitle, DialogDescription, DialogFooter. No variants. A native modal <dialog>, so the focus trap, page inertness and Escape handling come free.

sheetSheet, plus re-exported SheetTrigger and SheetClose. side: right, left, top, bottom — default right. Content parts are Dialog’s; the shell is shared.

tabsTabs, TabsList, TabsTrigger, TabsContent. No variants. TabsTrigger and TabsContent each take a required value. The one tab primitive ships a script: roving Arrow, Home and End keys, degrading to all panels visible without JavaScript.

theme-toggleThemeToggle. No variants; it re-skins the global .pixel-btn class into a square icon button. The meteor/moon flip is pure CSS; the click handler toggles the class and persists the choice. Pairs with the pre-paint script in BaseHead.

Motion and display

revealReveal. The scroll-entrance wrapper.

  • animation: fade-in, fade-in-up, fade-in-down, fade-in-left, fade-in-right, zoom-in, blurred-fade-in, slide-up-fade, bounce-fade-in, flip-in-x, flip-in-y — default fade-in-up
  • range: entry, cover, contain, gradual, moderate, brisk, rapid — default entry
  • Plus as (default div) and animate. Zero-JS, native scroll timeline.

marqueeMarquee.

  • direction: left, right, up, down — default left
  • speed: slow, normal, fast — default normal
  • Plus pauseOnHover and repeat. Pure-CSS seamless loop; motion-reduce pauses it.

Icons

These two live in src/components/svg/, outside ui/, but follow the same contract. See Icons.

iconIcon. size: sm, md, lg, xl (size-4size-8) — default md. name is the typed IconName union over the 571-icon registry. currentColor; decorative unless given a title.

pixel-iconPixelIcon. size: sm, md, lg, xl (h-4h-8, width auto) — default md. name is the typed PixelIconName union over the 18-glyph pixel-art set. Sizes by height to preserve the non-square aspect ratios.

Components with no config of their own

These reuse another primitive’s tv() config, so they have no variant axes to list: DialogTrigger, DialogClose, SheetTrigger, SheetClose, DropdownTrigger, MegaMenuTrigger, PaginationLink, PasswordInput, InputNumber.

Seeing them all

pnpm dev, then /examples/ui. Every primitive in every variant, with a theme toggle in the header, plus the two icon registries and the motion catalog. It is development-only and ships no pages in production.

NEXT STEPCommands & Testing