Skip to content

Flex Order ​

Utilities for controlling the order of flex or grid items within a container.

Class NameCSS Equivalent
order-1order: 1;
order-2order: 2;
order-3order: 3;
order-4order: 4;
order-5order: 5;
order-6order: 6;
order-7order: 7;
order-8order: 8;
order-9order: 9;
order-10order: 10;
order-11order: 11;
order-12order: 12;
order-firstorder: -9999;
order-lastorder: 9999;
order-noneorder: 0;

Ordering flex and grid items ​

Use order-{order} to render flex and grid items in a different order than they appear in the DOM.

html
<div class="flex gap-m w-full">
  <div class="order-1 [...]">1</div>
  <div class="order-3 [...]">2</div>
  <div class="order-2 [...]">3</div>
</div>
1
2
3

Order-First ​

The .order-first class sets the order property to -9999. This moves the element to the beginning of the flex container, making it the first item.

html
<div class="flex gap-m w-full">
  <div class="[...]">1</div>
  <div class="[...]">2</div>
  <div class="order-first [...]">3</div>
</div>
1
2
3

Order-Last ​

The .order-last class sets the order property to 9999. This moves the element to the end of the flex container, making it the last item.

html
<div class="flex gap-m w-full">
  <div class="[...]">1</div>
  <div class="order-last [...]">2</div>
  <div class="[...]">3</div>
</div>
1
2
3

Order-None ​

The .order-none class sets the order property to 0. This maintains the element's original order within the flex container.

html
<div class="flex gap-m w-full">
  <div class="[...]">1</div>
  <div class="order-none [...]">2</div>
  <div class="[...]">3</div>
</div>
1
2
3