Button
A real <button>, type="button" unless told otherwise, so it never submits a form by accident.
import { Button } from '@ergasti/bricks';Examples
Variants
The looks of the mock's .btn family: default, ink, rasp, ghost and white. lime and on-dark have their own example below.
Code
import { Button } from '@ergasti/bricks';
function Variants() {
return (
<div style={{ display: 'flex', flexWrap: 'wrap', gap: 12 }}>
<Button>Default</Button>
<Button variant="ink">Ink</Button>
<Button variant="rasp">Rasp</Button>
<Button variant="ghost">Ghost</Button>
<Button variant="white">White</Button>
</div>
);
}Sizes and disabled
size="sm" is the compact button used in toolbars.
Code
import { Button } from '@ergasti/bricks';
function SizesAndDisabled() {
return (
<div style={{ display: 'flex', flexWrap: 'wrap', gap: 12, alignItems: 'center' }}>
<Button size="sm">Small</Button>
<Button>Medium</Button>
<Button disabled>Disabled</Button>
</div>
);
}Lime and on dark
variant="lime" is the sidebar's "Contact TRNDR" button, lime on the ink sidebar. variant="on-dark" is the outline button on the raspberry hero; it replaces className="kit-btn--on-dark", which still works.
Code
import { Button } from '@ergasti/bricks';
function OnDark() {
return (
<div style={{ display: 'grid', gap: 16 }}>
<div style={{ background: 'var(--ink)', borderRadius: 18, padding: 20, display: 'flex', flexWrap: 'wrap', gap: 12 }}>
<Button variant="lime">Contact TRNDR</Button>
<Button variant="lime" size="sm">Small</Button>
</div>
<div style={{ background: 'var(--rasp)', borderRadius: 18, padding: 20, display: 'flex', flexWrap: 'wrap', gap: 12 }}>
<Button variant="white">Top up</Button>
<Button variant="on-dark">Pay by bank transfer</Button>
</div>
</div>
);
}Danger and OK
variant="danger" (red words on a pale raspberry line) for "Remove creator" or "Reject"; variant="ok" (solid green) for "Approve".
Code
import { Button } from '@ergasti/bricks';
function DangerAndOk() {
return (
<div style={{ display: 'flex', flexWrap: 'wrap', gap: 12 }}>
<Button variant="danger">Remove creator</Button>
<Button variant="ok">Approve</Button>
<Button variant="danger" size="sm">Reject</Button>
<Button variant="ok" size="sm">Approve</Button>
</div>
);
}Props
Prop
Type
Also accepts the react and dom attributes of the element it renders; they are passed through.
Design guidance
How the BRICKS design system uses Button. Written in docs/content/components/Button.md; the props above are read from the code, which wins where the two disagree.
A pill-shaped action button in nine looks; use it for every in-page action (save, approve, export, open a dialog).
Button is the mock's .btn family: a real <button> that defaults to type="button", so it never submits a form by accident. Every looks is a variant on one base (14px 600 text, pill radius, --control-h minimum height, 1px line); variants change only colour. It passes every native button attribute through, so disabled, aria-*, form and onClick work as usual.
Anatomy
- Container (
button.kit-btn): inline-flex, 6px gap, padding 9px 16px, radius 99px, no wrap. - Label: the children (text, an
Icon, an arrow). - Icon (optional child
svg): 15px, strokecurrentColor.
Variants
The products differ (the brand book's "Choosing a button"): the Brand dashboard submits forms and dialogs in rasp; the PR Portal commits in ink and keeps rasp for creating and for confirming something destructive. Labels are the v3 mocks' own.
variant | Look | Brand dashboard | PR Portal |
|---|---|---|---|
'rasp' | Solid raspberry, white text; hover --rasp-d | The forward action of a page, card or dialog, every dialog submit: "Find creators", "+ Request a challenge", "Send request", "Save gift list", "Create group", "Send to TRNDR" | Creating and sending ("+ New", "Launch challenge", "Send"); the confirm of a destructive dialog ("Reject", "Pause program") |
'ink' | Solid ink, white text | Utility actions on a value: "Copy link", "Download PDF", "Invite", "Choose gift products" | Commits: "Save", "Approve", "Review", "Schedule", "Send invites" |
'default' | White card, --line border, ink text | Secondary actions and Cancel: "See all", "Raise limit?", "Export CSV", "Edit request" | Secondary actions, Cancel, and "Reject" beside an ink "Approve" in a queue row |
'ghost' | No border or fill, --rasp-d text; hover --rasp-50 | Not used in the Brand mock | Opening a secondary view: "View", "Review 3 join requests", "Change fee" |
'white' | White fill, raspberry text | On the raspberry hero: "Top up by card" | — |
'on-dark' | Transparent, 50 % white outline, white text | On the hero: "Where it went" | — |
'lime' | Lime fill, olive text | Help on ink: sidebar "Contact TRNDR" | The bulk bar's "Approve N" (PrBulkBar) |
'danger' | --rasp-100 border, --bad text | A standalone destructive button outside a queue; not drawn by the v3 mocks | same |
'ok' | Solid --ok green | A standalone approving button outside a queue; not drawn by the v3 mocks | same |
One raspberry button per page, card or dialog. Approve and reject in a queue are not a danger / ok pair: use ApprovalActions (Reject, then Approve in ink) in rows and drawers, and PrBulkBar for the bulk "Approve N" (lime).
size | Look | When |
|---|---|---|
'md' (default) | --control-h tall, 14px | Page and dialog actions |
'sm' | Padding 6px 12px, 13px; back to --control-h under 1024px for touch | Card headers, table rows, toolbars |
States
| State | Trigger | Look |
|---|---|---|
| Hover | pointer | Border darkens (#CFD1DA); rasp, ghost, on-dark and lime have their own hover |
| Focus-visible | keyboard focus | The shared kit ring: no outline, box-shadow: var(--focus-ring) (a 2px card-coloured gap, then a 2px raspberry ring) |
| Active | pressed | Moves down 1px (not when disabled; off under reduced motion) |
| Disabled | disabled | --disabled-opacity (0.5), default cursor, removed from the tab order |
| Busy / soft-disabled | aria-disabled="true" + className="kit-btn--off" | Same faded look, stays focusable (so a reason can be read) |
| Long label | long text | Does not wrap (white-space: nowrap); keep labels short |
Usage
A card header action:
<Card>
<Card.Header title="Seat usage" sub="How many creators your plan lets you have"
actions={<Button size="sm">Raise limit?</Button>} />
</Card>A Brand dialog footer: Cancel in default, the submit in rasp:
function RequestDialog() {
const [shown, setShown] = useState(true);
return (
<Modal open={shown} onClose={() => setShown(false)} title="Request a challenge"
hint="The TRNDR team reviews it, may adjust it, and switches it on."
footer={<>
<Button onClick={() => setShown(false)}>Cancel</Button>
<Button variant="rasp" onClick={() => setShown(false)}>Send request</Button>
</>}>
<FormField label="Challenge name"><input /></FormField>
</Modal>
);
}The page's forward action, and a PR queue row's decision (ApprovalActions: "Reject" in default, "Approve" in ink):
<>
<PageHeader title="Motivation" actions={<Button variant="rasp">+ Request a challenge</Button>} />
<ApprovalActions onApprove={() => console.log('approve')} onReject={() => console.log('reject')}
approveLabel="Approve Sara Ali into Glow Lab" rejectLabel="Reject Sara Ali" size="sm" />
</>On the raspberry hero:
<div style={{ display: 'flex', gap: 12, padding: 20, borderRadius: 20, background: 'var(--rasp)' }}>
<Button variant="white">Top up by card</Button>
<Button variant="on-dark">Where it went</Button>
</div>Where it appears
- Brand › Home › hero ("Top up by card" in
white, "Where it went" on the hero), Seat usage header ("Raise limit?"). - Brand › Motivation › "+ Request a challenge" and the request dialog's "Send request" (
rasp); Creators › Groups › "Create group" (rasp); Find creators › "Invite" (ink). - Brand › Payments › proof dialog "Download PDF" (
ink); list toolbars "Export CSV" (default,sm); every dialog "Cancel" (default). - PR Portal › dialogs "Save" (
ink) and "Cancel"; "Pause program" confirm (rasp); Approvals rows throughApprovalActions; the bulk bar "Approve N" (PrBulkBar, lime). - Screens: Home, Motivation, Find creators, Payments › Wallet, PR · Approvals, PR · Affiliate programs.
Guidelines
Do
- One
raspper page, card or dialog. - Brand dashboard: submit dialogs and forms in
rasp; useinkfor utility actions on a value (copy, download, invite). - PR Portal: commit in
ink; useraspto create or send, and for the confirm of a destructive dialog. - Cancel is
default, neverghost; order dialog buttons Cancel, then the action. - Write the action as a verb in sentence case ("Top up by card", "Export CSV"); use
size="sm"in card headers, rows and toolbars.
Don't
- Don't build approve/reject from
danger+ok; useApprovalActionsandPrBulkBar. - Don't use Button to navigate: use
ButtonLink. - Don't put long sentences in a button; it does not wrap.
RTL and Arabic
- Icons and arrows in the label are yours: flip a "→" to "←" in Arabic copy.
- Padding is symmetric; nothing else mirrors.
Tokens
--control-h, --line, --card, --ink, --rasp, --rasp-d, --rasp-50, --rasp-100, --bad, --ok, --lime, --olive, --btn-ghost-ink, --btn-ghost-hover, --btn-sm-pad, --disabled-opacity, --disabled-cursor, --focus-ring, --min-touch-target.
Accessibility
- A native
<button>: in the tab order, Enter and Space activate it,type="button"by default so it never submits a form by accident. - Name: its text. An icon-only button needs
aria-label. - Focus: the shared kit ring (
--focus-ring, 3:1 or more on every surface) placed last inkit.css, so no variant's own shadow hides it. disabledremoves it from the tab order; when the user must still reach it (to hear why it is off), usearia-disabled+kit-btn--offand describe the reason witharia-describedby.- Sizes: 38px tall (
--control-h) on desktop; on touch screens (≤1024px) it grows to 44px tall and at least 44px wide, andsmgrows to--control-htoo.
Found in the source
- Roles in the markup:
link. - ARIA attributes set:
aria-disabled. - Its tests cover: “has the same classes as Button for every variant and size”; “is a real link (role link) to the href, without target by default”; “Arabic + RTL: the new-tab words in Arabic; provider labels override them”; “passes other anchor props through and is reachable with Tab; Enter follows it”; “no rule dims every .kit-btn[aria-disabled]: a busy <Button aria-disabled> (TopUpAmountPicker) keeps its look”.
Read from the component's source and tests. See Accessibility for the patterns the library follows.
Related
ButtonLink: the same looks as a link (<a>).ProofButton: the small "View proof" link-button in tables.Segmented/PillTabs: choosing between options, not actions.
See also: Avatar · AvatarStack · CouponChip
Source
src/kit/primitives/Button.tsx (line 26) on GitHub.