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.

primary
secondary
outline
ghost

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.

sm
md (default)
lg
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.

trailing icon
leading icon
lg + icon
sm ghost + icon

Icon Only

Square buttons with equal padding on all sides. Requires aria-label for accessibility since there's no visible text.

sm
md
lg
outline
ghost

Disabled

Disabled buttons get opacity-50 and cursor-not-allowed. Works across all variants.

disabled
disabled
disabled
disabled

As Link

as="a" renders an <a> element with button styling. Pass href, target, and rel as normal. All variants and sizes work.

Get Started primary link
View Docs outline link
Learn More secondary link
Cancel ghost link

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

Page 3 of 12

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.

Layout inline-flex items-center justify-center gap-2
Type font-semibold cursor-pointer
Size (lg) text-lg px-8 py-4 rounded-md
Color bg-primary text-primary-foreground
Hover hover:bg-primary-hover
Active active:bg-primary-active active:translate-y-px
Focus focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-2
Motion transition-colors duration-fast ease-default