ui.Label
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
ป้ายกำกับข้อความ
การใช้งาน | การคืนสินค้า |
---|
ui.Label(value, style, targetUrl, imageUrl) | ui.Label |
อาร์กิวเมนต์ | ประเภท | รายละเอียด |
---|
value | สตริง ไม่บังคับ | ข้อความที่จะแสดง ค่าเริ่มต้นคือสตริงว่างเปล่า |
style | ออบเจ็กต์ (ไม่บังคับ) | ออบเจ็กต์ของสไตล์ CSS ที่อนุญาตพร้อมค่าที่จะตั้งค่าสำหรับวิดเจ็ตนี้ ดูเอกสารประกอบเกี่ยวกับ style() |
targetUrl | สตริง ไม่บังคับ | URL ที่จะลิงก์ด้วย ค่าเริ่มต้นคือสตริงว่างเปล่า |
imageUrl | สตริง ไม่บังคับ | URL ของรูปภาพ (ไม่บังคับ) หากระบุไว้ ระบบจะแสดงป้ายกำกับเป็นรูปภาพและแสดงข้อความค่าเมื่อวางเมาส์ อนุญาตเฉพาะข้อมูล: URL และไอคอนที่โหลดจาก gstatic.com |
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-26 UTC
[null,null,["อัปเดตล่าสุด 2025-07-26 UTC"],[[["\u003cp\u003eCreates a text label UI element that can optionally display an image and link to a URL.\u003c/p\u003e\n"],["\u003cp\u003eCustomization options include text value, CSS styling, target URL, and image URL.\u003c/p\u003e\n"],["\u003cp\u003eImage URLs are restricted to data URLs and icons from gstatic.com, displayed on hover with the text value as a tooltip.\u003c/p\u003e\n"],["\u003cp\u003eDefault values are provided for optional arguments, resulting in an empty label with no styling or linking.\u003c/p\u003e\n"]]],["The `ui.Label` function creates a text label with optional styling, a target URL, and an image. The `value` argument sets the displayed text, `style` customizes the CSS, `targetUrl` defines a link, and `imageUrl` displays an image with hover text. The text, style, URL, and image arguments are all optional and have default values. The label will only allow images from gstatic.com or data urls.\n"],null,["# ui.Label\n\n\u003cbr /\u003e\n\nA text label.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|------------------------------------------------------------------|----------|\n| `ui.Label(`*value* `, `*style* `, `*targetUrl* `, `*imageUrl*`)` | ui.Label |\n\n| Argument | Type | Details |\n|-------------|------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `value` | String, optional | The text to display. Defaults to an empty string. |\n| `style` | Object, optional | An object of allowed CSS styles with their values to be set for this widget. See style() documentation. |\n| `targetUrl` | String, optional | The url to link to. Defaults to an empty string. |\n| `imageUrl` | String, optional | Optional image url. If provided, the label 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. |"]]