• Docs
  • Blog
    • 0.24.0

    • Switch to dark mode
    Get Started
    Components
    Styling
    Theming

    Concepts

    OverviewCompositionTesting

    Layout

    Aspect RatioBleedBoxCenterContainerDividerFlexFloatGridLink OverlayScrollableStackWrap

    Components

    AccordionAdmonitionAvatarButtonCarouselCheckboxClipboardCollapsibleComboboxConfirm ModalCTAModalDate PickerDialogFieldFieldsetFile UploaderIcon ButtonInputLoading StatesMenuNotificationsNumber InputPin InputProgressPrompt ModalRadioRatingSelectSplit ButtonSwitchTableTabsTagTextTextareaToggleTooltip

    Utilities

    Feature FlagsForLocal StoragePortalShowsplitPropsTheme

    Button

    Used to trigger actions or events.

    • npm
    • source
    • recipe
    import { Button, ButtonParts, ButtonGroup } from '@cerberus/react'

    Basic Usage

    With Icon

    To display an icon, you can use the ButtonParts.Icon component.

    Pending

    To display a loading state, use the ButtonParts.Icon and set the pending prop to true. This will show a spinner in place of the icon.

    Shapes

    The Button component comes in two shapes: sharp and rounded. You can set the shape by using the shape prop.

    Usage

    The Button component comes in three usage styles: filled, outlined, and ghost. You can set the usage by using the usage prop.

    Sizes

    The Button component comes in two sizes: sm, md. You can set the size by using the size prop.

    Group

    You can group buttons together using the ButtonGroup component.

    Attached Button Group

    You can create an attached button group by setting the layout prop to attached.

    Primitives

    You can utilize the primitive components or the css prop to customize the button.

    ComponentDescription
    ButtonThe context provider for the Button parts
    ButtonIconThe icon/spinner of the button

    API

    Props

    The Button component is an abstraction of the primitives and accepts the following props:

    NameDefaultDescription
    paletteactionThe color palette (any of the Cerberus palettes) of the button.
    usagefilledThe style treatment of the button.
    shapesharpThe shape of the button.
    pendingfalseThe loading state of the button. When a button has an Icon it will replace it with a spinner. When not, is shows a disabled state.
    asChildRender the Button as the child component.

    ButtonGroup Props

    NameDefaultDescription
    layoutdefaultThe layout of the button group. Can be default or attached.
    shapesharpThe shape of the buttons in the group. Should match the shape prop of the Button components used.

    Parts

    The ButtonParts API is an Object containing the full family of components.

    Note

    It is best to only use the ButtonParts if you are building a custom solution. Importing Object based components will ship every property it includes into your bundle, regardless if you use it or not.

    NameDescription
    RootThe Button component which is the Provider for the family.
    IconThe ButtonIcon component which dynamically replaces an icon with a Spinner when the state is pending.

    On this page

    • Edit this page on Github
    Cerberus Design System | Docs