Skip to Content

Button

A brandless <button> element. No defaults are applied for colors — the component renders as a plain browser button until tokens are provided via a modifier class.

Demo

Usage

import { Button } from '@froglet/ui' <Button type="button" onClick={handleClick}> Save changes </Button> // Themed <Button className="button--primary">Primary</Button> <Button className="button--danger" type="button">Delete</Button> // With icon (gap is controlled by --button-gap) <Button className="button--primary"> <svg .../> Save </Button> // Icon-only (equal padding collapses to square) <Button className="button--primary" aria-label="Save" style={{ '--button-padding': '0.5rem' }}> <svg .../> </Button>

Props

PropTypeDescription
childrenReactNodeButton label. Supports text, icons, and other React nodes.
classNamestringAdditional CSS classes. Use to apply a token block.
refReact.Ref<HTMLButtonElement>Forwarded to the underlying <button>.
...propsButtonHTMLAttributes<HTMLButtonElement>All standard button attributes (type, disabled, etc.).

CSS Custom Properties

All color properties have no fallback and must be set by the consumer. Structural properties have neutral defaults.

TokenDefaultDescription
--button-background-colorBackground color.
--button-text-colorText color.
--button-border-colorBorder color.
--button-border-stylesolidBorder style.
--button-border-width2pxBorder width.
--button-border-radius0Corner radius.
--button-font-size1remFont size.
--button-padding0.5rem 1remInner padding.
--button-gap4pxGap between icon and text label.
--button-background-color-hoverBackground on hover.
--button-text-color-hoverText color on hover.
--button-outline-color-focusFocus ring color.
--button-outline-width-focus2pxFocus ring width.
--button-outline-offset-focus2pxFocus ring offset.
--button-background-color-disabledBackground when disabled.
--button-text-color-disabledText color when disabled.
--button-border-color-disabledBorder color when disabled.

Accessibility

  • Renders as a semantic <button> with full keyboard and screen reader support.
  • Focus is indicated via :focus-visible — keyboard users see the ring; pointer users do not.
  • disabled removes interactivity and updates visual state via the disabled token set.
  • Always provide a meaningful label via children or aria-label.
Last updated on