Interface ThemableLayout
- All Superinterfaces:
com.vaadin.flow.component.HasElement,Serializable
- All Known Implementing Classes:
HorizontalLayout,VerticalLayout
VerticalLayout and HorizontalLayout related
to dynamic theme adjustment.
Note: Dynamic adjustment have effect only if the corresponding component theme supports it.
- Author:
- Vaadin Ltd.
-
Method Summary
Modifier and TypeMethodDescriptiondefault BoxSizingGets the box-sizing defined for the layout, orBoxSizing.UNDEFINEDif none was defined on the server-side.default StringGets the spacing between the components inside the layout.default com.vaadin.flow.dom.ThemeListGets the set of the theme names applied to the corresponding element inthemeattribute.default booleanisMargin()Shows ifmargintheme setting is applied to the component.default booleanShows ifpaddingtheme setting is applied to the component.default booleanShows ifspacingsetting is applied to the component, either by setting thespacingtheme or by setting thegapstyle.default booleanisWrap()Gets whether items will wrap to new lines/columns when they exceed the layout's boundaries.default voidsetBoxSizing(BoxSizing boxSizing) Sets thebox-sizingCSS property of the layout.default voidsetMargin(boolean margin) Togglesmargintheme setting for the element.default voidsetPadding(boolean padding) Togglespaddingtheme setting for the element.default voidsetSpacing(boolean spacing) Togglesspacingtheme setting for the element.default voidsetSpacing(float spacing, com.vaadin.flow.component.Unit unit) Sets the spacing between the components inside the layout.default voidsetSpacing(String spacing) Sets the spacing between the components inside the layout.default voidsetWrap(boolean wrap) Sets whether items should wrap to new lines/columns when they exceed the layout's boundaries.Methods inherited from interface com.vaadin.flow.component.HasElement
getElement
-
Method Details
-
setMargin
default void setMargin(boolean margin) Togglesmargintheme setting for the element. If a theme supports this attribute, it will apply or remove margin to the element.- Parameters:
margin- addsmargintheme setting iftrueor removes it iffalse
-
isMargin
default boolean isMargin()Shows ifmargintheme setting is applied to the component.- Returns:
trueif theme setting is applied,falseotherwise
-
setPadding
default void setPadding(boolean padding) Togglespaddingtheme setting for the element. If a theme supports this attribute, it will apply or remove padding to the element.- Parameters:
padding- addspaddingtheme setting iftrueor removes it iffalse
-
isPadding
default boolean isPadding()Shows ifpaddingtheme setting is applied to the component.- Returns:
trueif theme setting is applied,falseotherwise
-
setSpacing
default void setSpacing(boolean spacing) Togglesspacingtheme setting for the element. If a theme supports this attribute, it will apply or remove spacing to the element.This method adds medium spacing to the component theme, to set other options, use
getThemeList(). List of options possible:- spacing-xs
- spacing-s
- spacing
- spacing-l
- spacing-xl
- Parameters:
spacing- addsspacingtheme setting iftrueor removes it iffalse
-
isSpacing
default boolean isSpacing()Shows ifspacingsetting is applied to the component, either by setting thespacingtheme or by setting thegapstyle.- Returns:
trueif theme setting is applied,falseotherwise
-
setSpacing
Sets the spacing between the components inside the layout.- Parameters:
spacing- the spacing between the components. The value must be a valid CSS length, i.e. must provide a unit (e.g. "1px", "1rem", "1%") for values other than 0.
-
setSpacing
default void setSpacing(float spacing, com.vaadin.flow.component.Unit unit) Sets the spacing between the components inside the layout.- Parameters:
spacing- the spacing between the componentsunit- the unit of the spacing value
-
getSpacing
Gets the spacing between the components inside the layout.The value returned is the value set by
setSpacing(String)orsetSpacing(float, Unit). If the spacing was set usingsetSpacing(boolean), this method will returnnull. On this case, useisSpacing()instead.- Returns:
- the spacing between the components
-
setWrap
default void setWrap(boolean wrap) Sets whether items should wrap to new lines/columns when they exceed the layout's boundaries. When enabled, items maintain their size and create new rows or columns as needed, depending on the layout's orientation.When disabled, items will be compressed to fit within a single row/column.
- Parameters:
wrap- true to enable wrapping, false to force items into a single row/column
-
isWrap
default boolean isWrap()Gets whether items will wrap to new lines/columns when they exceed the layout's boundaries.When wrapping is enabled, items maintain their defined dimensions by creating new rows or columns as needed. When disabled, items may be compressed to fit within the available space.
- Returns:
- true if wrapping is enabled, false if items are forced into a single row/column
- See Also:
-
getThemeList
default com.vaadin.flow.dom.ThemeList getThemeList()Gets the set of the theme names applied to the corresponding element inthemeattribute. The set returned can be modified to add or remove the theme names, changes to the set will be reflected in the attribute value.Despite the name implying a list being returned, the return type is actually a
Setsince the in-browser return value behaves like aSetin Java.- Returns:
- a list of theme names, never
null
-
setBoxSizing
Sets thebox-sizingCSS property of the layout.- Parameters:
boxSizing- the box-sizing of the layout.nullis interpreted asBoxSizing.UNDEFINED- See Also:
-
getBoxSizing
Gets the box-sizing defined for the layout, orBoxSizing.UNDEFINEDif none was defined on the server-side.- Returns:
- the box-sizing, never
null - See Also:
-