General
Button
Commands, navigation actions and the group that orders them.
import { ActionGroup, Button, IconButton, LinkButton, Link } from 'faifo-design'A Button runs a command; a LinkButton is a navigation that looks like a command; a Link is
inline navigation in text. IconButton is a named action shown as a symbol, and ActionGroup
orders several actions so a screen has one primary action and the rest stay quiet.
#When to use
- Use
Buttonfor something that changes data or state: save, confirm, add a line. - Use
LinkButtonwhen the action is a destination with its own URL, so the reader can open it in a new tab. - Use
Linkinside sentences and table cells. Do not style a link as a button to make it louder. - Give a view one
variant="primary"action.tone="danger"marks a destructive command; it does not replace the confirmation. - Default actions match the height of inputs so a button lines up with the field beside it.
size="compact"is an explicit choice for dense toolbars.
#Examples
Each example is a specimen of the package catalogue, rendered on the server exactly as shown in its code.
#Button
Primary, secondary, tertiary, destructive, loading and disabled states.
Show codeHide code
#Action sizes
Default matches input height; compact is explicit. Prominent is a compatibility alias.
Show codeHide code
import { ActionGroup, Button, Icon, IconButton, LinkButton } from 'faifo-design'
export const Example = () => (
<ActionGroup
label="Action sizes"
actions={[
<Button label="Compact" size="compact" />,
<Button label="Default" />,
<Button label="Prominent decision" size="prominent" variant="primary" />,
<IconButton label="Compact theme toggle" icon={<Icon name="moon" />} size="compact" />,
<IconButton label="Prominent theme toggle" icon={<Icon name="moon" />} size="prominent" />,
<LinkButton label="Open record" href="#data-table" variant="tertiary" icon="arrow-up-right" />,
]}
/>
)#API
Generated from the package source. A property without a description has none in the source yet.
#ActionGroupComponent
| Property | Description | Type | Default |
|---|---|---|---|
actionsrequired | – | readonly JSXChild[] | – |
label | – | string | null | – |
#ButtonComponent
| Property | Description | Type | Default |
|---|---|---|---|
labelrequired | – | string | – |
id | – | string | – |
variant | – | ActionVariant | 'secondary' |
tone | – | ActionTone | – |
icon | – | IconName | – |
fullWidth | – | boolean | – |
pressed | – | boolean | – |
size | – | ActionSize | 'default' |
leading | – | JSXChild | – |
disabled | – | boolean | – |
loading | – | boolean | – |
truncateLabel | Keep a long record value inside its control, with the whole value in the native tooltip. | boolean | – |
describedBy | – | string | null | – |
viewport | Shows the action at one width only. A page header folds a secondary action into its overflow menu on a phone: the button is wide, the menu item phone. | 'phone' | 'wide' | – |
logo | A brand-logo choice. The accessible label remains mandatory; the component owns logo geometry. | { src: string } | – |
type | – | 'button' | 'submit' | 'reset' | 'button' |
name | – | string | null | – |
value | – | string | null | – |
form | – | string | null | – |
formNoValidate | Submit without the form's own constraint checks: a step back in a multi-step form, or a command that carries no edit, must not be stopped by a required field the current step has not filled yet. | boolean | – |
expanded | For a button that shows or hides a region: whether that region is open now. | boolean | – |
controls | The id of the region an expanded button shows or hides. | string | null | – |
#IconButtonComponent
Named icon action with a native title; compose Tooltip for an enhanced description.
| Property | Description | Type | Default |
|---|---|---|---|
labelrequired | – | string | – |
id | – | string | – |
variant | – | ActionVariant | 'tertiary' |
tone | – | ActionTone | – |
fullWidth | – | boolean | – |
pressed | – | boolean | – |
size | – | ActionSize | 'default' |
disabled | – | boolean | – |
loading | – | boolean | – |
truncateLabel | Keep a long record value inside its control, with the whole value in the native tooltip. | boolean | – |
describedBy | – | string | null | – |
viewport | Shows the action at one width only. A page header folds a secondary action into its overflow menu on a phone: the button is wide, the menu item phone. | 'phone' | 'wide' | – |
type | – | 'button' | 'submit' | 'reset' | 'button' |
name | – | string | null | – |
value | – | string | null | – |
form | – | string | null | – |
formNoValidate | Submit without the form's own constraint checks: a step back in a multi-step form, or a command that carries no edit, must not be stopped by a required field the current step has not filled yet. | boolean | – |
expanded | For a button that shows or hides a region: whether that region is open now. | boolean | – |
controls | The id of the region an expanded button shows or hides. | string | null | – |
iconrequired | – | JSXChild | – |
#LinkButtonComponent
| Property | Description | Type | Default |
|---|---|---|---|
labelrequired | – | string | – |
id | – | string | – |
variant | – | ActionVariant | 'secondary' |
tone | – | ActionTone | – |
icon | – | IconName | – |
fullWidth | – | boolean | – |
size | – | ActionSize | 'default' |
leading | – | JSXChild | – |
disabled | – | boolean | – |
loading | – | boolean | – |
truncateLabel | Keep a long record value inside its control, with the whole value in the native tooltip. | boolean | – |
describedBy | – | string | null | – |
viewport | Shows the action at one width only. A page header folds a secondary action into its overflow menu on a phone: the button is wide, the menu item phone. | 'phone' | 'wide' | – |
hrefrequired | – | string | – |
iconOnly | Keep native link navigation with the named, square icon-action contract. | boolean | – |
#LinkComponent
Inline navigation. Use Button for commands and LinkButton for a navigation action.
| Property | Description | Type | Default |
|---|---|---|---|
labelrequired | – | string | – |
hrefrequired | – | string | – |
id | – | string | – |
tone | – | 'default' | 'muted' | 'danger' | 'inherit' | 'default' |
target | – | '_self' | '_blank' | – |
download | – | string | – |
describedBy | – | string | – |
#Types
#ActionSize
type ActionSize = 'compact' | 'default' | 'prominent' | 'large'#ActionTone
type ActionTone = 'default' | 'danger' | 'positive'#LinkProps
The properties of Link, listed above.
#ActionVariant
type ActionVariant = 'primary' | 'secondary' | 'tertiary' | 'destructive'#ButtonProps
The properties of Button, listed above.
#IconButtonProps
The properties of IconButton, listed above.
#LinkButtonProps
The properties of LinkButton, listed above.
#Hooks
The data-ui values these components render. Select them in tests and behaviour; their look belongs to the design system. See Contract.
actionaction-leadingaction-labelaction-spinneraction-logoaction-selectionaction-grouplink