Button
Status: stableAccessibility reviewedtenet-ui@0.4.0
import { Button } from 'tenet-ui';Also accepts every prop of ButtonHTMLAttributes<HTMLButtonElement>.
Source: src/components/Button/Button.tsx
Usage guidelines
Section titled “Usage guidelines”When to use: a Button triggers an action (submit, save, delete, open). For navigation to another page, use a link, not a Button.
- Use exactly one
variant="primary"per surface — the single most important action. - Use
variant="default"for secondary actions,variant="invisible"for low-emphasis / tertiary actions. - Use
variant="danger"only for destructive actions (delete, remove); pair it with a confirmation. - Never hardcode colors, padding, or sizes. All colors come from
fgColor/bgColor/borderColortokens; all spacing from thespacescale; heights fromcontrol.*. - Always provide a visible text label. Icon-only buttons must use
IconButtonwith anaria-label; icons come fromtenet-ui/iconsand go inleadingIcon/trailingIcon(decorative). - Do not nest interactive elements (links, buttons) inside a Button.
- Use
fullWidthto fill the container (inside aStack.ItemorGrid.Item);blockis the deprecated 0.3.0 name and warns. - Labels are verbs that name the outcome (“Save changes”, “Delete article”), sentence case, never “Submit” or “OK”.
Do / Don’t
Section titled “Do / Don’t”- ✅
<Button variant="primary">Save changes</Button> - ❌
<button style={{ background: '#0969da', padding: '13px' }}>Save</button>— raw element, hardcoded color, off-scale padding. - ❌
<Button kind="primary">—kindis not a prop; the prop isvariant.
See also: IconButton for icon-only actions, Link for navigation; system guidelines content (button labels) and color (one primary per surface).
Examples
Section titled “Examples”7 stories for Button — open in Storybook
- Default
components-button--default - Primary
components-button--primary - Danger
components-button--danger - Invisible
components-button--invisible - Sizes
components-button--sizes - With Leading Icon
components-button--with-leading-icon - With Trailing Icon
components-button--with-trailing-icon
The full matrix (all args, controls, accessibility panel) is in Storybook.
| Prop | Type | Default | Description |
|---|---|---|---|
variant | 'default' | 'primary' | 'danger' | 'invisible'ButtonVariant | default | Visual style of the button. Use primary for the single most important action per surface. |
size | 'small' | 'medium' | 'large'ButtonSize | medium | Control height / padding scale. |
leadingIcon | ReactNode | — | Icon rendered before the label. |
trailingIcon | ReactNode | — | Icon rendered after the label. |
fullWidth | boolean | — | Stretch the button to fill the available width. |
blockdeprecated | boolean | — | Stretch the button to fill the available width. Deprecated since 0.4.0. Use fullWidth instead (renamed in 0.4.0). block keeps working until 0.5.0. |
children | ReactNode | — | Button label. |
Deprecated props keep working for one minor release; the replacement is named in the row.