Button

Allows users to take actions, and make choices.

Filled Buttons

Filled buttons are high-emphasis, distinguished by their use of fill. They indicate the main action to your app.

You can add the elevation and have the raised version of the button with the raised property.

Outlined Buttons

Outlined buttons are medium-emphasis buttons. They indicate a series of actions without a primary priority to your app.

Inlined Buttons

Inlined buttons are used for the most secondary action.

Buttons with icons and label

Sometimes you might want to have icons for certain buttons to enhance the UX of the application as we recognize imagery more easily than plain text.

Icon Buttons

Icon buttons don't have any labels or texts but instead they have an icon as their main content.

Sizes

To have the larger or smaller buttons, use the size property.

Disabled

Disabled buttons do not respond to any action.

Rounded

To have a rounded version of buttons use rounded property.

API

Learn more about the properties and the customization points.

Usage

import Button from "@sonnat/ui/Button";
import IconButton from "@sonnat/ui/IconButton";
//or
import { Button, IconButton } from "@sonnat/ui";

Properties

Note that the documentation avoids mentioning all the native props (there are a lot) in this section of the components.

Shared Properties

The properties that are common to normal and icon buttons.

Buttons Shared Properties
NameTypeDefaultDescription
aselementType"button"The component used for the root node.
Either a string to use a HTML element or a component.
classNamestring-Append to the class names applied to the component so you can override or extend the styles.
roundedbooleanfalseIf true, the button will be rounded.
disabledbooleanfalseIf true, the button will be disabled.
raisedbooleanfalseIf true, the button will have elavation.
Note: You can only use the raised={true} property on filled buttons.
loadingbooleanfalseIf true, the button will have a loading indicator.
onClickfunction-Callback fired when the button is clicked.
Signature: function(event: React.MouseEvent) => void
size"large"
| "medium"
| "small"
"medium"The size of the button.
color"default"
| "primary"
| "secondary"
"default"The color of the button.
variant"filled"
| "outlined"
| "inlined"
"filled"The variant of the button.
  • The ref is forwarded to the root element.
  • Any other properties supplied will be provided to the root element.

Button Specific Properties

The properties that are only available to normal buttons.

Button Specific Properties
NameTypeDefaultDescription
label
(required)
string-The content of the button.
leadingIconnode-The leading icon element placed before the label.
trailingIconnode-The trailing icon element placed before the label.
  • The ref is forwarded to the root element.
  • Any other properties supplied will be provided to the root element.

IconButton Specific Properties

The properties that are only available to icon-buttons.

IconButton Specific Properties
NameTypeDefaultDescription
icon
(required)
node-The icon element.
  • The ref is forwarded to the root element.
  • Any other properties supplied will be provided to the root element.