Właściwości, które działają jak ich odpowiedniki w CSS:
– height, maxHeight, minHeight (np. „100px”)
– width, maxWidth, minWidth (np. „100px”)
- padding, margin (np. „4px 4px 4px 4px” lub po prostu „4px”)
- color, backgroundColor (np. „red” lub „#FF0000”)
- border (np. '1px solid black')
- borderColor (np. „red black blue #FF0000”)
- borderRadius (np. „10px”)
- borderStyle (np. „solid dashed none dotted”)
- borderWidth (np. „1px 0px 1px 0px”)
- fontSize (np. '24px')
- fontStyle (np. „italic”)
- fontWeight (np. „bold” lub „100”)
- fontFamily (np. „monospace” lub „serif”)
- textAlign (np. „left” lub „center”)
- textDecoration (np. „underline” lub „line-through”)
- whiteSpace (np. „nowrap” lub „pre”)
– shown (prawda lub fałsz)
Obsługiwane właściwości układu niestandardowego (patrz dokumentacja ui.Panel.Layout):
– rozciąganie („poziome”, „pionowe”, „oba”);
- position ('top-right', 'top-center', 'top-left', 'bottom-right', ...)
Wykorzystanie | Zwroty |
---|---|
Textbox.style() | ui.data.ActiveDictionary |
Argument | Typ | Szczegóły |
---|---|---|
to: ui.widget | ui.Widget | Instancja ui.Widget. |
Przykłady
Edytor kodu (JavaScript)
// Define a UI widget and add it to the map. var widget = ui.Textbox({placeholder: 'Type here', 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);