Class ScrollOptions

java.lang.Object
com.vaadin.flow.component.ScrollOptions
All Implemented Interfaces:
Serializable

public class ScrollOptions extends Object implements Serializable
Options for scrollIntoView.

See https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView

See Also:
  • Constructor Details

    • ScrollOptions

      public ScrollOptions()
      Create an instance with the default options.
    • ScrollOptions

      public ScrollOptions(ScrollOptions.Behavior behavior)
      Create an instance with the given scroll behavior.
      Parameters:
      behavior - the behavior
    • ScrollOptions

      public ScrollOptions(ScrollOptions.Behavior behavior, ScrollOptions.Alignment block, ScrollOptions.Alignment inline)
      Create an instance with the given scroll options.
      Parameters:
      behavior - the behavior
      block - the vertical alignment
      inline - the horizontal alignment
  • Method Details

    • setBehavior

      public void setBehavior(ScrollOptions.Behavior behavior)
      Sets the scroll behavior.
      Parameters:
      behavior - the behavior
    • getBehavior

      public ScrollOptions.Behavior getBehavior()
      Gets the scroll behavior.
      Returns:
      the behavior
    • setBlock

      public void setBlock(ScrollOptions.Alignment block)
      Sets the vertical alignment.
      Parameters:
      block - the vertical alignment
    • getBlock

      public ScrollOptions.Alignment getBlock()
      Gets the vertical alignment.
      Returns:
      the vertical alignment
    • setInline

      public void setInline(ScrollOptions.Alignment inline)
      Sets the horizontal alignment.
      Parameters:
      inline - the horizontal alignment
    • getInline

      public ScrollOptions.Alignment getInline()
      Gets the horizontal alignment.
      Returns:
      the horizontal alignment
    • toJson

      public String toJson()
      Convert to json in a form compatible with element.scrollIntoView.
      Returns:
      a json object as a string