button
Last updated
Last updated
Buttons allow users to perform actions and navigate with a single click.
button
v3 replaces button
and , which have been deprecated.
Note that button
v1 styling will be applied to buttons if the Buttons 2.0 feature flag is not enabled.
icon
Optional
Type: string
Default: unset
The icon to display on the button, it will be placed on the left of the label by default. You can use icons from various sources - see iconsfor details.
label
on-press
validate
Optional
Type: boolean
Default: true
align-content
color
Optional
Type: string
- can be a named color or #HEX value
Default: primary
disabled
disabled-message
Optional
Type: string
Default: unset
Text to display in the notification bar when the user selects this disabled button.
id
icon-color
Optional
Type: string
- can be a named color or #HEX value
Specify the color of the button's icon.
icon-position
label-case
loading
Optional
Type: boolean
Default: unset
This feature requires asynchronous state management, take care when using it.
Controls whether the button is in a loading state. A loading spinner will appear on the button and will not be clickable while in loading state.
on-long-press
Optional
Default: unset
Triggered when: The user clicks and holds the button
Event parameter: Empty by default. Can be a user-defined variable or field.
Return value: undefined
, or the user-defined variable or field.
outline-button-background-color
Optional
Type: string
- can be a named color or #HEX value
Default: Light theme: white
; Dark theme: #1b262a
show-if
and hide-if
subtext
Optional
Type: string
Default: unset
Text to display below the button label.
style
Optional
Type: solid
| outline
Default: solid
Set the style of the button to convey its importance to the user. style
can be set to solid
or outline
, where solid
buttons typically show a higher importance.
menu
buttontext-color
Optional
Type: string
- can be a named color or #HEX value
type
Optional
Type: normal
| primary
Default: normal
Setting type="primary"
will cause the button to be displayed at the bottom of the view regardless of where it was defined.
fireAction
Programmatically fire the button
action.
scrollIntoView
Programmatically scroll until the button
is visible in the view.
When set to true
this attribute ensures that all required input fields in the current view are not empty before performing the action.
The main color of the button: Background color of a button; border and text color of an button.
To override the button's text color, set the attribute.
Default: The button's
on-long-press
is an event that calls a JS/TS or . See more details:
Note: The on-long-press
function will call validation (as specified by the attribute) if set.
Specify the background color of the button if its is set to outline
.
Default: If the button's is a named color, its text color defaults to the _text
counterpart of the named color. If the button's is a #HEX value, its text color defaults to a high contrasting color.
The following component methods are available when an is assigned to the component and component.button({id:'my-id'})
is called from JS/TS: