Theming: Whitespace
Properties
Whitespace can be applied using three different properties: Margin
, Padding
and Spacing
.
If you use HorizontalLayout
or VerticalLayout
you can use setMargin(true)
, setPadding(true)
and setSpacing(true)
.
However, these methods aren’t available for Div
, FlexLayout
or any other container. The Business App Starter enables you to apply margin, padding and spacing on any Component
using class names.
Directions
And nine different directions: BOTTOM
, LEFT
, RIGHT
, TOP
, HORIZONTAL
, VERTICAL
, TALL
, UNIFORM
(default) and WIDE
.
Example
Use the following formula to apply margin, padding, or spacing: component.addClassName(LumoStyles.<PROPERTY>.<DIRECTION>.<SIZE>)
.
Cheatsheet
Horizontal
Horizontal is shorthand for applying margin, padding and spacing on the left and right.
Margin
addClassName(LumoStyles.Margin.Horizontal.XS);
addClassName(LumoStyles.Margin.Horizontal.S);
addClassName(LumoStyles.Margin.Horizontal.M);
addClassName(LumoStyles.Margin.Horizontal.L);
addClassName(LumoStyles.Margin.Horizontal.XL);
Vertical
Vertical is shorthand for applying margin, padding and spacing on the bottom and top.
Margin
addClassName(LumoStyles.Margin.Vertical.XS);
addClassName(LumoStyles.Margin.Vertical.S);
addClassName(LumoStyles.Margin.Vertical.M);
addClassName(LumoStyles.Margin.Vertical.L);
addClassName(LumoStyles.Margin.Vertical.XL);
Tall
Margin, padding or spacing that has bigger vertical space than horizontal space.
Margin
addClassName(LumoStyles.Margin.Tall.XS);
addClassName(LumoStyles.Margin.Tall.S);
addClassName(LumoStyles.Margin.Tall.M);
addClassName(LumoStyles.Margin.Tall.L);
addClassName(LumoStyles.Margin.Tall.XL);
Uniform
An equal amount of margin, padding and spacing in all directions.
Margin
addClassName(LumoStyles.Margin.Uniform.XS);
addClassName(LumoStyles.Margin.Uniform.S);
addClassName(LumoStyles.Margin.Uniform.M);
addClassName(LumoStyles.Margin.Uniform.L);
addClassName(LumoStyles.Margin.Uniform.XL);
Wide
Margin, padding or spacing that has bigger horizontal space than vertical space.
Margin
addClassName(LumoStyles.Margin.Wide.XS);
addClassName(LumoStyles.Margin.Wide.S);
addClassName(LumoStyles.Margin.Wide.M);
addClassName(LumoStyles.Margin.Wide.L);
addClassName(LumoStyles.Margin.Wide.XL);