พร็อพเพอร์ตี้ที่ทํางานเหมือนพร็อพเพอร์ตี้ CSS
- height, maxHeight, minHeight (เช่น "100px")
- width, maxWidth, minWidth (เช่น "100px")
- ระยะห่างจากขอบ, ระยะขอบ (เช่น "4px 4px 4px 4px" หรือเพียงแค่ "4px")
- color, backgroundColor (เช่น "red" หรือ "#FF0000")
- border (เช่น "1px solid black")
- borderColor (เช่น "red black blue #FF0000")
- borderRadius (เช่น "10px")
- borderStyle (เช่น "solid dashed none dotted")
- borderWidth (เช่น '1px 0px 1px 0px')
- fontSize (เช่น '24px')
- fontStyle (เช่น "italic")
- fontWeight (เช่น "bold" หรือ "100")
- fontFamily (เช่น "monospace" หรือ "serif")
- textAlign (เช่น "left" หรือ "center")
- textDecoration (เช่น "underline" หรือ "line-through")
- whiteSpace (เช่น "nowrap" หรือ "pre")
- shown (จริงหรือเท็จ)
พร็อพเพอร์ตี้เลย์เอาต์ที่กำหนดเองที่รองรับ (ดูเอกสารประกอบ ui.Panel.Layout)
- ยืด ('horizontal', 'vertical', 'both')
- position ('top-right', 'top-center', 'top-left', 'bottom-right', ...)
การใช้งาน | การคืนสินค้า |
---|---|
Checkbox.style() | ui.data.ActiveDictionary |
อาร์กิวเมนต์ | ประเภท | รายละเอียด |
---|---|---|
this: ui.widget | ui.Widget | อินสแตนซ์ ui.Widget |
ตัวอย่าง
เครื่องมือแก้ไขโค้ด (JavaScript)
// Define a UI widget and add it to the map. var widget = ui.Checkbox({label: 'A ui.Checkbox', style: {width: '400px'}}); Map.add(widget); // View the UI widget's style properties; an ActiveDictionary. print(widget.style()); // ActiveDictionaries are mutable; set a style property. widget.style().set('color', 'blue'); print(widget.style()); // Define the UI widget's style ActiveDictionary as a variable. var widgetStyle = widget.style(); print(widgetStyle); // Set the UI widget's style properties from the ActiveDictionary variable. widgetStyle.set({border: '5px solid darkgray'}); print(widgetStyle);