ui.Textbox.style

Renvoie le style ActiveDictionary du widget, qui peut être modifié pour mettre à jour les styles du widget.

Propriétés qui se comportent comme leurs homologues CSS :

  - height, maxHeight, minHeight (par exemple, "100px")

  - width, maxWidth, minWidth (par exemple, "100px")

  - padding, margin (e.g. '4px 4px 4px 4px' or simply '4px')

  - color, backgroundColor (par exemple, "red" ou "#FF0000")

  - border (par exemple, "1px solid black")

  - borderColor (ex. : 'red black blue #FF0000')

  - borderRadius (par exemple, "10px")

  - borderStyle (par exemple, "solid dashed none dotted")

  - borderWidth (par exemple, "1px 0px 1px 0px")

  - fontSize (par exemple, "24px")

  - fontStyle (par exemple, 'italic')

  - fontWeight (par exemple, "bold" ou "100")

  - fontFamily (par exemple, "monospace" ou "serif")

  - textAlign (par exemple, "left" ou "center")

  - textDecoration (par exemple, "underline" ou "line-through")

  - whiteSpace (par exemple, "nowrap" ou "pre")

  - shown (true or false)

Propriétés de mise en page personnalisée acceptées (voir la documentation sur ui.Panel.Layout) :

  - stretch ('horizontal', 'vertical', 'both')

  - position ('top-right', 'top-center', 'top-left', 'bottom-right', ...)

UtilisationRenvoie
Textbox.style()ui.data.ActiveDictionary
ArgumentTypeDétails
ceci : ui.widgetui.WidgetInstance ui.Widget.

Exemples

Éditeur de code (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);