ui.Button
A clickable button with a text label.
Usage | Returns |
---|
ui.Button(label, onClick, disabled, style, imageUrl) | ui.Button |
Argument | Type | Details |
---|
label | String, optional | The button's label. Defaults to an empty string. |
onClick | Function, optional | A callback fired when the button is clicked. The callback is passed the button widget. |
disabled | Boolean, optional | Whether the button is disabled. Defaults to false. |
style | Object, optional | An object of allowed CSS styles with their values to be set for this widget. Defaults to an empty object. |
imageUrl | String, optional | Optional image url. If provided, the button will be rendered as an image and the value text will be shown on mouse hover. Only data: urls and icons loaded from gstatic.com are allowed. |
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-10-06 UTC.
[null,null,["Last updated 2023-10-06 UTC."],[[["Creates a clickable button widget with customizable text label, click functionality, and appearance."],["Allows setting an optional image for the button, displaying the label text on hover."],["Can be disabled to prevent user interaction."],["Provides flexibility in styling through CSS properties."],["Utilizes a straightforward constructor function for instantiation with various parameters."]]],["The `ui.Button` function creates a clickable button. It accepts optional arguments: `label` (text), `onClick` (callback function on click), `disabled` (boolean to disable), `style` (CSS styling), and `imageUrl` (image for the button). When clicked, the `onClick` callback is triggered, receiving the button widget. The button can be customized with a text label or an image, and its appearance can be altered via CSS. Only specific URLs are allowed for the image.\n"]]