Package com.vaadin.flow.component.html
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:
AttachNotifier,DetachNotifier,HasAriaLabel,HasComponents,HasElement,HasEnabled,HasSize,HasStyle,HasText,Serializable
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 ClassesModifier and TypeClassDescriptionstatic classRepresents an HTML<legend>element.Nested classes/interfaces inherited from interface com.vaadin.flow.component.HasText
HasText.WhiteSpace -
Constructor Summary
ConstructorsConstructorDescriptionFieldSet()Creates a new fieldset with an empty legend.Creates a new fieldset with the given content.Creates a new fieldset with its legend text bound to the given signal.Creates a new fieldset with the given legend text.Creates a new fieldset using the provided legend text and content. -
Method Summary
Modifier and TypeMethodDescriptionvoidbindLegendText(Signal<String> legendTextSignal) Binds a signal's value to the fieldset legend text so that the legend is updated when the signal's value is updated.Returns the content of the fieldset.Returns the legend component associated with this fieldset.Gets the text of the legend.voidsetContent(Component... content) Sets the content of the fieldset and removes previously set content.voidsetLegendText(String text) Sets the text of the legend.Methods inherited from class com.vaadin.flow.component.HtmlComponent
getTitle, setTitleMethods inherited from class com.vaadin.flow.component.Component
addListener, bindVisible, 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, setVisibleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListenerMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods inherited from interface com.vaadin.flow.component.HasAriaLabel
getAriaLabel, getAriaLabelledBy, setAriaLabel, setAriaLabelledByMethods inherited from interface com.vaadin.flow.component.HasComponents
add, add, add, addComponentAsFirst, addComponentAtIndex, bindChildren, remove, remove, removeAllMethods inherited from interface com.vaadin.flow.component.HasElement
getElementMethods inherited from interface com.vaadin.flow.component.HasEnabled
bindEnabled, isEnabled, setEnabledMethods inherited from interface com.vaadin.flow.component.HasSize
bindHeight, bindWidth, getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFullMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassNameMethods inherited from interface com.vaadin.flow.component.HasText
bindText, getText, getWhiteSpace, setText, setWhiteSpace
-
Constructor Details
-
FieldSet
public FieldSet()Creates a new fieldset with an empty legend. -
FieldSet
Creates a new fieldset with the given legend text.- Parameters:
legendText- the legend text to set.
-
FieldSet
Creates a new fieldset with its legend text bound to the given signal.- Parameters:
textSignal- the legend text signal to bind to, notnull- See Also:
-
FieldSet
Creates a new fieldset with the given content.- Parameters:
content- the content component to set.
-
FieldSet
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
Returns the legend component associated with this fieldset.- Returns:
- the legend component.
-
setLegendText
Sets the text of the legend.- Parameters:
text- the text to set.
-
getLegendText
Gets the text of the legend.- Returns:
- the text of the legend, or null if no legend is present.
-
bindLegendText
Binds a signal's value to the fieldset legend text so that the legend is updated when the signal's value is updated.While a binding for the legend text is active, any attempt to set the legend text manually via
setLegendText(String)throwsBindingActiveException. The same happens when trying to bind a new Signal while one is already bound.Bindings are lifecycle-aware and only active while this component is in the attached state; they are deactivated while the component is in the detached state.
- Parameters:
legendTextSignal- the signal to bind, notnull- Throws:
BindingActiveException- thrown when there is already an existing binding- Since:
- 25.1
- See Also:
-
getContent
Returns the content of the fieldset.- Returns:
- Stream of content components
-
setContent
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.
-