You are currently viewing outdated (<=3.x) Chameleon documentation on our old website. For version >=4.x, check out our new website.

Current release: 3.5.0 | hub

components

Button (code)

Buttons indicate possible actions or choices to a user.

import { Add } from '@mediahuis/chameleon-theme-wl/icons'
import { Button } from '@mediahuis/chameleon-react'

Props

NameTypeDefaultRequiredDescription
appearance'primary''secondary''plain''outline''primary'-Controls the button’s background, text, and border color.
asFunctionNodeObject'button'-Render with a different HTML tag or a different custom component.
childrenNode--Contents displayed within the button.
classNameString--Extend classNames.
disabledBoolean--Visually and functionally disables the button.
iconLeftFunctionStringNodeObject--The icon on the left (extends Icon), choose one of the icons package.
iconRightFunctionStringNodeObject--The icon on the right (extends Icon), choose one of the icons package.
loadingBoolean--Enable/disable the loading state of the button. (Will also disable the button while loading)
size'small''large''large'-Changes the button's `line-height`, `padding`, and `font-size`.
width'auto''full''auto'-Controls button width property.

System Props

System Props

Next to the properties listed in the propstable, a collection of system props can be added to any component for further general styling and layouting purposes. These props vary per component.

To read more about the system, click here to check out its dedicated page.

Appearance

default: primary

To differentiate between levels of emphasis, there are 4 possible appearances a button can have.

Width

default: auto

By default, buttons will only take up the space necessary in order to fit its text content and the needed padding. In order for your button to fill the complete surrounding element, you can adjust the width parameter.

Size

default: large

Buttons come in different shapes and sizes.

Loading

default: false

To indicate to a user that something is loading, you can pass in the loading prop.

© Copyright 2020 Mediahuis NV. All rights Reserved