You're viewing an older version of Vaadin JavaDoc. Please see version 24.7.0 for the latest.
com.vaadin.flow.dom.

Interface Style

All Superinterfaces:

Serializable

All Known Implementing Classes:

BasicElementStyle, ImmutableEmptyStyle

public interface Style extends Serializable

Provides inline styles for Elements.

Since:

1.0

Author:

Vaadin Ltd

  • Method Details

    • get

      String get(String name)

      Gets the value of the given style property.

      Note that the name should be in camelCase and not dash-separated, i.e. use "fontFamily" and not "font-family"

      Parameters:

      name - the style property name as camelCase, not null

      Returns:

      the style property value, or null if the style property has not been set

    • set

      Style set(String name, String value)

      Sets the given style property to the given value.

      Both camelCased (e.g. fontFamily) and dash-separated (e.g. font-family versions are supported.

      Parameters:

      name - the style property name as camelCase, not null

      value - the style property value (if null, the property will be removed)

      Returns:

      this style instance

    • remove

      Style remove(String name)

      Removes the given style property if it has been set.

      Both camelCased (e.g. fontFamily) and dash-separated (e.g. font-family versions are supported.

      Parameters:

      name - the style property name as camelCase, not null

      Returns:

      this style instance

    • clear

      Style clear()

      Removes all set style properties.

      Returns:

      this style instance

    • has

      boolean has(String name)

      Checks if the given style property has been set.

      Both camelCased (e.g. fontFamily) and dash-separated (e.g. font-family versions are supported.

      Parameters:

      name - the style property name as camelCase, not null

      Returns:

      true if the style property has been set, false otherwise

    • getNames

      Stream<String> getNames()

      Gets the defined style property names.

      Note that this always returns the name as camelCased, e.g. fontFamily even if it has been set as dash-separated (font-family).

      Returns:

      a stream of defined style property names

    • setBackground

      default Style setBackground(String value)

      Sets the background property.

      Parameters:

      value - the style property value (if null, the property will be removed)

      Returns:

      this style instance

    • setBorder

      default Style setBorder(String value)

      Sets the border property.

      Parameters:

      value - the style property value (if null, the property will be removed)

      Returns:

      this style instance

    • setBoxSizing

      default Style setBoxSizing(Style.BoxSizing value)

      Sets the box-sizing property.

      Parameters:

      value - the style property value (if null, the property will be removed)

      Returns:

      this style instance

    • setBoxShadow

      default Style setBoxShadow(String value)

      Sets the box-shadow property.

      Parameters:

      value - the style property value (if null, the property will be removed)

      Returns:

      this style instance

    • setClear

      default Style setClear(Style.Clear value)

      Sets the clear property.

      Parameters:

      value - the style property value (if null, the property will be removed)

      Returns:

      this style instance

    • setCursor

      default Style setCursor(String value)

      Sets the cursor property.

      Parameters:

      value - the style property value (if null, the property will be removed)

      Returns:

      this style instance

    • setColor

      default Style setColor(String value)

      Sets the color property.

      Parameters:

      value - the style property value (if null, the property will be removed)

      Returns:

      this style instance

    • setDisplay

      default Style setDisplay(Style.Display value)

      Sets the display property.

      Parameters:

      value - the style property value (if null, the property will be removed)

      Returns:

      this style instance

    • setFloat

      default Style setFloat(Style.FloatCss value)

      Sets the float property.

      Parameters:

      value - the style property value (if null, the property will be removed)

      Returns:

      this style instance

    • setFont

      default Style setFont(String value)

      Sets the font property.

      Parameters:

      value - the style property value (if null, the property will be removed)

      Returns:

      this style instance

    • setHeight

      default Style setHeight(String value)

      Sets the height property.

      Parameters:

      value - the style property value (if null, the property will be removed)

      Returns:

      this style instance

    • setMargin

      default Style setMargin(String value)

      Sets the margin property.

      Parameters:

      value - the style property value (if null, the property will be removed)

      Returns:

      this style instance

    • setOutline

      default Style setOutline(String value)

      Sets the outline property.

      Parameters:

      value - the style property value (if null, the property will be removed)

      Returns:

      this style instance

    • setOpacity

      default Style setOpacity(String value)

      Sets the opacity property.

      Parameters:

      value - the style property value (if null, the property will be removed)

      Returns:

      this style instance

    • setOverflow

      default Style setOverflow(Style.Overflow value)

      Sets the overflow property.

      Parameters:

      value - the style property value (if null, the property will be removed)

      Returns:

      this style instance

    • setPadding

      default Style setPadding(String value)

      Sets the padding property.

      Parameters:

      value - the style property value (if null, the property will be removed)

      Returns:

      this style instance

    • setPosition

      default Style setPosition(Style.Position value)

      Sets the position property.

      Parameters:

      value - the style property value (if null, the property will be removed)

      Returns:

      this style instance

    • setScale

      default Style setScale(String value)

      Sets the scale property.

      Parameters:

      value - the style property value (if null, the property will be removed)

      Returns:

      this style instance

    • setTextAlign

      default Style setTextAlign(Style.TextAlign value)

      Sets the text-align property.

      Parameters:

      value - the style property value (if null, the property will be removed)

      Returns:

      this style instance

    • setTextDecoration

      default Style setTextDecoration(String value)

      Sets the text-decoration property.

      Parameters:

      value - the style property value (if null, the property will be removed)

      Returns:

      this style instance

    • setTransform

      default Style setTransform(String value)

      Sets the transform property.

      Parameters:

      value - the style property value (if null, the property will be removed)

      Returns:

      this style instance

    • setTransition

      default Style setTransition(String value)

      Sets the transition property.

      Parameters:

      value - the style property value (if null, the property will be removed)

      Returns:

      this style instance

    • setVisibility

      default Style setVisibility(Style.Visibility value)

      Sets the visibility property.

      Parameters:

      value - the style property value (if null, the property will be removed)

      Returns:

      this style instance

    • setWidth

      default Style setWidth(String value)

      Sets the width property.

      Parameters:

      value - the style property value (if null, the property will be removed)

      Returns:

      this style instance

    • setWhiteSpace

      default Style setWhiteSpace(Style.WhiteSpace value)

      Sets the white-space property.

      Parameters:

      value - the style property value (if null, the property will be removed)

      Returns:

      this style instance

    • setLeft

      default Style setLeft(String value)

      Sets the left property.

      Parameters:

      value - the style property value (if null, the property will be removed)

      Returns:

      this style instance

    • setRight

      default Style setRight(String value)

      Sets the right property.

      Parameters:

      value - the style property value (if null, the property will be removed)

      Returns:

      this style instance

    • setTop

      default Style setTop(String value)

      Sets the top property.

      Parameters:

      value - the style property value (if null, the property will be removed)

      Returns:

      this style instance

    • setBottom

      default Style setBottom(String value)

      Sets the bottom property.

      Parameters:

      value - the style property value (if null, the property will be removed)

      Returns:

      this style instance

    • setZIndex

      default Style setZIndex(Integer value)

      Sets the z-index property.

      Parameters:

      value - the style property value (if null, the property will be removed)

      Returns:

      this style instance