DocsBlog

Get Started

Components

Data Grid

Signals

Styling

Theming

↑↓Navigate
↵Select
EscClose
  • 1.8.0

  • Day

    Night

    Preview

    Switch mode
  • cerberus

    acheron

    elysium

    oceanus

Get Started
Components
Data Grid
Signals
Styling
Theming

Concepts

OverviewCompositionCerberus ContextTesting

Layout

Aspect RatioBleedBoxCenterContainerContainer QueryDividerFlexFloatGridGroupLink OverlayScrollableStackWrap

Components

AccordionAdmonitionAvatarButtonCarouselCheckboxClipboardCollapsibleComboboxConfirm ModalCTA ModalDate PickerDialogFieldFieldsetFile UploaderIconButtonInputLoading StatesMarqueeMenuNotificationsNumber InputPaginationPin InputPopoverProgress IndicatorsPrompt ModalRadioRatingSelectSliderSplit ButtonSwitchTableTabsTagTextTextareaToggleTooltip

Utilities

Client OnlyDownload TriggerEnvironmentFeature FlagsFocus TrapForFormat ByteFormat NumberFormat Relative TimeFormat Relative TimeFrameHighlightJSON Tree ViewLocalePortalPresenceShowSwapsplitPropsTheme

Button

Used to trigger actions or events.

  • npm
  • source
  • recipe
View as Markdown
Open this page in Markdown
Anthropic
Open in Claude
Ask questions about this page
OpenAI
Open in ChatGPT
Ask questions about this page

Import

import { Button } from '@cerberus/react'

Usage

Loading example...

With Icon

To display an icon, use the ButtonParts API.

Loading example...

Note

When using the pending prop, the icon will be replaced with a spinner.

Pending

To display a loading state, use the ButtonParts.Icon and set the pending prop to true.

Loading example...

Shapes

Use the shape prop to set the shape of the button. The Button component comes in three shapes: default, sharp and rounded.

Loading example...

Usage

Use the usage prop to set the usage style of the button. The Button component comes in three usage styles: filled, outlined, and ghost.

Loading example...

Sizes

Use the size prop to change the Button size. The options are xs up to 2xl.

Loading example...

Group

You can group buttons together using the ButtonGroup component.

Loading example...

Attached Button Group

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

Loading example...

Primitives

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

ComponentDescription
Button.RootThe context provider for the Button parts
Button.IconThe icon/spinner of the button
Loading example...

Global Customization

To enable global customization, you can modify the theme configuration in your panda.config.ts file. For example, to customize the button component globally:

Loading example...

This change will set the default shape variant of all buttons to default.

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.
sizelgThe size 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.

On this page

  • Import
  • Usage
    • With Icon
  • Pending
  • Shapes
  • Usage
  • Sizes
  • Group
    • Attached Button Group
  • Primitives
  • Global Customization
  • API
    • Props
      • ButtonGroup Props
Edit this page on Github
Copy
import { createCerberusConfig } from '@cerberus/panda-preset'

export default createCerberusConfig({
  // ...
  theme: {
    extend: {
      recipes: {
        button: {
          defaultVariants: {
            shape: 'default',
          },
        },
      },
    },
  },
})