2017-10-27 08:05:44 -04:00
---
2017-10-31 00:15:02 -04:00
extends: _layouts.documentation
2017-11-07 16:04:29 -05:00
title: "Flex Direction"
description: "Utilities for controlling the direction of flex items."
2017-11-07 16:27:03 -05:00
features:
responsive: true
customizable: false
hover: false
focus: false
2017-10-27 08:05:44 -04:00
---
2017-10-24 18:02:38 -04:00
2017-11-20 09:57:46 -05:00
@include ('_partials.class-table', [
'rows' => [
[
'.flex-row',
'flex-direction: row;',
"Position flex items in the normal horizontal direction.",
],
[
'.flex-row-reverse',
'flex-direction: row-reverse;',
"Position flex items in the reverse horizontal direction.",
],
[
'.flex-col',
'flex-direction: column;',
"Position flex items vertically.",
],
[
'.flex-col-reverse',
'flex-direction: column-reverse;',
"Position flex items vertically in the reverse direction.",
],
]
])
2017-10-24 18:02:38 -04:00
2017-10-27 10:44:12 -04:00
### Row <span class="ml-2 font-semibold text-slate-light text-sm uppercase tracking-wide">Default</span>
2017-10-24 18:02:38 -04:00
2017-10-27 10:44:12 -04:00
Use `.flex-row` to position flex items horizontally in the same direction as text:
2017-10-24 18:02:38 -04:00
2017-10-27 10:44:12 -04:00
@component ('_partials.code-sample')
2017-10-24 18:02:38 -04:00
< div class = "flex flex-row bg-smoke-light" >
2017-11-09 13:55:51 -05:00
< div class = "text-slate text-center bg-smoke px-4 py-2 m-2" > 1< / div >
< div class = "text-slate text-center bg-smoke px-4 py-2 m-2" > 2< / div >
< div class = "text-slate text-center bg-smoke px-4 py-2 m-2" > 3< / div >
2017-10-24 18:02:38 -04:00
< / div >
2017-10-27 10:44:12 -04:00
@endcomponent
### Row reversed
Use `.flex-row-reverse` to position flex items horizontally in the opposite direction:
@component ('_partials.code-sample')
2017-10-24 18:02:38 -04:00
< div class = "flex flex-row-reverse bg-smoke-light" >
2017-11-09 13:55:51 -05:00
< div class = "text-slate text-center bg-smoke px-4 py-2 m-2" > 1< / div >
< div class = "text-slate text-center bg-smoke px-4 py-2 m-2" > 2< / div >
< div class = "text-slate text-center bg-smoke px-4 py-2 m-2" > 3< / div >
2017-10-24 18:02:38 -04:00
< / div >
@endcomponent
2017-10-27 10:44:12 -04:00
### Column
2017-10-24 18:02:38 -04:00
2017-10-27 10:44:12 -04:00
Use `.flex-col` to position flex items vertically:
2017-10-24 18:02:38 -04:00
@component ('_partials.code-sample')
2017-10-27 10:44:12 -04:00
< div class = "flex flex-col bg-smoke-light" >
2017-11-09 13:55:51 -05:00
< div class = "text-slate text-center bg-smoke px-4 py-2 m-2" > 1< / div >
< div class = "text-slate text-center bg-smoke px-4 py-2 m-2" > 2< / div >
< div class = "text-slate text-center bg-smoke px-4 py-2 m-2" > 3< / div >
2017-10-24 18:02:38 -04:00
< / div >
@endcomponent
2017-10-27 10:44:12 -04:00
### Column reversed
2017-10-24 18:02:38 -04:00
2017-10-27 10:44:12 -04:00
Use `.flex-col-reverse` to position flex items vertically in the opposite direction:
2017-10-24 18:02:38 -04:00
@component ('_partials.code-sample')
2017-10-27 10:44:12 -04:00
< div class = "flex flex-col-reverse bg-smoke-light" >
2017-11-09 13:55:51 -05:00
< div class = "text-slate text-center bg-smoke px-4 py-2 m-2" > 1< / div >
< div class = "text-slate text-center bg-smoke px-4 py-2 m-2" > 2< / div >
< div class = "text-slate text-center bg-smoke px-4 py-2 m-2" > 3< / div >
2017-10-24 18:02:38 -04:00
< / div >
@endcomponent
2017-10-27 10:44:12 -04:00
## Responsive
2017-10-24 18:02:38 -04:00
2017-11-01 16:05:57 -02:00
To apply a flex direction utility only at a specific breakpoint, add a `{screen}:` prefix to the existing class name. For example, adding the class `md:flex-row` to an element would apply the `flex-row` utility at medium screen sizes and above.
2017-10-27 10:44:12 -04:00
2017-10-30 13:23:40 -04:00
For more information about Tailwind's responsive design features, check out the [Responsive Design ](/docs/responsive-design ) documentation.
2017-10-27 10:44:12 -04:00
@component ('_partials.responsive-code-sample')
@slot ('none')
< div class = "flex flex-row bg-smoke-light" >
2017-11-09 13:55:51 -05:00
< div class = "text-slate text-center bg-smoke px-4 py-2 m-2" > 1< / div >
< div class = "text-slate text-center bg-smoke px-4 py-2 m-2" > 2< / div >
< div class = "text-slate text-center bg-smoke px-4 py-2 m-2" > 3< / div >
2017-10-27 10:44:12 -04:00
< / div >
@endslot
@slot ('sm')
2017-10-24 18:02:38 -04:00
< div class = "flex flex-col bg-smoke-light" >
2017-11-09 13:55:51 -05:00
< div class = "text-slate text-center bg-smoke px-4 py-2 m-2" > 1< / div >
< div class = "text-slate text-center bg-smoke px-4 py-2 m-2" > 2< / div >
< div class = "text-slate text-center bg-smoke px-4 py-2 m-2" > 3< / div >
2017-10-24 18:02:38 -04:00
< / div >
2017-10-27 10:44:12 -04:00
@endslot
@slot ('md')
< div class = "flex flex-row-reverse bg-smoke-light" >
2017-11-09 13:55:51 -05:00
< div class = "text-slate text-center bg-smoke px-4 py-2 m-2" > 1< / div >
< div class = "text-slate text-center bg-smoke px-4 py-2 m-2" > 2< / div >
< div class = "text-slate text-center bg-smoke px-4 py-2 m-2" > 3< / div >
2017-10-27 10:44:12 -04:00
< / div >
@endslot
@slot ('lg')
2017-10-24 18:02:38 -04:00
< div class = "flex flex-col-reverse bg-smoke-light" >
2017-11-09 13:55:51 -05:00
< div class = "text-slate text-center bg-smoke px-4 py-2 m-2" > 1< / div >
< div class = "text-slate text-center bg-smoke px-4 py-2 m-2" > 2< / div >
< div class = "text-slate text-center bg-smoke px-4 py-2 m-2" > 3< / div >
2017-10-24 18:02:38 -04:00
< / div >
2017-10-27 10:44:12 -04:00
@endslot
@slot ('xl')
< div class = "flex flex-row bg-smoke-light" >
2017-11-09 13:55:51 -05:00
< div class = "text-slate text-center bg-smoke px-4 py-2 m-2" > 1< / div >
< div class = "text-slate text-center bg-smoke px-4 py-2 m-2" > 2< / div >
< div class = "text-slate text-center bg-smoke px-4 py-2 m-2" > 3< / div >
2017-10-27 10:44:12 -04:00
< / div >
@endslot
@slot ('code')
< div class = "none:flex-row sm:flex-col md:flex-row-reverse lg:flex-col-reverse xl:flex-row ..." >
2017-11-09 13:55:51 -05:00
<!-- ... -->
2017-10-27 10:44:12 -04:00
< / div >
@endslot
2017-10-24 18:02:38 -04:00
@endcomponent