Button
This page provides information on the button widget, enabling you to trigger actions or perform specific tasks with a simple click.
Content properties
These properties are customizable options present in the property pane of the widget, allowing users to modify the widget according to their preferences.
Basic
Label string
Sets the text that appears on the button.
onClick
Allows you to configure one or multiple actions (Framework functions, queries, or JS functions) to be executed when the button is clicked. You can chain multiple actions together, and all the nested actions would run simultaneously.
General
Tooltip string
Sets a tooltip that appears when the user hovers over the widget. It enables you to add hints or provide additional information for the button.
Visible boolean
Controls the visibility of the widget. If you turn off this property, the widget is not visible in View mode. Additionally, you can use JavaScript by clicking on JS next to the Visible property to control the widget's visibility conditionally.
For example, if you want to make the button visible only when the user selects "Yes" from a Select widget, you can use the following JavaScript expression:
{{Select1.selectedOptionValue === "Yes"}}
Disabled boolean
Prevents users from selecting the widget. Even though the widget remains visible, user input is not permitted. Additionally, you can use JavaScript by clicking on JS next to the Disabled property to control the widget's disabled
state conditionally.
For example, if you want to allow only a specific user to click the button, you can use the following JavaScript expression:
{{appsmith.user.email=="john@appsmith.com"?false:true}}
Animate Loading boolean
Controls whether the widget is displayed with a loading animation. When enabled, the widget shows a skeletal animation during the loading process. Additionally, you can control it through JavaScript by clicking on the JS next to the property.
Validation
Google reCAPTCHA key
Add a Google reCAPTCHA site key here to enable Google reCAPTCHA check to the button. The token is accessible from the API pane with the recaptchaToken
key (see the Google reCAPTCHA docs). Read more about using Google reCAPTCHA Keys in Appsmith.
Google reCAPTCHA version
Sets the Google reCAPTCHA version to use for the button, either v2 or v3.
Form settings
Buttons can have some special behaviors when they're located within the boundaries of a Form widget. Its form-specific behavior is controlled by two of the button's properties: