WFP logoDesign System

Displays a button or a component that looks like a button.

Installation

pnpm dlx shadcn@latest add https://designsystem.wfp.org/r/button.json

Usage

import { Button } from "@/components/ui/button";
<Button variant="outline" size="lg">
  Button
</Button>

Examples

Sizes

SizeUsage
smCompact spaces, secondary actions
defaultStandard button size, most common use case
lgProminent actions, hero sections
icon-smSmall icon-only buttons
iconIcon-only buttons, requires aria-label
icon-lgLarge icon-only buttons

Variants

VariantUsage
defaultPrimary action. Ideally, no more than one per screen.
destructivePrimary destructive actions like Delete, Deactivate.
successPrimary positive actions like Approve, Activate.
secondarySecondary actions.
destructive-secondarySecondary destructive actions, like Delete, Deactivate.
success-secondarySecondary positive actions like Approve, Activate.
outlineTertiary actions; slightly less prominent than Secondary.
ghostSubtle actions. Good in dense contexts, like tables and lists.
linkA button that looks like a link.

Loading state

You can combine the Spinner component with buttons to indicate loading states.

API reference

Button

PropType
variant"default" | "destructive" | "success" | "secondary" | "destructive-secondary" | "success-secondary" | "outline" | "ghost" | "link"
size"xs" | "sm" | "default" | "lg" | "icon-xs" | "icon-sm" | "icon" | "icon-lg"
asChildboolean