ButtonGroup

Type: React component

How to get ButtonGroup?

JavaScript

import { ButtonGroup } from 'fds/components';

A group of buttons. A buttons presented in a ButtonGroup can be selected, which will cause this button to be selected. Only one of the buttons can be selected at a time.

Keyboard behavior:

  • Enter: call the onItemClick prop of the focused button.

Props

  1. isDisabled

    (Optional)

    Type: Boolean

    Whether or not the component should be rendered in a disabled state.

    Default value

  2. isFullWidth

    (Optional)

    Type: Boolean

    Whether or not the component grows to the full available width.

    Default value

  3. items

    (Required)

    Type: Array<Object>

    An item with a property with a string value to display and a property to hold the actual value.

    Properties

  4. onItemClick

    (Required)

    Type: Function

    A callback that is called whenever a rendered item is clicked and is not in a disabled state.

    Arguments

  5. selectedItem

    (Optional)

    Type: Object

    The item that is visually presented in a selected state. Expects an item in the same shape as expected by the "items" property.

    Default value