ui.Button
Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Bouton cliquable avec un libellé textuel.
Utilisation | Renvoie |
---|
ui.Button(label, onClick, disabled, style, imageUrl) | ui.Button |
Argument | Type | Détails |
---|
label | Chaîne, facultative | Libellé du bouton. La valeur par défaut est une chaîne vide. |
onClick | Fonction, facultatif | Rappel déclenché lorsque l'utilisateur clique sur le bouton. Le rappel est transmis au widget du bouton. |
disabled | Booléen, facultatif | Indique si le bouton est désactivé. Valeur par défaut : "false". |
style | Objet, facultatif | Objet des styles CSS autorisés avec leurs valeurs à définir pour ce widget. La valeur par défaut est un objet vide. |
imageUrl | Chaîne, facultative | URL de l'image (facultatif). Si vous le fournissez, le bouton sera affiché sous forme d'image et le texte de la valeur s'affichera lorsque l'utilisateur pointera dessus avec la souris. Seules les URL de données et les icônes chargées depuis gstatic.com sont autorisées. |
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/07/26 (UTC).
[null,null,["Dernière mise à jour le 2025/07/26 (UTC)."],[[["\u003cp\u003eCreates a clickable button widget with customizable text label, click functionality, and appearance.\u003c/p\u003e\n"],["\u003cp\u003eAllows setting an optional image for the button, displaying the label text on hover.\u003c/p\u003e\n"],["\u003cp\u003eCan be disabled to prevent user interaction.\u003c/p\u003e\n"],["\u003cp\u003eProvides flexibility in styling through CSS properties.\u003c/p\u003e\n"],["\u003cp\u003eUtilizes a straightforward constructor function for instantiation with various parameters.\u003c/p\u003e\n"]]],["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"],null,["# ui.Button\n\n\u003cbr /\u003e\n\nA clickable button with a text label.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|--------------------------------------------------------------------------------|-----------|\n| `ui.Button(`*label* `, `*onClick* `, `*disabled* `, `*style* `, `*imageUrl*`)` | ui.Button |\n\n| Argument | Type | Details |\n|------------|--------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `label` | String, optional | The button's label. Defaults to an empty string. |\n| `onClick` | Function, optional | A callback fired when the button is clicked. The callback is passed the button widget. |\n| `disabled` | Boolean, optional | Whether the button is disabled. Defaults to false. |\n| `style` | Object, optional | An object of allowed CSS styles with their values to be set for this widget. Defaults to an empty object. |\n| `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. |"]]