row
- Class
.flex-row
Sorry, but you either have no stories or none are selected somehow.
If the problem persists, check the browser console, or the terminal you've run Storybook from.
The component failed to render properly, likely due to a configuration issue in Storybook. Here are some common causes and how you can address them:
This is a pre-release version and is not production ready. For new and ongoing projects, please refer to the latest Design System version.
Use the flex utility classes to change the display of elements within a .d-flex parent.
Flex utilities work alongside the display: flex
css property that can be added to any HTML element using the classes d-flex
or d-{breakpoint}-flex
.
Flex direction is used on a flex container element to set the direction of its children.
The available values for flex-direction are the following:row
, row-reverse
, column
, column-reverse
.
To set the direction of elements within a flex container, simply add a .flex-{value}
class to the container.
sm
, md
, lg
, xl
): flex-{breakpoint}-{value}
next.design-system.post.ch/?path=/docs/b0154a21-1138-4a69-953a-c17c3cb7c538--docs&story=Default#b0154a21-1138-4a69-953a-c17c3cb7c538--default
/?path=/story/b0154a21-1138-4a69-953a-c17c3cb7c538--default&full=true
<div class="d-flex flex-row"> <div class="p-8">Content</div> <div class="p-8">Content</div> </div>
.flex-row
.flex-row-reverse
.flex-column
.flex-column-reverse
Align items is used on a flex container element to set the horizontal alignement (vertical alignment if set to flex-direction: column
) of its children.
start
, end
, center
, baseline
, stretch
.
To set the alignment of elements within a flex container, simply add a .align-items-{value}
class to the container.
sm
, md
, lg
, xl
): align-items-{breakpoint}-{value}
next.design-system.post.ch/?path=/docs/b0154a21-1138-4a69-953a-c17c3cb7c538--docs&story=Align Items#b0154a21-1138-4a69-953a-c17c3cb7c538--align-items
/?path=/story/b0154a21-1138-4a69-953a-c17c3cb7c538--align-items&full=true
<div class="d-flex align-items-end"> <div class="p-8">Small content</div> <div class="px-8 py-48">Big content</div> </div>
.align-items-start
.align-items-end
.align-items-center
.align-items-baseline
.align-items-stretch
Justify content is used on a flex container element to set the vertical alignment (horizontal alignment if set to flex-direction: column
).
start
, end
, center
, between
, around
, evenly
.
To set the alignment of elements within a flex container, simply add a .justify-content-{value}
class to the container.
sm
, md
, lg
, xl
): justify-content-{breakpoint}-{value}
next.design-system.post.ch/?path=/docs/b0154a21-1138-4a69-953a-c17c3cb7c538--docs&story=Justify Content#b0154a21-1138-4a69-953a-c17c3cb7c538--justify-content
/?path=/story/b0154a21-1138-4a69-953a-c17c3cb7c538--justify-content&full=true
<div class="d-flex justify-content-between"> <div class="p-8">Content</div> <div class="p-8">Content</div> </div>
.justify-content-start
.justify-content-end
.justify-content-center
.justify-content-between
.justify-content-around
.justify-content-evenly
Align self is used on a child of a flex container element to set its horizontal alignement (vertical alignment if parent is set to flex-direction: column
).
start
, end
, center
, baseline
, stretch
.
To set the alignment of the child element within a flex container, simply add a .align-self-{value}
class to the child.
sm
, md
, lg
, xl
): align-self-{breakpoint}-{value}
next.design-system.post.ch/?path=/docs/b0154a21-1138-4a69-953a-c17c3cb7c538--docs&story=Align Self#b0154a21-1138-4a69-953a-c17c3cb7c538--align-self
/?path=/story/b0154a21-1138-4a69-953a-c17c3cb7c538--align-self&full=true
<div class="d-flex"> <div class="px-8 py-48">Content</div> <div class="align-self-end p-8">Content</div> <div class="px-8 py-48">Content</div> </div>
.align-self-start
.align-self-end
.align-self-center
.align-self-baseline
.align-self-stretch
The grow and shrink utilities are used on children of a flex container to tell the child element to fill the available space.
The available values are the following: grow-{0|1}
, shrink-{0|1}
.
To set the grow/shrink of a child element within a flex container, simply add a .flex-{grow|shrink-{0|1}
class to the child.
sm
, md
, lg
, xl
): flex-{breakpoint}-{grow|shrink}-{0|1}
next.design-system.post.ch/?path=/docs/b0154a21-1138-4a69-953a-c17c3cb7c538--docs&story=Grow Shrink#b0154a21-1138-4a69-953a-c17c3cb7c538--grow-shrink
/?path=/story/b0154a21-1138-4a69-953a-c17c3cb7c538--grow-shrink&full=true
<div class="d-flex"> <div class="flex-grow-1 p-8">I'm growing</div> <div class="flex-shrink-1 p-8">I'm shrinking</div> </div>
.flex-grow-0
.flex-grow-1
.flex-shrink-0
.flex-shrink-1
Align content is used on a flex container to set the horizontal alignment of the element's children together.
Note that align-content will only work if there are more than one row of elements of children.
The available values for align-content are the following:start
, end
, center
, between
, around
, stretch
.
To set the alignment of the child elements within a flex container, simply add a .align-content-{value}
class to the flex container.
sm
, md
, lg
, xl
): align-content-{breakpoint}-{value}
next.design-system.post.ch/?path=/docs/b0154a21-1138-4a69-953a-c17c3cb7c538--docs&story=Align Content#b0154a21-1138-4a69-953a-c17c3cb7c538--align-content
/?path=/story/b0154a21-1138-4a69-953a-c17c3cb7c538--align-content&full=true
<div style="height: 14rem" class="d-flex flex-wrap align-content-around"> <div class="p-8">Content</div> <div class="p-8">Content</div> <div class="p-8">Content</div> <div class="p-8">Content</div> <div class="p-8">Content</div> <div class="p-8">Content</div> <div class="p-8">Content</div> <div class="p-8">Content</div> <div class="p-8">Content</div> <div class="p-8">Content</div> <div class="p-8">Content</div> <div class="p-8">Content</div> <div class="p-8">Content</div> <div class="p-8">Content</div> </div>
.align-content-start
.align-content-end
.align-content-center
.align-content-between
.align-content-around
.align-content-stretch
Order is used on a child element of a .d-flex
parent. It's used to reorder the elements within the parent.
0
, 1
, 2
, 3
, 4
, 5
, first
, last
.
To set the alignment of a specific element within a flex container, simply add a .order-{value}
class to the child element.
sm
, md
, lg
, xl
): order-{breakpoint}-{value}
next.design-system.post.ch/?path=/docs/b0154a21-1138-4a69-953a-c17c3cb7c538--docs&story=Order#b0154a21-1138-4a69-953a-c17c3cb7c538--order
/?path=/story/b0154a21-1138-4a69-953a-c17c3cb7c538--order&full=true
<div class="d-flex"> <div class="p-8 order-3">First element, positioned last</div> <div class="p-8 order-2">Second element</div> <div class="p-8 order-1">Last element, positioned first</div> </div>
Flex wrap is used on a flex parent container to define the wrapping of its children.
The available values for wrap are the following:wrap
, nowrap
, wrap-reverse
.
To set the alignment of a specific element within a flex container, simply add a .flex-{value}
class to the child element.
sm
, md
, lg
, xl
): flex-{breakpoint}-{value}
next.design-system.post.ch/?path=/docs/b0154a21-1138-4a69-953a-c17c3cb7c538--docs&story=Wrap#b0154a21-1138-4a69-953a-c17c3cb7c538--wrap
/?path=/story/b0154a21-1138-4a69-953a-c17c3cb7c538--wrap&full=true
<div class="d-flex flex-wrap"> <div class="p-8">Content</div> <div class="p-8">Content</div> <div class="p-8">Content</div> <div class="p-8">Content</div> <div class="p-8">Content</div> <div class="p-8">Content</div> <div class="p-8">Content</div> <div class="p-8">Content</div> <div class="p-8">Content</div> <div class="p-8">Content</div> <div class="p-8">Content</div> <div class="p-8">Content</div> <div class="p-8">Content</div> <div class="p-8">Content</div> </div>
.flex-wrap
.flex-nowrap
.flex-wrap-reverse
The fill utility is used on children of a flex container to force them to take all of the available space (divide equally if content is smaller than container, or divide depending on child's contents)
The fill value is the following: fill
.
To have children elements of a flex container fill the space, simply add a .flex-fill
class to the child.
sm
, md
, lg
, xl
): flex-{breakpoint}-fill
next.design-system.post.ch/?path=/docs/b0154a21-1138-4a69-953a-c17c3cb7c538--docs&story=Fill Equal#b0154a21-1138-4a69-953a-c17c3cb7c538--fill-equal
/?path=/story/b0154a21-1138-4a69-953a-c17c3cb7c538--fill-equal&full=true
<div class="d-flex"> <div class="p-8 flex-fill">Same content, same width</div> <div class="p-8 flex-fill">Same content, same width</div> <div class="p-8 flex-fill">Same content, same width</div> </div>
next.design-system.post.ch/?path=/docs/b0154a21-1138-4a69-953a-c17c3cb7c538--docs&story=Fill#b0154a21-1138-4a69-953a-c17c3cb7c538--fill
/?path=/story/b0154a21-1138-4a69-953a-c17c3cb7c538--fill&full=true
<div class="d-flex"> <div class="p-8 flex-fill">Content</div> <div class="p-8 flex-fill">Element with more content than the others</div> <div class="p-8 flex-fill">Content</div> </div>