DocsBlog
  • 0.25.3

  • light

    dark

    system

    Switch mode
  • Cerberus

    Acheron

    Elysium

Get Started
Components
Styling
Theming

Concepts

OverviewCompositionTesting

Layout

Aspect RatioBleedBoxCenterContainerDividerFlexFloatGridLink OverlayScrollableStackWrap

Components

AccordionAdmonitionAvatarButtonCarouselCheckboxClipboardCollapsibleComboboxConfirm ModalCTAModalDate PickerDialogFieldFieldsetFile UploaderIcon ButtonInputLoading StatesMenuNotificationsNumber InputPin InputProgressPrompt ModalRadioRatingSelectSplit ButtonSwitchTableTabsTagTextTextareaToggleTooltip

Utilities

Client OnlyDownload TriggerEnvironmentFeature FlagsFocus TrapForFormat ByteFormat NumberFormat Relative TimeFrameHighlightJSON Tree ViewLocaleLocal StoragePortalPresenceShowsplitPropsTheme

IconButton

The IconButton component is a button that displays an icon.

  • npm
  • source
  • recipe
import { IconButton } from '@cerberus/react'

Usage

Copy
button.tsx
import { IconButton } from '@cerberus/react'
import { Tuning } from '@carbon/icons-react'
function BasicButtonPreview() {
return <IconButton><Tuning /></IconButton>
}

Sizes

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

Copy
button.tsx
import { IconButton } from '@cerberus/react'
import { Tuning } from '@carbon/icons-react'
import { HStack } from 'styled-system/jsx'
function SizesDemo() {
return (
<HStack>
<IconButton size="sm" usage="filled">
<Tuning />
</IconButton>
<IconButton size="lg" usage="filled">
<Tuning />
</IconButton>
</HStack>
)
}

Primitives

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

ComponentDescription
IconButtonThe context provider for the Button parts
Copy
custom demo
import { IconButton } from '@cerberus/react'
import { Tuning } from '@carbon/icons-react'
function CustomButtonPreview() {
return (
<IconButton
ariaLabel="custom button"
css={{
bgColor: 'danger.bg.initial',
color: 'danger.text.initial',
rounded: 'md',
transform: 'skew(-10deg)',
_hover: {
bgColor: 'black',
color: 'yellow',
},
}}
>
<Tuning />
</IconButton>
)
}

API

Props

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

NameDefaultDescription
clipboardfalseIf true, uses Clipboard aria-attributes.
paletteactionThe color palette (any of the Cerberus palettes) of the button.
usagefilledThe style treatment of the button.
shapesharpThe shape of the button.

On this page

  • Edit this page on Github
Cerberus Design System | Docs