This chapter explains all settings of the Flexbox plug-in in detail.

The flexbox plug-in takes advantage of the Box Transformation and allows to build graphics for adaptive storytelling. It is based on the flex implementation of CSS and web development. Therefore you can find a lot of documentation, tips and tricks online.

Layout in Flexbox uses two axes, the main axis and the cross axis. The alignment of any child items along those two axes depends on the available height and width

va_flexbox_sizes-01-20240912-122238.png

The Main Axis is defined by the direction property. If the direction is set to row, the Main Axis is horizontal. If set to column, the Main Axis is vertical.

Justification defines how items are aligned along the Main axis. Alignment defines how items are aligned along the Cross axis.

Flex Wrap

By default children are scaled down to fit into a box. By changing the wrapping mode, children are automatically aligned based on the setting. The following examples use boxes A-E are 300px in width and a minimum width of 150px, but they can grow and shrink.

No Wrap

If no wrapping is used, the boxes are scaled down until they reach their minimum width (140 pixels).

Parent 100%

va_flexbox_sizes-41-20240912-122724.png

Parent 50%

va_flexbox_sizes-43-20240912-122953.png

Parent 20%

image-20240917-071137.png

Wrap and Wrap Reverse

If wrapping is turned on, the boxes are scaled down until they reach their minimum size and are then wrapped to fill the space.

Wrapping enabled - Parent 50% 

va_flexbox_sizes-08-20240912-122238.png

Wrapping Reverse enabled - Parent 50% 

va_flexbox_sizes-09-20240912-122238.png

Flex Direction

Layouts can be based on Rows or Columns for all child boxes. This means that all children are placed within a row or within a column. The Flex Direction defines the main axis and defines the direction of all children placed underneath the flexbox container.

Column

va_flexbox_sizes-10-20240912-122238.png

Column Reverse

va_flexbox_sizes-11-20240912-122238.png

Row

va_flexbox_sizes-41-20240912-122724.png

Row Reverse

va_flexbox_sizes-12-20240912-122238.png

Direction

The direction property defines the main axis. Your children can be aligned starting from the left or from the right side. By default it inherits the setting of the parent flex container.

In Column mode this is being flipped and the main axis is going top to down or reverse.

Left to Right

va_flexbox_sizes-13-20240912-122238.png

Right to Left

va_flexbox_sizes-14-20240912-122238.png

Flex Basis

The basis value defines the default size of a container along the main axis before any growing or shrink is performed. It can be either auto or a given value. This value is like setting the width if flex direction row is used or height or column layout is in use.

Growing and Shrinking

Defines if and how strong a container can grow or shrink to fit into a parent container. The minimum and maximum width/height values are taken into account. If growing is enabled for all child containers, the remaining space is distributed equally to all children.

The value is used as a proportional factor. For example if one container has a shrink value of 2, it shrinks twice as much as all other containers (see below).

Parent container on 100 %
No wrapping
Container C has growing = 0 and Shrinking = 0, size is set to 400 px

va_flexbox_sizes-15-20240912-122238.png

Parent container on 60 %
No wrapping
Container C has growing = 0 and Shrinking = 0, size is set to 400 px

va_flexbox_sizes-16-20240912-122238.png

Scaling of container C stays, whereas all other containers shrink to fit into
parent dimensions.

Parent container on 60 %
No wrapping
Container C has growing = 0 and Shrinking = 2.0, size is set to 400 px

va_flexbox_sizes-17-20240912-122238.png

Container C is scaled down twice as all other containers (shrink = 2.0)

Handling of 3D Objects

Since Viz Artist version 5.1, FlexBox can control the Box Transformation depth and z values. If the Update Box Transformation flag is enabled, the values of Box Transformation are overridden by FlexBox in each field. This flag does not affect the width/height and x/y values of Box Transformation being overridden by the FlexBox plug-in.

image-20240912-125736.png

Aspect Ratio

Defines how a flexbox is being scaled. If it is on auto, the width and height taken as it is. If a value is used, it defines the ratio between width and height. For example: An aspect of 2.0 means the width is twice the value of the height.

Aspect ratio = 1

va_flexbox_sizes-05-20240912-122238.png

Width and height are the same.

Aspect Ratio = 2

va_flexbox_sizes-18-20240912-122238.png

Aspect Radio = 0.5

va_flexbox_sizes-19-20240912-122238.png

Auto

va_flexbox_sizes-41-20240912-122724.png

Width, Height and Limits

The sizes for width, height, minimum width and height as well as the maximum width and height can be set to be either auto, in percentage values or in pixel sizes. 

  • Auto: The size for the box is being calculated automatically based on grow and shrink values, the content as well as the aspect ratio.

  • Pixels: Defines the width/height in pixels.

Note: This dimension can be influenced by other properties.

  • Percentage: Same as pixels, but based on percentage values.

