zfb
GitHub repository

Type to search...

to open search from anywhere

Flex container

Set a flex container's main direction and wrapping behavior.

Apply these utilities to a flex container. Direction chooses the main axis and item order; wrapping decides whether items stay on one line or form additional lines. Use a row for horizontal groups and a column for stacked controls or cards.

Quick reference

Example classExpected declarations
flex-rowflex-direction: row;
flex-row-reverseflex-direction: row-reverse;
flex-colflex-direction: column;
flex-col-reverseflex-direction: column-reverse;
flex-wrapflex-wrap: wrap;
flex-nowrapflex-wrap: nowrap;
flex-wrap-reverseflex-wrap: wrap-reverse;
Example setup

Every preview explicitly starts from spec 1, reset "none", strict mode, spacingUnit "0.25rem", and no breakpoints. Numeric spacing values multiply that unit; no Tailwind theme is inherited. wind-demo classes are authored presentation scaffolding, with their CSS shown beside the exact HTML source.

Examples in use

Choose the main axis

row and column arrange items on horizontal and vertical axes. The reverse forms reverse visual order without changing the source order.

Choose the main axis
HTML
<div class="wind-demo">
  <div class="wind-demo-note">Main axis changes with direction; reverse changes visual order.</div>
  <div class="wind-demo-frame flex flex-row gap-2">
    <div class="wind-demo-tile">A row</div><div class="wind-demo-tile">B</div><div class="wind-demo-tile">C</div>
  </div>
  <div class="wind-demo-frame flex flex-row-reverse gap-2">
    <div class="wind-demo-tile">A row-reverse</div><div class="wind-demo-tile">B</div><div class="wind-demo-tile">C</div>
  </div>
  <div class="wind-demo-frame flex flex-col gap-2">
    <div class="wind-demo-tile">A column</div><div class="wind-demo-tile">B</div>
  </div>
  <div class="wind-demo-frame flex flex-col-reverse gap-2">
    <div class="wind-demo-tile">A column-reverse</div><div class="wind-demo-tile">B</div>
  </div>
</div>
CSS
@layer zw-reset, zw-tokens, zfb-hi, base, components;
@layer zw-tokens {
  :root {
    --zw-spacing-unit: .25rem;
  }
}
.wind-demo {
  font: 14px / 1.45 system-ui, sans-serif;
  color: #203046;
}

.wind-demo-frame {
  border: 1px solid #9aaabd;
  background: #f8fafc;
  padding: .75rem;
}

.wind-demo-note {
  color: #53677f;
  font-size: .875rem;
}

