Flexbox
Last updated
Was this helpful?
Last updated
Was this helpful?
The Flexbox layout containers are using the CSS3 model; Flexbox is a one-dimensional layout method for arranging items in either rows or columns. The Flexbox layout involves a container () and one or more children (). There are several properties which can be set in either the parent or the children using the Servoy properties view in the IDE.
It is the parent container of the . It comes already with 3 children; you can further add or remove any .
You can modify the layout using it's 3 unique properties:
data-direction: determines if the flex items in it should be arranged as rows or columns.
data-align-items: determines how the flex items are laid along the flex container.
data-justify-content: determines how the available space should be distributed among the flex items.
Constraints : Can contain only .
Below an example of flex container with data-justify-content set to space-around.
These are the steps for creating a Flex Container:
Find Flex Container in Flex CSS subsection of the Bootstrap 12-Grid section in the components' pallet
Drag and drop the Flex Container component in:
empty space of the form, as an independent component
data-align-items: determines how the flex items are laid along the flex container.
data-grow: determines the ability of the item to grow, relatively to other flex items, when there is more space available.
data-shrink: determines the ability of the item to shrink, relatively to other flex items, when necessary.
In the example below the first item from the left doesn't grow since has flex-grow=0
. The middle item has flex-grow=1
, the last item has the flex-grow=2
therefore grows twice as much of the middle flex item.
These are the steps for creating a Flex Item:
Find Flex Item in Flex CSS subsection of the Bootstrap 12-Grid section in the components' pallet
Drag and drop the Flex Item component in:
empty space of the form, as an independent component
Edit the Flex Item and add other needed components inside
The flexbox layout divides the available height in 3 vertical sections, header, content and footer. The header and the footer section will grow in height depending on their content while the content section will take all the remaining height and show a scrollbar if the content doesn't fit.
You can drop Servoy any Servoy Web Components and nest other 12Grid containers into the header, footer and content section.
You may decide to leave empty the header or footer section, not necessarily you need to use these section; however you may use at least one of these 2 sections; otherwise you may not use this container at all since there is no benefit on using only the content section.
These are the steps for creating a Flex Layout:
Find Flex Layout in Templates subsection of the Bootstrap 12-Grid section in the components' pallet
Drag and drop the Flex Layout component in:
empty space of the form, as an independent component
Edit the header, footer and content sections of the Flex Layout and add other needed components inside
You can nest multiple FlexLayout within the content section to sub-divide the available height of the content section.
In the sample above the available height of the first flexbox layout content is divided in 2 blocks of 50% height using the custom styleClass half-size
.
Open the of your responsive form
inside any other container components, except ,
Edit the existing ; you can further add or remove any
Flex items can be dropped into . As the flex containers, each flex item has its own set of unique properties used to determine how the item is layout within its container.
Open the of your responsive form
inside a
IMPORTANT! The Flexbox layout is using the CSS3 Flexbox layout model. Now days the Flexbox model is largely supported from modern browsers (see ). However there are few known issues with IE and Safari (open the tab).
Open the of your responsive form
inside any other container components, except ,
When a Servoy Table Component from the package or from the package or from the Servoy NG Grids package is placed within the content section of the flexbox layout as direct child, the table height will use 100% of the available height if the responsiveHeight
property is set to 0
.
NOTE for the component from the Servoy Extra package the property responsiveDynamicHeight
, should be set to false
if you wish to use all the available height of the content section; if the responsiveDynamicHeight
is set to true
the will have a max-height equal to the design responsiveHeight
property of the Table; the max-height may be smaller than the available height resulting in unused space.
If instead you prefer to use the design height of the component, wrap the component within a different 12Grid container. However letting the table use a different height than the available height in the content section may result in bad UX for the User since may result in double vertical scrollbars.
If you include a or tabless panel into the content section and you would like to let the panel use all the available height of the content section add a CSS styleClass to the or tabless panel component to let the panel use 100% of the height.