Buttons initiate actions, can include a title or an icon and come with a set of predefined styles.
You should have the chayns-components
package installed. If that is not the
case already, run
yarn add chayns-components
or
npm i chayns-components
After the chayns-components
package is installed, you can import the component
and use it with React:
import React from 'react'
import { Button } from 'chayns-components';
// ...
<Button {...} />
The Button
-component takes the following props:
Name | Type | Default | Required |
---|---|---|---|
children | ReactNode |
✓ | |
chooseButton | boolean |
false |
|
disabled | boolean |
false |
|
onClick | function |
||
className | string |
||
icon | string | object |
||
secondary | boolean |
false |
|
stopPropagation | boolean |
false |
|
type | enum |
'button' |
children: ReactNode;
String or components that are rendered inside of the button.
chooseButton?: boolean
Renders the button on the "ChooseButton"-style. Alternatively use the
ChooseButton
-component.
disabled?: boolean
Renders the button as disabled and disables click events.
onClick?: function
Will be called after the button has been clicked with the event as the first parameter.
className?: string
String of classnames that should be added to the button.
icon?: string | object
An optional icon that is displayed on the left of the button. Supply a FontAwesome icon like this: "fa fa-plane"
secondary?: boolean
Render the button in a secondary style.
stopPropagation?: boolean
Stop the event propagation on click.
type?: enum
Set the type for the native button HTML element.