Skip to content

Utilities

Flexbox

Generated from the registry, so this page can't drift from the compiler.

flex

Makes an element a flex container and optionally sets its direction.

Syntax

syntax
flex()
flex(direction)

Accepted values

ArgumentTypeValues
direction?keywordrow col row-reverse col-reverse

Examples and generated CSS

expressions
flex()
flex(row)
flex(col)
md:flex(row-reverse)
Generated CSS
.flex\(\) {
  display: flex;
}

.flex\(col\) {
  display: flex;
  flex-direction: column;
}

.flex\(row\) {
  display: flex;
  flex-direction: row;
}

@media (min-width: 768px) {
  .md\:flex\(row-reverse\) {
    display: flex;
    flex-direction: row-reverse;
  }
}

Theme behavior

This utility uses fixed keywords and numbers, and reads nothing from the theme.

Responsive and state usage

expressions
md:flex()
hover:flex()
lg:focus:flex()

flex-direction

Sets direction only, for changing direction at a breakpoint.

Syntax

syntax
flex-direction(value)

Accepted values

ArgumentTypeValues
valuekeywordrow col row-reverse col-reverse

Examples and generated CSS

expressions
flex-direction(col)
md:flex-direction(row)
Generated CSS
.flex-direction\(col\) {
  flex-direction: column;
}

@media (min-width: 768px) {
  .md\:flex-direction\(row\) {
    flex-direction: row;
  }
}

Theme behavior

This utility uses fixed keywords and numbers, and reads nothing from the theme.

Responsive and state usage

expressions
md:flex-direction(col)
hover:flex-direction(col)
lg:focus:flex-direction(col)

flex-wrap

Controls whether flex items wrap.

Syntax

syntax
flex-wrap(value)

Accepted values

ArgumentTypeValues
valuekeywordwrap nowrap reverse

Examples and generated CSS

expressions
flex-wrap(wrap)
flex-wrap(nowrap)
Generated CSS
.flex-wrap\(nowrap\) {
  flex-wrap: nowrap;
}

.flex-wrap\(wrap\) {
  flex-wrap: wrap;
}

Theme behavior

This utility uses fixed keywords and numbers, and reads nothing from the theme.

Responsive and state usage

expressions
md:flex-wrap(wrap)
hover:flex-wrap(wrap)
lg:focus:flex-wrap(wrap)

align

Aligns items on the cross axis.

Syntax

syntax
align(value)
align[raw-css]

Accepted values

ArgumentTypeValues
valuekeywordstart center end stretch baseline

Examples and generated CSS

expressions
align(center)
align(start)
align[last_baseline]
Generated CSS
.align\(center\) {
  align-items: center;
}

.align\(start\) {
  align-items: flex-start;
}

.align\[last_baseline\] {
  align-items: last baseline;
}

Theme behavior

This utility uses fixed keywords and numbers, and reads nothing from the theme.

Responsive and state usage

expressions
md:align(center)
hover:align(center)
lg:focus:align(center)

justify

Distributes items on the main axis.

Syntax

syntax
justify(value)
justify[raw-css]

Accepted values

ArgumentTypeValues
valuekeywordstart center end between around evenly

Examples and generated CSS

expressions
justify(between)
justify(center)
Generated CSS
.justify\(between\) {
  justify-content: space-between;
}

.justify\(center\) {
  justify-content: center;
}

Theme behavior

This utility uses fixed keywords and numbers, and reads nothing from the theme.

Responsive and state usage

expressions
md:justify(between)
hover:justify(between)
lg:focus:justify(between)

grow

Sets how much a flex item grows.

Syntax

syntax
grow(value)
grow[raw-css]

Accepted values

ArgumentTypeValues
valueinteger 0–9999See type

Examples and generated CSS

expressions
grow(1)
grow(0)
Generated CSS
.grow\(0\) {
  flex-grow: 0;
}

.grow\(1\) {
  flex-grow: 1;
}

Theme behavior

This utility uses fixed keywords and numbers, and reads nothing from the theme.

Responsive and state usage

expressions
md:grow(1)
hover:grow(1)
lg:focus:grow(1)

shrink

Sets how much a flex item shrinks.

Syntax

syntax
shrink(value)
shrink[raw-css]

Accepted values

ArgumentTypeValues
valueinteger 0–9999See type

Examples and generated CSS

expressions
shrink(0)
shrink(1)
Generated CSS
.shrink\(0\) {
  flex-shrink: 0;
}

.shrink\(1\) {
  flex-shrink: 1;
}

Theme behavior

This utility uses fixed keywords and numbers, and reads nothing from the theme.

Responsive and state usage

expressions
md:shrink(0)
hover:shrink(0)
lg:focus:shrink(0)

basis

Sets a flex item's initial main size.

Syntax

syntax
basis(value)
basis[raw-css]

Accepted values

ArgumentTypeValues
valuespacing token0 1 2 3 4 5 6 8 10 12 16 20 24 32 40 48 64 px
fraction, e.g. 1/2See type
keywordauto full content
var(--name)See type

Examples and generated CSS

expressions
basis(1/2)
basis(64)
basis(auto)
basis[240px]
Generated CSS
.basis\(1\/2\) {
  flex-basis: 50%;
}

.basis\(64\) {
  flex-basis: var(--croff-spacing-64);
}

.basis\(auto\) {
  flex-basis: auto;
}

.basis\[240px\] {
  flex-basis: 240px;
}

Theme behavior

Reads tokens from spacing. A token compiles to its custom property, so changing it in your theme changes every use.

Responsive and state usage

expressions
md:basis(1/2)
hover:basis(1/2)
lg:focus:basis(1/2)