Button Group

Group related buttons together for logical interaction, such as selecting options or triggering actions within a specific context.

Overview

ButtonGroups create primary, secondary, and tertiary hierarchy among a collection of actions in a container or surface.

Next
Back
Close
Save
Delete
Share

Example: ButtonGroup

  import { ButtonGroup, ButtonGroupItem } from '@skiff-org/skiff-ui';

  <ButtonGroup>
    <ButtonGroupItem label='Next' onClick={()=>{}} />
    <ButtonGroupItem label='Back' onClick={()=>{}} />
    <ButtonGroupItem label='Close' onClick={()=>{}} />
  </ButtonGroup>

  <ButtonGroup>
    <ButtonGroupItem label='Save' onClick={()=>{}} />
    <ButtonGroupItem destructive label='Delete' onClick={()=>{}} />
  </ButtonGroup>

  <ButtonGroup iconOnly>
    <ButtonGroupItem label='Share' onClick={()=>{}} />
    <ButtonGroupItem label='Copy' icon={Icon.Copy} onClick={()=>{}} />
    <ButtonGroupItem label='Download' icon={Icon.Export} onClick={()=>{}} />
    <ButtonGroupItem label='More options' icon={Icon.OverflowH} onClick={()=>{}} />
  </ButtonGroup>

Layout

ButtonGroups can be arranged inline (default) or stacked. For narrow width containers can be set to take the full width.

Next
Back
Close
Save
Delete

Example: Full width ButtonGroups

  import { ButtonGroup, ButtonGroupItem, Layout } from '@skiff-org/skiff-ui';

  <ButtonGroup fullWidth>
    <ButtonGroupItem label='Next' onClick={()=>{}} />
    <ButtonGroupItem label='Back' onClick={()=>{}} />
    <ButtonGroupItem label='Close' onClick={()=>{}} />
  </ButtonGroup>

  <ButtonGroup fullWidth layout={Layout.STACKED}>
    <ButtonGroupItem label='Save' onClick={()=>{}} />
    <ButtonGroupItem destructive label='Delete' onClick={()=>{}} />
  </ButtonGroup>

ButtonGroup Properties

  • Name
    children
    Type
    Array<ButtonGroupItem>
    Description

    Children button group elements

  • Name
    size
    Type
    ButtonGroupSize
    Description

    The size of the Buttons.

  • Name
    layout
    Type
    Layout
    Description

    The arrangement of the Buttons

  • Name
    fullWidth
    Type
    boolean
    Description

    Whether Buttons take the full width of the container.

  • Name
    iconOnly
    Type
    boolean
    Description

    Only display the icon for secondary buttons

ButtonGroupItem Properties

  • Name
    onClick
    Type
    (e: React.MouseEvent) => void | Promise<void>
    Description

    Called when the user clicks on the button.

  • Name
    label
    Type
    string
    Description

    Button text label.

  • Name
    disabled
    Type
    boolean
    Description

    Disable clicks and actions on the button.

  • Name
    destructive
    Type
    boolean
    Description

    For destructive actions

  • Name
    forceTheme
    Type
    ThemeMode
    Description

    Force the theme (dark or light mode) of the button, regardless of app theme.

  • Name
    hidden
    Type
    boolean
    Description

    Hide the button from the group.

  • Name
    loading
    Type
    boolean
    Description

    Display a spinner instead of the button label or icon.

  • Name
    icon
    Type
    Icon
    Description

    Icon displayed at start of the button

  • Name
    ref
    Type
    React.MutableRefObject<HTMLDivElement | null>
    Description

    Pass a reference to the button.