Button
About
A Button allows users to take an action. Riverty Design System offers a primary button, secondary button, and text button. They come in large and small sizes. They can have an icon left or right.
Anatomy
A Radio button consists of a:
- Background
- Label
- Border
- Icon left or right (optional)
When to use
Do use a button when
- Allowing users to take an action (e.g., Confirm or Cancel input, go to the next page or back to the previous page, or start a payment process).
When not to use
Do not use a Button when
- Allowing users to select a choice. Use a Select component instead.
- The action is subtle, there’s small space and the action can be easily communicated with a common icon. Use an Icon button instead.
- The UI element non-interactive such as text or labels.
Variant usage
Primary button
A primary button is used for the main action on a page or screen. Generally, you would want to have just one primary button one a page or screen.
Secondary button
A secondary button is used for the alternative actions to the ones communicated in primary buttons, or just for less important supporting actions.
Text button
A text button can be used to guide users to links or allow for low-emphasis and non-critical actions.
Sizes
Riverty Design System includes two sizes of a button:
- Small (S): The height of a small button is 44px. The width of a small button depends on the length of the button label.
- Large (L): The height of a large button is 48px. The width of a large button depends on the length of the button label.
If you need the button width to fill the width of the screen or page, for example on mobile, you can set the button width to fill in Figma. In code, we have added a variable to fill to container.
Color usage
The Button component has fixed colors. We suggest not to color the buttons in different colors, such as green or red but support your importance with for example icons and clear copies.
Best practices
Call to actions
Buttons labels should always clearly explain the action that will be taken when interacting with the button.
Button order
When you combine a Primary button and a Secondary button, the default order is Primary left, Secondary right. However, there are some exceptions. For example, if the Secondary button communicates a “Back” action. This generally feels more natural to have on the left side.
Buttons with icons
Icons can be added to the left side of the button to add value to users’ understanding of the call to action.
Button as links
When you want to link users to a different resource outside or their context, you can use a Text button. If this button takes users outside of the app or website they’re currently at, we suggest to use an icon (arrow up right) on the right to indicate this.
Nesting components
A Button component is used in:
- Dialog component
- Popover component
A Button component uses:
- Icon component