Cadence Clinical

Button

Triggers an action. Sized by the density set on the page.

GradeTested

Usage

import { Button } from "@cadence-clinical/ui";

<Button onClick={save}>Save observation</Button>;

Button is built on the Base UI Button and accepts all of its props.

Variants

VariantUse
primaryThe main action in a view. Use one per view.
secondaryAn action of equal weight beside others.
outlineA lower-emphasis action that still needs a visible boundary.
ghostToolbar and inline actions.
destructiveAn action that stops, removes or cannot be undone. It is a solid critical fill so it cannot be overlooked.
linkNavigation in running text.

Write the label as the action and its object, such as "Cease medication". Avoid "OK" and "Confirm".

Sizes

The size prop is relative to the page's density. A md button is 32px high when the density is compact and 44px when it is comfortable.

Accessibility

  • An icon-only button must have an aria-label.
  • The focus ring uses the accent's text role, which holds at least 3:1 against the page in every mode.
  • The press animation is removed when the user asks for reduced motion.

Props

PropTypeDefault
variant"primary" | "secondary" | "outline" | "ghost" | "destructive" | "link""primary"
size"sm" | "md" | "lg" | "icon""md"

On this page