מאפיינים שפועלים כמו המקבילים שלהם ב-CSS:
- height, maxHeight, minHeight (למשל, '100px')
- width, maxWidth, minWidth (למשל, '100px')
- padding, margin (למשל '4px 4px 4px 4px' או פשוט '4px')
- color, backgroundColor (למשל 'red' או '#FF0000')
- גבול (למשל '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')
- מוצג (true או false)
מאפייני פריסה מותאמים אישית נתמכים (ראו את המסמכים של ui.Panel.Layout):
- stretch ('horizontal', 'vertical', 'both')
- position ('top-right', 'top-center', 'top-left', 'bottom-right', ...)
שימוש | החזרות |
---|---|
Button.style() | ui.data.ActiveDictionary |
ארגומנט | סוג | פרטים |
---|---|---|
זה: ui.widget | ui.Widget | מופע ui.Widget. |
דוגמאות
Code Editor (JavaScript)
// Define a UI widget and add it to the map. var widget = ui.Button({label: 'A ui.Button', 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('backgroundColor', 'lightgray'); 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);