Sign Up

Flex component

The Flex component is a building block for making more complex layouts without resorting to custom CSS.

The component is modelled after the CSS flexbox concept: which is a powerful way to layout elements.


Flex can be used to align items horizontally
<Flex pad="1">
  <Button href="">Sign Up</Button>
  <Button href="">Sign In</Button>



You can increase spacing between children with the gap attribute. It must be a value between 0 and 5 inclusive. The default gap is 0.

Flex with gap specified
<Flex gap="4">

Justifying content

You can use the justify attribute to place items according to each other in the Flex component.

Center aligning buttons with center justification
<Flex justify="center">
  <Button href="">
    Button 1
  <Button href="">
    Button 2
  <Button href="">
    Button 3

Must be one of start, end, center, between, around. Defaults to start.

(The examples below are wrapped inside a Card element for clarity.)


Aligning content

You can use the align attribute to align items horizontally (or vertically, if in the Flex direction is column) in the Flex component. This is equivalent to the flexbox align-items attribute.

Must be one of start, end, center, stretch, baseline. Defaults to start.


You can use the wrap attribute to specify how elements should wrap inside the Flex container.

Must be one of wrap, nowrap, wrapreverse. Defaults to nowrap.


You can tell your Flex element to consume the full height of its container with the height attribute.


<Flex height="full">
  This Flex container will fill its parent

Must be one of auto or full. Defaults to auto.

Custom CSS Class

You can pass a custom class to your Flex element with the class attribute:


<Flex class="custom-flex">
  I can be customized with CSS


By default <Flex> will layout elements horizontally. This is incredibly useful, since Markdown doesn't have a way to layout elements side by side.

If you however want to use <Flex> to layout elements vertically, you can set the dir attribute to col.


<Flex dir="column">
  <Button>Sign Up</Button href="">
  <Button>Sign In</Button href="">

You may want to use dir along with justify in many cases.

Was this page helpful?