MiHCM
primitives/@mihcm/ui·v0.21.0·stable

Button

Primary action affordance. Seven variants, six sizes, icon slots, rounded or hard-edge shapes, and tokenized Tailwind class overrides. Universal across web and native.

Use cases

  • Primary call-to-action (variant="default") — one per region, the most important action.
  • Accent call-to-action (variant="accent") — branded emphasis that should not replace the primary action.
  • Destructive confirmation (variant="destructive") — delete, archive. Always pair with a confirm flow.
  • Secondary action alongside a primary (variant="outline" or variant="secondary").
  • Inline action without a strong border (variant="ghost").
  • Link-styled action within prose (variant="link").

When NOT to use

  • For navigation that is purely a link with no side effect → use a <Link/> directly.
  • For toggle state → use a Toggle / Switch (planned).

Variants

VariantUse when
defaultThe primary action in a context. One per region.
accentBrand-accent emphasis for secondary CTAs.
destructiveConfirming a destructive action (delete, archive).
outlineSecondary alongside a primary.
secondaryAlternative when "outline" is too quiet for the brand context.
ghostTertiary, in toolbars, low-density rows.
linkInline within prose, where a button would feel heavy.

Sizes

SizeHeightUse when
sm32pxDense toolbars, secondary actions in tables.
md40pxDefault for most desktop UIs.
lg44pxMobile primary actions (44px touch-target rule).
xl48pxPage-level primary actions and large modal footers.
xxl56pxProminent mobile actions and hero-size form submissions.
icon44×44Icon-only square. Always pair with aria-label.

Shape

ShapeUse when
roundedDefault button shape.
hardSquare edge for enterprise grids, toolbars, and edge-aligned action bars.

Composition

  • Pair with leadingIcon / trailingIcon (from @mihcm/icons) for affordance.
  • Use IconButton for icon-only actions. It fixes size="icon" and requires an accessible label.
  • For loading states, use isLoading — sets aria-busy and disables interaction.
  • For disabled states, use disabled directly. The visual treatment is the same as loading; aria-busy is the differentiator for assistive tech.
  • Buttons render semantic <button> elements on web and default to type="button". Use type="submit" only for the primary submit action in a real form, and type="reset" only for intentional reset behavior.
  • Text — typography primitive.
  • Link — semantic navigation and reference primitive.
  • Planned: ButtonGroup, Toggle.