.wind-demo-tile {
  border: 1px solid #849bb3;
  background: #dce8f2;
  color: #203046;
  padding: .5rem;
  text-align: center;
}
.flex {
  display: flex;
}
.flex-col {
  flex-direction: column;
}
.flex-col-reverse {
  flex-direction: column-reverse;
}
.flex-row {
  flex-direction: row;
}
.flex-row-reverse {
  flex-direction: row-reverse;
}
.gap-2 {
  column-gap: 0.5rem;
  row-gap: 0.5rem;
}
Configuration for this example
{
  "wind": {
    "spec": 1,
    "reset": "none",
    "strict": true,
    "tokens": {
      "spacingUnit": "0.25rem"
    },
    "breakpoints": {},
    "defaultTransitionTimingFunction": "ease",
    "authoredClasses": {
      "wind-demo": true,
      "wind-demo-frame": true,
      "wind-demo-note": true,
      "wind-demo-tile": true
    },
    "safelist": {
      "docs-preview": [
        "flex",
        "flex-col",
        "flex-col-reverse",
        "flex-row",
        "flex-row-reverse",
        "gap-2"
      ]
    }
  }
}
Authored demonstration CSS
.wind-demo { font: 14px/1.45 system-ui, sans-serif; color: #203046; }
.wind-demo-frame { border: 1px solid #9aaabd; background: #f8fafc; padding: 0.75rem; }
.wind-demo-note { color: #53677f; font-size: 0.875rem; }
.wind-demo-tile { border: 1px solid #849bb3; background: #dce8f2; color: #203046; padding: 0.5rem; text-align: center; }

Let items form lines

flex-wrap moves items onto additional lines, flex-nowrap keeps one line, and flex-wrap-reverse reverses the cross-axis line order.

Let items form lines
HTML
<div class="wind-demo">
  <p class="wind-demo-note">The frame is narrow enough to make wrapping visible.</p>
  <div class="wind-demo-frame flex flex-wrap w-64 gap-2">
    <div class="wind-demo-tile w-24">wrap 1</div><div class="wind-demo-tile w-24">wrap 2</div><div class="wind-demo-tile w-24">wrap 3</div><div class="wind-demo-tile w-24">wrap 4</div>
  </div>
  <div class="wind-demo-frame flex flex-nowrap w-64 gap-2">
    <div class="wind-demo-tile w-24">nowrap 1</div><div class="wind-demo-tile w-24">nowrap 2</div><div class="wind-demo-tile w-24">nowrap 3</div>
  </div>
  <div class="wind-demo-frame flex flex-wrap-reverse w-64 gap-2">
    <div class="wind-demo-tile w-24">reverse 1</div><div class="wind-demo-tile w-24">reverse 2</div><div class="wind-demo-tile w-24">reverse 3</div><div class="wind-demo-tile w-24">reverse 4</div>
  </div>
</div>
CSS
@layer zw-reset, zw-tokens, zfb-hi, base, components;
@layer zw-tokens {
  :root {
    --zw-spacing-unit: .25rem;
  }
}
.wind-demo {
  font: 14px / 1.45 system-ui, sans-serif;
  color: #203046;
}

.wind-demo-frame {
  border: 1px solid #9aaabd;
  background: #f8fafc;
  padding: .75rem;
}

.wind-demo-note {
  color: #53677f;
  font-size: .875rem;
}

.wind-demo-tile {
  border: 1px solid #849bb3;
  background: #dce8f2;
  color: #203046;
  padding: .5rem;
  text-align: center;
}
.flex {
  display: flex;
}
.flex-nowrap {
  flex-wrap: nowrap;
}
.flex-wrap {
  flex-wrap: wrap;
}
.flex-wrap-reverse {
  flex-wrap: wrap-reverse;
}
.w-24 {
  width: 6rem;
}
.w-64 {
  width: 16rem;
}
.gap-2 {
  column-gap: 0.5rem;
  row-gap: 0.5rem;
}
Configuration for this example
{
  "wind": {
    "spec": 1,
    "reset": "none",
    "strict": true,
    "tokens": {
      "spacingUnit": "0.25rem"
    },
    "breakpoints": {},
    "defaultTransitionTimingFunction": "ease",
    "authoredClasses": {
      "wind-demo": true,
      "wind-demo-frame": true,
      "wind-demo-note": true,
      "wind-demo-tile": true
    },
    "safelist": {
      "docs-preview": [
        "flex",
        "flex-nowrap",
        "flex-wrap",
        "flex-wrap-reverse",
        "gap-2",
        "w-24",
        "w-64"
      ]
    }
  }
}
Authored demonstration CSS
.wind-demo { font: 14px/1.45 system-ui, sans-serif; color: #203046; }
.wind-demo-frame { border: 1px solid #9aaabd; background: #f8fafc; padding: 0.75rem; }
.wind-demo-note { color: #53677f; font-size: 0.875rem; }
.wind-demo-tile { border: 1px solid #849bb3; background: #dce8f2; color: #203046; padding: 0.5rem; text-align: center; }

Custom and named values

All seven class names are exact and have no value suffixes. flex-row and flex-col select the direction; their reverse forms reverse the visual direction. flex-wrap, flex-nowrap, and flex-wrap-reverse control line wrapping. They do not create the flex container; add display:flex separately.

Related guides: Utility grammar · Variants

Catalog details

flex-col

FieldValue
Catalog identifierv1.flex-col
Class patternflex-col
Grammar{"acceptedKinds":["exact"],"arbitraryProperty":null,"allowsFractionSlash":false,"allowsColorOpacity":false}
Accepted values1
Token categoriesNo token category
Negative-value policyforbidden
Conflict group and rankflex-container (4)
Order rank0
Selector shapeownElement
Spec version1
Emitter propertiesflex-direction

Accepted values

KindSuffixEmitted value
exactnull"column"

Declaration templates

PropertyValue kindFixed value
flex-directionresolvednull

Catalog examples

Example classExpected declarations
flex-colflex-direction: column

flex-col-reverse

FieldValue
Catalog identifierv1.flex-col-reverse
Class patternflex-col-reverse
Grammar{"acceptedKinds":["exact"],"arbitraryProperty":null,"allowsFractionSlash":false,"allowsColorOpacity":false}
Accepted values1
Token categoriesNo token category
Negative-value policyforbidden
Conflict group and rankflex-container (4)
Order rank0
Selector shapeownElement
Spec version1
Emitter propertiesflex-direction

Accepted values

KindSuffixEmitted value
exactnull"column-reverse"

Declaration templates

PropertyValue kindFixed value
flex-directionresolvednull

Catalog examples

Example classExpected declarations
flex-col-reverseflex-direction: column-reverse

flex-nowrap

FieldValue
Catalog identifierv1.flex-nowrap
Class patternflex-nowrap
Grammar{"acceptedKinds":["exact"],"arbitraryProperty":null,"allowsFractionSlash":false,"allowsColorOpacity":false}
Accepted values1
Token categoriesNo token category
Negative-value policyforbidden
Conflict group and rankflex-container (4)
Order rank0
Selector shapeownElement
Spec version1
Emitter propertiesflex-wrap

Accepted values

KindSuffixEmitted value
exactnull"nowrap"

Declaration templates

PropertyValue kindFixed value
flex-wrapresolvednull

Catalog examples

Example classExpected declarations
flex-nowrapflex-wrap: nowrap

flex-row

FieldValue
Catalog identifierv1.flex-row
Class patternflex-row
Grammar{"acceptedKinds":["exact"],"arbitraryProperty":null,"allowsFractionSlash":false,"allowsColorOpacity":false}
Accepted values1
Token categoriesNo token category
Negative-value policyforbidden
Conflict group and rankflex-container (4)
Order rank0
Selector shapeownElement
Spec version1
Emitter propertiesflex-direction

Accepted values

KindSuffixEmitted value
exactnull"row"

Declaration templates

PropertyValue kindFixed value
flex-directionresolvednull

Catalog examples

Example classExpected declarations
flex-rowflex-direction: row

flex-row-reverse

FieldValue
Catalog identifierv1.flex-row-reverse
Class patternflex-row-reverse
Grammar{"acceptedKinds":["exact"],"arbitraryProperty":null,"allowsFractionSlash":false,"allowsColorOpacity":false}
Accepted values1
Token categoriesNo token category
Negative-value policyforbidden
Conflict group and rankflex-container (4)
Order rank0
Selector shapeownElement
Spec version1
Emitter propertiesflex-direction

Accepted values

KindSuffixEmitted value
exactnull"row-reverse"

Declaration templates

PropertyValue kindFixed value
flex-directionresolvednull

Catalog examples

Example classExpected declarations
flex-row-reverseflex-direction: row-reverse

flex-wrap

FieldValue
Catalog identifierv1.flex-wrap
Class patternflex-wrap
Grammar{"acceptedKinds":["exact"],"arbitraryProperty":null,"allowsFractionSlash":false,"allowsColorOpacity":false}
Accepted values1
Token categoriesNo token category
Negative-value policyforbidden
Conflict group and rankflex-container (4)
Order rank0
Selector shapeownElement
Spec version1
Emitter propertiesflex-wrap

Accepted values

KindSuffixEmitted value
exactnull"wrap"

Declaration templates

PropertyValue kindFixed value
flex-wrapresolvednull

Catalog examples

Example classExpected declarations
flex-wrapflex-wrap: wrap

flex-wrap-reverse

FieldValue
Catalog identifierv1.flex-wrap-reverse
Class patternflex-wrap-reverse
Grammar{"acceptedKinds":["exact"],"arbitraryProperty":null,"allowsFractionSlash":false,"allowsColorOpacity":false}
Accepted values1
Token categoriesNo token category
Negative-value policyforbidden
Conflict group and rankflex-container (4)
Order rank0
Selector shapeownElement
Spec version1
Emitter propertiesflex-wrap

Accepted values

KindSuffixEmitted value
exactnull"wrap-reverse"

Declaration templates

PropertyValue kindFixed value
flex-wrapresolvednull

Catalog examples

Example classExpected declarations
flex-wrap-reverseflex-wrap: wrap-reverse

Revision History

CreatedUpdated