Search the documentation

Type to search page titles, component names and descriptions.

    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 Button for something that changes data or state: save, confirm, add a line.
    • Use LinkButton when the action is a destination with its own URL, so the reader can open it in a new tab.
    • Use Link inside 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.

    Read the action rules
    Show codeHide code
    import { ActionGroup, Button, Icon, IconButton, Link, LinkButton } from 'faifo-design'
    
    export const Example = () => (
      <ActionGroup
        label="Button variants"
        actions={[
          <Button label="Create order" variant="primary" icon="plus" />,
          <Button label="Save draft" variant="secondary" />,
          <Button label="More details" variant="tertiary" />,
          <Button label="Terminate" variant="secondary" tone="danger" />,
          <Link label="Read the action rules" href="/primitives#primitive-actions" />,
          <Button label="Saving" loading />,
          <Button label="Unavailable" disabled />,
          <LinkButton label="Opening record" href="#record-page" loading />,
          <IconButton label="Toggle theme" icon={<Icon name="moon" />} />,
          <LinkButton label="Open record" href="#record-page" icon="package" iconOnly />,
          <Button label="Collapse details" variant="tertiary" expanded controls="button-details" />,
          <Button label="A very long customer name remains available in the tooltip" truncateLabel />,
          <Button
            label="Selected brand choice"
            logo={{
              src: `data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 80 24"><text x="40" y="18" text-anchor="middle" fill="#5856d6" font-family="sans-serif" font-size="18">Sample</text></svg>')}`,
            }}
            pressed
          />,
        ]}
      />
    )

    #Action sizes

    Default matches input height; compact is explicit. Prominent is a compatibility alias.

    Open record
    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

    PropertyDescriptionTypeDefault
    actionsrequired–readonly JSXChild[]–
    label–string | null–

    #ButtonComponent

    PropertyDescriptionTypeDefault
    labelrequired–string–
    id–string–
    variant–ActionVariant'secondary'
    tone–ActionTone–
    icon–IconName–
    fullWidth–boolean–
    pressed–boolean–
    size–ActionSize'default'
    leading–JSXChild–
    disabled–boolean–
    loading–boolean–
    truncateLabelKeep a long record value inside its control, with the whole value in the native tooltip.boolean–
    describedBy–string | null–
    viewportShows 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'–
    logoA 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–
    formNoValidateSubmit 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–
    expandedFor a button that shows or hides a region: whether that region is open now.boolean–
    controlsThe 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.

    PropertyDescriptionTypeDefault
    labelrequired–string–
    id–string–
    variant–ActionVariant'tertiary'
    tone–ActionTone–
    fullWidth–boolean–
    pressed–boolean–
    size–ActionSize'default'
    disabled–boolean–
    loading–boolean–
    truncateLabelKeep a long record value inside its control, with the whole value in the native tooltip.boolean–
    describedBy–string | null–
    viewportShows 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–
    formNoValidateSubmit 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–
    expandedFor a button that shows or hides a region: whether that region is open now.boolean–
    controlsThe id of the region an expanded button shows or hides.string | null–
    iconrequired–JSXChild–

    #LinkButtonComponent

    PropertyDescriptionTypeDefault
    labelrequired–string–
    id–string–
    variant–ActionVariant'secondary'
    tone–ActionTone–
    icon–IconName–
    fullWidth–boolean–
    size–ActionSize'default'
    leading–JSXChild–
    disabled–boolean–
    loading–boolean–
    truncateLabelKeep a long record value inside its control, with the whole value in the native tooltip.boolean–
    describedBy–string | null–
    viewportShows 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–
    iconOnlyKeep native link navigation with the named, square icon-action contract.boolean–

    Inline navigation. Use Button for commands and LinkButton for a navigation action.

    PropertyDescriptionTypeDefault
    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.

    • action
    • action-leading
    • action-label
    • action-spinner
    • action-logo
    • action-selection
    • action-group
    • link