2017-10-27 08:05:44 -04:00
---
2017-10-31 00:15:02 -04:00
extends: _layouts.documentation
2017-10-31 21:41:08 -04:00
title: "Flex Direction - Flexbox"
2017-10-27 08:05:44 -04:00
---
2017-10-24 18:02:38 -04:00
2017-10-27 08:05:44 -04:00
# Flex Direction
2017-10-24 18:02:38 -04:00
2017-10-29 19:27:31 -04:00
< div class = "text-xl text-slate-light mb-4" >
2017-10-27 13:22:48 -04:00
Utilities for controlling the direction of flex items.
< / div >
2017-10-29 19:27:31 -04:00
@include ('_partials.feature-badges', [
'responsive' => true,
'customizable' => false,
'hover' => false,
'focus' => false
])
< div class = "border-t border-grey-lighter" >
< table class = "w-full text-left" style = "border-collapse: collapse;" >
< thead >
< tr >
< th class = "text-sm font-semibold text-grey-darker p-2 bg-grey-lightest" > Class< / th >
< th class = "text-sm font-semibold text-grey-darker p-2 bg-grey-lightest" > Properties< / th >
< th class = "text-sm font-semibold text-grey-darker p-2 bg-grey-lightest" > Description< / th >
< / tr >
< / thead >
< tbody class = "align-baseline" >
< tr >
2017-10-31 17:46:38 -04:00
< td class = "p-2 border-t border-smoke font-mono text-xs text-purple-dark" > .flex-row< / td >
< td class = "p-2 border-t border-smoke font-mono text-xs text-blue-dark" > flex-direction: row;< / td >
< td class = "p-2 border-t border-smoke text-sm text-grey-darker" > Position flex items in the normal horizontal direction.< / td >
2017-10-29 19:27:31 -04:00
< / tr >
< tr >
< td class = "p-2 border-t border-smoke-light font-mono text-xs text-purple-dark" > .flex-row-reverse< / td >
< td class = "p-2 border-t border-smoke-light font-mono text-xs text-blue-dark" > flex-direction: row-reverse;< / td >
< td class = "p-2 border-t border-smoke-light text-sm text-grey-darker" > Position flex items in the reverse horizontal direction.< / td >
< / tr >
< tr >
< td class = "p-2 border-t border-smoke-light font-mono text-xs text-purple-dark" > .flex-col< / td >
< td class = "p-2 border-t border-smoke-light font-mono text-xs text-blue-dark" > flex-direction: column;< / td >
< td class = "p-2 border-t border-smoke-light text-sm text-grey-darker" > Position flex items vertically.< / td >
< / tr >
< tr >
< td class = "p-2 border-t border-smoke-light font-mono text-xs text-purple-dark" > .flex-col-reverse< / td >
< td class = "p-2 border-t border-smoke-light font-mono text-xs text-blue-dark" > flex-direction: column-reverse;< / td >
< td class = "p-2 border-t border-smoke-light text-sm text-grey-darker" > Position flex items vertically in the reverse direction.< / td >
< / tr >
< / tbody >
< / table >
2017-10-24 18:02:38 -04:00
< / div >
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" >
< 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 >
< / 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" >
< 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 >
< / 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-10-24 18:02:38 -04: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 >
< / 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-10-24 18:02:38 -04: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 >
< / div >
@endcomponent
2017-10-27 10:44:12 -04:00
## Responsive
2017-10-24 18:02:38 -04:00
2017-10-27 10:44:12 -04:00
To apply a flex direction utility only at a specific breakpoint, add a `{breakpoint}:` 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-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" >
< 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 >
< / div >
@endslot
@slot ('sm')
2017-10-24 18:02:38 -04:00
< div class = "flex flex-col bg-smoke-light" >
< 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 >
< / div >
2017-10-27 10:44:12 -04:00
@endslot
@slot ('md')
< div class = "flex flex-row-reverse bg-smoke-light" >
< 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 >
< / div >
@endslot
@slot ('lg')
2017-10-24 18:02:38 -04:00
< div class = "flex flex-col-reverse bg-smoke-light" >
< 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 >
< / div >
2017-10-27 10:44:12 -04:00
@endslot
@slot ('xl')
< div class = "flex flex-row bg-smoke-light" >
< 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 >
< / div >
@endslot
@slot ('code')
< div class = "none:flex-row sm:flex-col md:flex-row-reverse lg:flex-col-reverse xl:flex-row ..." >
<!-- ... -->
< / div >
@endslot
2017-10-24 18:02:38 -04:00
@endcomponent