ui.Button
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
לחצן שאפשר ללחוץ עליו עם תווית טקסט.
שימוש | החזרות |
---|
ui.Button(label, onClick, disabled, style, imageUrl) | ui.Button |
ארגומנט | סוג | פרטים |
---|
label | מחרוזת, אופציונלי | התווית של הכפתור. ברירת המחדל היא מחרוזת ריקה. |
onClick | פונקציה, אופציונלי | קריאה חוזרת מופעלת כשלוחצים על הלחצן. הקריאה החוזרת מועברת לווידג'ט של הלחצן. |
disabled | בוליאני, אופציונלי | האם הכפתור מושבת. ברירת המחדל היא False. |
style | אובייקט, אופציונלי | אובייקט של סגנונות CSS מותרים עם הערכים שיוגדרו לווידג'ט הזה. ברירת המחדל היא אובייקט ריק. |
imageUrl | מחרוזת, אופציונלי | כתובת URL אופציונלית של תמונה. אם מספקים את הלחצן, הוא יוצג כתמונה והטקסט של הערך יוצג כשמעבירים את העכבר מעל התמונה. מותרות רק כתובות URL של נתונים וסמלים שנטענו מ-gstatic.com. |
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 4.0 ודוגמאות הקוד הן ברישיון Apache 2.0. לפרטים, ניתן לעיין במדיניות האתר Google Developers. Java הוא סימן מסחרי רשום של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-07-26 (שעון UTC).
[null,null,["עדכון אחרון: 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. |"]]