Components
Button
Triggers an action. One clear primary per view; quieter variants for secondary paths.
When to use
Buttons commit to something , submit, confirm, navigate with intent. Prefer text links for low-emphasis navigation in body copy.
- Use for actions the user takes (Create, Save, Archive project).
- Prefer a single default (primary) button in a given region , sheet footers, dialogs, checkout.
- Use outline or ghost when the action is available but not the main path.
- Use destructive only for irreversible or harmful actions, and pair with a confirmation when needed.
Variants
Pick by hierarchy, not by colour preference.
Default
Primary action. Near-black fill. One per section when possible.
Secondary
Supporting action beside primary , soft grey fill, same weight of attention as outline in dense UIs.
Outline
Secondary on white surfaces. Common for Cancel, Back, or alternate CTAs.
Ghost
Tertiary , toolbars, table row actions, low emphasis. Needs a clear label; don’t rely on colour alone.
Link
Inline text action that still behaves as a button (forms, legal, “Learn more”). Underlines on hover.
Destructive
Delete, archive work, or remove access. Never use for neutral navigation.
Sizes
Default (h-9) matches inputs. Step down for dense tables; step up for marketing or empty states.
xs
Compact chips and dense admin rows.
sm
Secondary toolbars and filter bars.
Default
Forms, sheets, most product CTAs.
lg
Hero or onboarding primary when it must read larger.
Icon
Icon-only controls , always provide an accessible name.
States
Enabled
Hover darkens one step; press uses the darker press token.
Disabled
Opacity 50%, no pointer events. Prefer explaining why in nearby copy when the action is blocked.
With icon
Icons are 16px by default; keep labels short. Icon before label for “add”; after for “continue”.
Composition
How buttons sit together in real Memorisely surfaces.
Primary pair
Primary on the right (or full-width on mobile). Outline/ghost for dismiss.
Destructive pair
Destructive is the commit; outline keeps the safe path obvious.
Full width
Sheet and mobile footers , primary spans the content width.
Best practice
Do
- ✓Label with a verb the user understands (Create project, Send invite).
- ✓Match button height to adjacent inputs (default size).
- ✓Keep one primary visual weight in a footer or dialog.
- ✓Use asChild when the control should be a Next.js Link with button styling.
Don’t
- ×Stack multiple default (filled) buttons side by side.
- ×Use destructive for “Cancel” when leaving a harmless flow.
- ×Write vague labels like OK, Submit, or Click here.
- ×Rely on colour alone for meaning , pair with clear copy.
Accessibility
- Icon-only buttons need aria-label (or visible text).
- Focus ring uses the ring token , don’t remove outline styles.
- Disabled buttons are not focusable for action; if the user must discover why, keep an enabled control that explains the block.
- Prefer button for actions and Link (or asChild) for navigation.
components/ui/button.tsx · CVA variants · Slot asChild
Memorisely