Buttons
Four variants, three sizes, icon-only support, full state coverage. Buttons use inline-flex layout with consistent padding ratios and a 1px active press.
Variants
primary for the main call-to-action,
secondary for supporting actions (muted fill),
outline for bordered actions without fill,
ghost for tertiary or de-emphasized actions.
Sizes
Three size tiers. Padding scales disproportionately — larger buttons get more generous horizontal padding. Border radius shifts from rounded-sm at small to rounded-md at medium and large.
| Size | Font | Padding | Radius | Use case |
|---|---|---|---|---|
| sm | text-sm (14px) | px-4 py-2 | rounded-sm (2px) | Inline actions, table rows, tight layouts |
| md | text-base (16px) | px-6 py-3 | rounded-md (4px) | Default — forms, cards, general actions |
| lg | text-lg (18px) | px-8 py-4 | rounded-md (4px) | Hero CTAs, landing page emphasis |
With Icons
Icons sit inside the button's gap-2 flex layout. Use trailing icons for forward navigation, leading icons for contextual actions. Icon size should match the font size tier.
Icon Only
Square buttons with equal padding on all sides. Requires aria-label for accessibility since there's no visible text.
Disabled
Disabled buttons get opacity-50 and cursor-not-allowed. Works across all variants.
As Link
as="a" renders an <a> element with button styling. Pass href, target, and rel as normal. All variants and sizes work.
Common Pairings
Buttons rarely appear alone. Primary + secondary for decision points, primary + ghost for soft dismissal, size-matched pairs for visual balance.
Hero CTA pair
Form actions
Card actions
Inline navigation
Anatomy
Class construction breakdown for the default primary button. The Astro component assembles these from variant and size props. All states use real pseudo-classes — hover, click, and tab to see them.
inline-flex items-center justify-center gap-2 font-semibold cursor-pointer text-lg px-8 py-4 rounded-md bg-primary text-primary-foreground hover:bg-primary-hover active:bg-primary-active active:translate-y-px focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-2 transition-colors duration-fast ease-default