Class FieldSet

java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.HtmlComponent
com.vaadin.flow.component.HtmlContainer
com.vaadin.flow.component.html.FieldSet
All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.HasAriaLabel, com.vaadin.flow.component.HasComponents, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasEnabled, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasStyle, com.vaadin.flow.component.HasText, Serializable

@Tag("fieldset") public class FieldSet extends com.vaadin.flow.component.HtmlContainer implements com.vaadin.flow.component.HasAriaLabel
Represents an HTML <fieldset> element. This component is used to group several UI components within a form, enhancing form accessibility and organization.
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    Represents an HTML <legend> element.

    Nested classes/interfaces inherited from interface com.vaadin.flow.component.HasText

    com.vaadin.flow.component.HasText.WhiteSpace
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new fieldset with an empty legend.
    FieldSet(com.vaadin.flow.component.Component... content)
    Creates a new fieldset with the given content.
    FieldSet(String legendText)
    Creates a new fieldset with the given legend text.
    FieldSet(String legendText, com.vaadin.flow.component.Component content)
    Creates a new fieldset using the provided legend text and content.
  • Method Summary

    Modifier and Type
    Method
    Description
    Stream<com.vaadin.flow.component.Component>
    Returns the content of the fieldset.
    Returns the legend component associated with this fieldset.
    Gets the text of the legend.
    void
    setContent(com.vaadin.flow.component.Component... content)
    Sets the content of the fieldset and removes previously set content.
    void
    Sets the text of the legend.

    Methods inherited from class com.vaadin.flow.component.HtmlComponent

    getTitle, setTitle

    Methods inherited from class com.vaadin.flow.component.Component

    addListener, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setVisible

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.vaadin.flow.component.AttachNotifier

    addAttachListener

    Methods inherited from interface com.vaadin.flow.component.DetachNotifier

    addDetachListener

    Methods inherited from interface com.vaadin.flow.component.HasAriaLabel

    getAriaLabel, getAriaLabelledBy, setAriaLabel, setAriaLabelledBy

    Methods inherited from interface com.vaadin.flow.component.HasComponents

    add, add, add, addComponentAsFirst, addComponentAtIndex, remove, remove, removeAll

    Methods inherited from interface com.vaadin.flow.component.HasElement

    getElement

    Methods inherited from interface com.vaadin.flow.component.HasEnabled

    isEnabled, setEnabled

    Methods inherited from interface com.vaadin.flow.component.HasSize

    getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFull

    Methods inherited from interface com.vaadin.flow.component.HasStyle

    addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName

    Methods inherited from interface com.vaadin.flow.component.HasText

    getText, getWhiteSpace, setText, setWhiteSpace
  • Constructor Details

    • FieldSet

      public FieldSet()
      Creates a new fieldset with an empty legend.
    • FieldSet

      public FieldSet(String legendText)
      Creates a new fieldset with the given legend text.
      Parameters:
      legendText - the legend text to set.
    • FieldSet

      public FieldSet(com.vaadin.flow.component.Component... content)
      Creates a new fieldset with the given content.
      Parameters:
      content - the content component to set.
    • FieldSet

      public FieldSet(String legendText, com.vaadin.flow.component.Component content)
      Creates a new fieldset using the provided legend text and content.
      Parameters:
      legendText - the legend text to set.
      content - the content component to set.
  • Method Details

    • getLegend

      public FieldSet.Legend getLegend()
      Returns the legend component associated with this fieldset.
      Returns:
      the legend component.
    • setLegendText

      public void setLegendText(String text)
      Sets the text of the legend.
      Parameters:
      text - the text to set.
    • getLegendText

      public String getLegendText()
      Gets the text of the legend.
      Returns:
      the text of the legend, or null if no legend is present.
    • getContent

      public Stream<com.vaadin.flow.component.Component> getContent()
      Returns the content of the fieldset.
      Returns:
      Stream of content components
    • setContent

      public void setContent(com.vaadin.flow.component.Component... content)
      Sets the content of the fieldset and removes previously set content. Note: Do not include Legend in the content components. Use other FieldSet methods for setting Legend instead.
      Parameters:
      content - the content components of the fieldset to set.