Properti yang berperilaku seperti properti CSS-nya:
- height, maxHeight, minHeight (mis. '100px')
- width, maxWidth, minWidth (misalnya, '100px')
- padding, margin (misalnya '4px 4px 4px 4px' atau cukup '4px')
- color, backgroundColor (misalnya, 'red' atau '#FF0000')
- border (misalnya, '1px solid black')
- borderColor (misalnya, 'red black blue #FF0000')
- borderRadius (misalnya '10px')
- borderStyle (misalnya 'solid dashed none dotted')
- borderWidth (misalnya '1px 0px 1px 0px')
- fontSize (misalnya, '24px')
- fontStyle (misalnya 'italic')
- fontWeight (misalnya 'bold' atau '100')
- fontFamily (misalnya 'monospace' atau 'serif')
- textAlign (misalnya 'left' atau 'center')
- textDecoration (misalnya 'underline' atau 'line-through')
- whiteSpace (misalnya 'nowrap' atau 'pre')
- ditampilkan (benar atau salah)
Properti tata letak kustom yang didukung (lihat dokumentasi ui.Panel.Layout):
- stretch ('horizontal', 'vertical', 'both')
- position ('top-right', 'top-center', 'top-left', 'bottom-right', ...)
Penggunaan | Hasil |
---|---|
Checkbox.style() | ui.data.ActiveDictionary |
Argumen | Jenis | Detail |
---|---|---|
ini: ui.widget | ui.Widget | Instance ui.Widget. |
Contoh
Editor Kode (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);