Propriedades que se comportam como as equivalentes em CSS:
- height, maxHeight, minHeight (por exemplo, "100px")
- width, maxWidth, minWidth (por exemplo, "100px")
- padding, margin (por exemplo, "4px 4px 4px 4px" ou simplesmente "4px")
- color, backgroundColor (por exemplo, "red" ou "#FF0000")
- border (por exemplo, "1px solid black")
- borderColor (por exemplo, "red black blue #FF0000")
- borderRadius (por exemplo, "10px")
- borderStyle (por exemplo, "solid dashed none dotted")
- borderWidth (por exemplo, "1px 0px 1px 0px")
- fontSize (por exemplo, "24px")
- fontStyle (por exemplo, "italic")
- fontWeight (por exemplo, "bold" ou "100")
- fontFamily (por exemplo, "monospace" ou "serif")
- textAlign (por exemplo, "left" ou "center")
- textDecoration (por exemplo, "underline" ou "line-through")
- whiteSpace (por exemplo, "nowrap" ou "pre")
- shown (verdadeiro ou falso)
Propriedades de layout personalizadas compatíveis (consulte a documentação ui.Panel.Layout):
- stretch ("horizontal", "vertical", "both")
- position ('top-right', 'top-center', 'top-left', 'bottom-right', ...)
Uso | Retorna |
---|---|
Textbox.style() | ui.data.ActiveDictionary |
Argumento | Tipo | Detalhes |
---|---|---|
isso: ui.widget | ui.Widget | A instância ui.Widget. |
Exemplos
Editor de código (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);