Button
The Button is an interactive component with a background color, label, and optional icon. You can use a Button to Trigger Actions.
Style Properties
Style properties allow you to customize the look and feel of the component. Combinations of styles applied to components can be saved as Stylesheets to easily reuse styles throughout your app. Styles can also be set dynamically using Variables. To learn more about all the different styling properties and how they work, take a look at Intro to Styling.
Component Specific Styles
Property | Description |
---|---|
Active Opacity | Allows you to set opacity of the button when active. |
Disabled Opacity | Allows you to set opacity of the button when disabled. |
Configuration Properties
Property | Description |
---|---|
Component Name | To alter the name of the component. The name is reflected in the Components tree. Defaults to Button. |
Delay Long Press | Allows you to set duration (in milliseconds) from On Press before On Long Press is called. |
Hit slop | Allows you to set additional distance outside of element in which a press can be detected |
Data Properties
Property | Description |
---|---|
Button Text | The text do display as the button's label |
Icon | Allows you to select an icon from the icon picker to be displayed on the Button (Icon will be on the left of the Label). |
Custom Icon | Render an icon using a string of the icon's identifier. Overrides the 'icon' property. Full list of icons here. Ex: 'Foundation/align-right', 'Feather/check' |
Loading | Display a loading indicator in the button in lieu of the icon. |
Disabled | Removes button functionality and grays out the label and icon. |
Conditional Display
You can conditionally display a component based on a given condition. Learn more about conditionally displaying components in the Conditional Display doc.
Triggers
Trigger | Description |
---|---|
On Press | Starts the action when the element is pressed. |
On Long Press | Starts the action when the element is long pressed. |
Adding an icon to the Button
An Icon on the Button component is displayed on the left and before the label. To add an Icon:
- Select the Button component in the Components tree.
- Go Configs tab (second tab) in the Properties Panel.
- Next to the Icon property, open the Icon Picker and select an icon.
Changing Button Dimensions
To change the width and height of the Button:
- Select the Button component in the Components tree.
- Go Styles tab (first tab) in the Properties Panel > Size.
- Set a value for width and height.
- There are two ways to set these dimensions:
- To set an exact size, select the pt (default) and enter desired values.
- To set the dimensions as a % of the screen size, select % instead of pt and enter the desired values.
Changing Border Radius on a Button
To add or change the Border Radius on a Button:
- Select the Button component in the Components tree.
- Go Styles tab (first tab) in the Properties Panel > Borders.
- Add a desired value for the Radius property. By default, the value is
8
.
Changing the Background
To add or change the background color of a Button:
- Select the Button component in the Components tree.
- Go Styles tab (first tab) in the Properties Panel > Background.
- Add a desired value for the Color property from the color picker or enter a custom color value in hexadecimal or rgba format.
Changing the Icon and Label color
To add or change the color of Icon or Label on a Button:
- Select the Button component in the Components tree.
- Go Styles tab (first tab) in the Properties Panel > Style.
- Add a desired value for the Color property from the color picker or enter a custom color value in hexadecimal or rgba format.
Under Style, you can also change the font and font size of the label and the icon.
Updated 4 months ago