va_flexbox_sizes-20-20240912-122238.png

The minimum and maximum values size set the upper and lower size constraints of a container. These properties have higher priority than all other properties and are always respected.

Margins, Padding and Borders

Each container can have some offsets by adding either a margin, padding or border.

  • Margin: Adds an offset to the outside of the element. It offsets itself and all children from the calculated position. It adds to the total size for the element. it can be set to auto, pixels or percentage values. Negative numbers are allowed too.

  • Padding: Affects the size of the container it is applied to. It does not add to the total size of an element if it has an explicit size set. It can be set in pixels or percentage, but can not be negative.

  • Border: Does more or less the same as padding. It can only be set in pixels. The main purpose of having an additional border is to keep compatibility with the original flexbox implementation.

Positioning

Tracking

To bind one container to another, Flexbox supports tracking. You can specify a reference container and your container follows this position. All other properties are disabled, but offsets can still be applied.

Adding an offset to a container shifts the whole container and its content based on the calculated position by the given values. This offset can be either relative or absolute.

Relative offset

va_flexbox_sizes-21-20240912-122238.png

Offsets can be set as auto (calculated automatically when using certain content alignments) or as value in pixels or percentage.

Absolute offset

va_flexbox_sizes-22-20240912-122238.png

Takes out the container from the calculation and sets the position to the given values. It can be set as pixels or percentage (auto is available, but is ignored).

When using absolute positioning, all other properties that influence the position are no longer effective.

Justify Content

This setting describes how child containers align along the Main Axis. This can be used to automatically center items for example. The samples below show five child containers with a width of 10% and a height of 100%. The following settings are available:

Flex Start

va_flexbox_sizes-23-20240912-122238.png

Aligns child containers to the start of the main axis.

Center

va_flexbox_sizes-24-20240912-122238.png

Aligns child containers to the center of the main axis.

Flex End

va_flexbox_sizes-25-20240912-122238.png

Aligns child containers to the end of the main axis.

Space between

va_flexbox_sizes-26-20240912-122238.png

Distributes the remaining space between all child containers.

Space around

va_flexbox_sizes-27-20240912-122238.png

Distributes the remaining space between all child containers, including start and end as one element

Space Evenly

va_flexbox_sizes-28-20240912-122238.png

Distributes the remaining space between all child containers,
space between all elements including start and end are exactly the same.

Align Items

This setting describes how child containers align along the cross axis. It sets the default alignment for all child containers, however it can be overwritten by a children using the Align-Self property. The samples below show five child container with a width of 10% and a height of 25%, 30%, 35%, 40% and 45%, Justify content is set to space around. The following settings are available:

Auto

Uses the align item of the parent container.

Flex Start

va_flexbox_sizes-29-20240912-122238.png

Aligns child containers to the start of the cross axis.

Center

va_flexbox_sizes-30-20240912-122238.png

Aligns child containers to the center of the cross axis.

Flex End

va_flexbox_sizes-31-20240912-122238.png

Aligns child containers to the end of the cross axis.

Stretch

va_flexbox_sizes-32-20240912-122238.png

The items are stretched to fill the cross axis. Therefore the cross axis setting (in our case the height) must be set to be auto to allow the parent to overwrite the value 

Baseline

va_flexbox_sizes-33-20240912-122238.png

Aligns all containers in a way such that their baselines align. The highest one starts on the top.

Align Self

Align self is used to overwrite the Align Items property given by the parent container to is own. In the example below, the parent container is set to be Align Items: Start, but container E has an Align-Self set to be Flex-End. This takes it out of the computed position of the top (parent is set to Flex Start) and overwrite it with its own property Flex-End: 

va_flexbox_sizes-34-20240912-122239.png

Align Content

Defines how containers are aligned, if the wrap mode forces elements to be distributed in more than on row or column. It has no effect if no wrapping happens. 

The following settings are available:

Auto

Uses the align item of the parent container.

Flex Start

va_flexbox_sizes-35-20240912-122239.png

Aligns wrapping child containers to the start of the cross axis.

Center

va_flexbox_sizes-36-20240912-122239.png

Aligns wrapping child containers to the center of the cross axis.

Flex End

va_flexbox_sizes-37-20240912-122239.png

Aligns child containers to the end of the cross axis.

Stretch

va_flexbox_sizes-38-20240912-122239.png

Stretches the space between the elements to reach the parent containers cross axis.

Baseline

va_flexbox_sizes-35-20240912-122239.png

Aligns all containers in a way such that their baselines align. 

Space between

va_flexbox_sizes-39-20240912-122239.png

Distributes the remaining space between all lines to match the parent containers cross axis.

Space around

va_flexbox_sizes-40-20240912-122239.png

Like space between, but also distributes space including top and bottom.