Actions
Button
The call to action. Always pill-shaped, with a soft green outline and semibold DM Sans.
import { Button } from "@somewhere-com/ds";
<Button variant="primary" size="large">Start Hiring Now</Button>
<Button variant="secondary" href="/contact">Book a call</Button>
<Button variant="tertiary" size="small">Learn more</Button>
Props
variant:primary(default, highlight green) |secondary(soft green) |tertiary(coral, white text)size:small|regular(default) |large. Hero CTAs uselarge.href: renders an<a>and forwards every anchor attribute (target,rel,onClick,aria-*)disabled: on a button, the native attribute. On a link, it removeshrefand the click handler, and setsrole="link"andaria-disabled="true". The link can’t be followed or focused, but it’s still announced as a disabled link.type: defaults to"button". Use"submit"in forms.animateText: on hover, the label rolls up one character at a time (duration.regular,ease.in-out, 10ms stagger). Use it for marketing CTAs only, never in product UI. It only works with a plain-text label, and the label becomes thearia-labelunless you pass one. Reduced motion and touch skip the roll.refis forwarded.
With an icon
import { ArrowRightIcon, Icon } from "@somewhere-com/icons";
<Button>
Start Hiring Now
<Icon icon={ArrowRightIcon} />
</Button>;
Children are spaced with space.small (1rem). Put the icon before or after the label. It’s 1em, so it scales with the button’s text. Keep the icon decorative: the label names the action. Give an icon-only button an aria-label.
States
- Hover darkens the primary fill, on precise pointers only.
- Press scales the button to 0.97 over
duration.fastwithease.out. Reduced motion skips the scale. Disabled buttons don’t scale. - Focus-visible shows a 2px
color.focus-ringoutline. Inside inverse sections it switches tocolor.focus-ring-inverse. - Disabled uses
opacity.disabled. - There’s no loading state.
Accessibility
- It renders a native
<button>, so the browser handles the keyboard: Tab to focus, Enter or Space to activate. - As a link, it activates with Enter.
Do and don’t
- Do use one primary per view, with short action-led labels.
- Do use secondary as the alternative next to a primary. Use tertiary sparingly, for emphasis.
- Do use
hreffor navigation andonClickfor actions. - Don’t invent fills, square the corners, or use teal as a primary fill. Don’t restyle it with
className: add a variant to the system instead. - Known issue: tertiary (white on coral) is 3.46:1, below WCAG AA at every size. Pointing
color.button.tertiary.bgatbrand.secondary.700would give 6.22:1 with no component change. It’s pending a design decision.
Examples
Rendered from the Storybook stories. To change props and see every state live, open Button in Storybook.