Components

## Flex Utility

Quickly manage the layout, alignment, and sizing of grid columns, navigation, components, and more with a full suite of responsive flexbox utilities.

I'm a flexbox container!

###### Code Example

    <div class="d-flex p-2 bg-lighter">I'm a flexbox container!</div>

I'm an inline flexbox container!

###### Code Example

    <div class="d-inline-flex p-2 bg-lighter">I'm an inline flexbox container!</div>

##### Direction

Default horizontal direction of flex item is `row`. If you want to change direction then use `flex-row` for horizontal direction, `flex-row-reverse` for opposite horizontal direction. Default Vertical direction is `column`,for it use `flex-column` or `flex-column-reverse` for opposit vertical direction

Flex item 1
Flex item 2
Flex item 3
Flex item 1
Flex item 2
Flex item 3

###### Code Example

    <div class="d-flex flex-row bg-lighter mb-3">
      <div class="p-2 bg-light">Flex item 1</div>
      <div class="p-2 bg-light">Flex item 2</div>
      <div class="p-2 bg-light">Flex item 3</div>
    </div>
    <div class="d-flex flex-row-reverse bg-lighter">
      <div class="p-2 bg-light">Flex item 1</div>
      <div class="p-2 bg-light">Flex item 2</div>
      <div class="p-2 bg-light">Flex item 3</div>
    </div>

Flex item 1
Flex item 2
Flex item 3
Flex item 1
Flex item 2
Flex item 3

###### Code Example

    <div class="d-flex flex-column bg-lighter mb-3">
      <div class="p-2 bg-light">Flex item 1</div>
      <div class="p-2 bg-light">Flex item 2</div>
      <div class="p-2 bg-light">Flex item 3</div>
    </div>
    <div class="d-flex flex-column-reverse bg-lighter">
      <div class="p-2 bg-light">Flex item 1</div>
      <div class="p-2 bg-light">Flex item 2</div>
      <div class="p-2 bg-light">Flex item 3</div>
    </div>

##### Justify content

On flexbox container use `justify-content` utilities for change the alignment of flex items. There are many classes. just add `(start, end, center, between, around)` with `justify-content`

Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item

###### Code Example

    <div class="d-flex justify-content-start">...</div>
    <div class="d-flex justify-content-end">...</div>
    <div class="d-flex justify-content-center">...</div>
    <div class="d-flex justify-content-between">...</div>
    <div class="d-flex justify-content-around">...</div>

##### Align Items

On flexbox container use `align-items` utilities for change the alignment of flex items on the cross axis. There are many classes. just add `(start, end, center, baseline, stretch)` with `align-items`

Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item

###### Code Example

    <div class="d-flex align-items-start">...</div>
    <div class="d-flex align-items-end">...</div>
    <div class="d-flex align-items-center">...</div>
    <div class="d-flex align-items-baseline">...</div>
    <div class="d-flex align-items-stretch">...</div>

##### Align Self

On flexbox items use `align-self` utilities for change the alignment. There are many classes. just add `(start, end, center, baseline, stretch)` with `align-self`.

Flex item
Aligned flex item
Flex item
Flex item
Aligned flex item
Flex item
Flex item
Aligned flex item
Flex item
Flex item
Aligned flex item
Flex item
Flex item
Aligned flex item
Flex item

###### Code Example

    <div class="align-self-start">Aligned flex item</div>
    <div class="align-self-end">Aligned flex item</div>
    <div class="align-self-center">Aligned flex item</div>
    <div class="align-self-baseline">Aligned flex item</div>
    <div class="align-self-stretch">Aligned flex item</div>

##### Fill

Use `flex-fill` class on flex-items

Flex item with a lot of content
Flex item
Flex item

###### Code Example

    <div class="d-flex bg-light">
      <div class="p-2 flex-fill bg-light">Flex item with a lot of content</div>
      <div class="p-2 flex-fill bg-light">Flex item</div>
      <div class="p-2 flex-fill bg-light">Flex item</div>
    </div>

##### Grow and shrink

Use `.flex-grow-*` utilities to toggle a flex item’s ability to grow to fill available space. In the example below, the `.flex-grow-1` elements uses all available space it can, while allowing the remaining two flex items their necessary space.

Flex item
Flex item
Third flex item

###### Code Example

    <div class="d-flex bg-light">
      <div class="p-2 flex-grow-1 bg-light">Flex item</div>
      <div class="p-2 bg-light">Flex item</div>
      <div class="p-2 bg-light">Third flex item</div>
    </div>

Flex item
Flex item

###### Code Example

    <div class="d-flex bg-light">
      <div class="p-2 w-100 bg-light">Flex item</div>
      <div class="p-2 flex-shrink-1 bg-light">Flex item</div>
    </div>

##### Auto margins

For margin left right auto just use `.ml-auto`, `mr-auto` class on flex items

Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item

###### Code Example

    <div class="d-flex bg-lighter mb-3">
      <div class="p-2 bg-light">Flex item</div>
      <div class="p-2 bg-light">Flex item</div>
      <div class="p-2 bg-light">Flex item</div>
    </div>

    <div class="d-flex bg-lighter mb-3">
      <div class="mr-auto p-2 bg-light">Flex item</div>
      <div class="p-2 bg-light">Flex item</div>
      <div class="p-2 bg-light">Flex item</div>
    </div>

    <div class="d-flex bg-lighter mb-3">
      <div class="p-2 bg-light">Flex item</div>
      <div class="p-2 bg-light">Flex item</div>
      <div class="ml-auto p-2 bg-light">Flex item</div>
    </div>

##### With align-items

For margin top bottom auto just use `.mt-auto`, `mb-auto` class on flex items

Flex item
Flex item
Flex item
Flex item
Flex item
Flex item

###### Code Example

    <div class="d-flex align-items-start flex-column bg-lighter mb-3" style="height: 200px;">
      <div class="mb-auto p-2 bg-light">Flex item</div>
      <div class="p-2 bg-light">Flex item</div>
      <div class="p-2 bg-light">Flex item</div>
    </div>

    <div class="d-flex align-items-end flex-column bg-lighter mb-3" style="height: 200px;">
      <div class="p-2 bg-light">Flex item</div>
      <div class="p-2 bg-light">Flex item</div>
      <div class="mt-auto p-2 bg-light">Flex item</div>
    </div>

##### Wrap

Change how flex items wrap in a flex container. Choose from no wrapping at all (the browser default) with `.flex-nowrap`, wrapping with `.flex-wrap`, or reverse wrapping with `.flex-wrap-reverse.`

Flex item
Flex item
Flex item
Flex item
Flex item

###### Code Example

    <div class="d-flex flex-nowrap bg-light" style="width: 8rem;">
        <div class="p-2 bg-light">Flex item</div>
        <div class="p-2 bg-light">Flex item</div>
        <div class="p-2 bg-light">Flex item</div>
        <div class="p-2 bg-light">Flex item</div>
        <div class="p-2 bg-light">Flex item</div>
      </div>

Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item

###### Code Example

    <div class="d-flex flex-wrap bg-light">
        <div class="p-2 bg-light">Flex item</div>
        <div class="p-2 bg-light">Flex item</div>
        <div class="p-2 bg-light">Flex item</div>
        <div class="p-2 bg-light">Flex item</div>
        <div class="p-2 bg-light">Flex item</div>
        <div class="p-2 bg-light">Flex item</div>
        <div class="p-2 bg-light">Flex item</div>
        <div class="p-2 bg-light">Flex item</div>
        <div class="p-2 bg-light">Flex item</div>
        <div class="p-2 bg-light">Flex item</div>
        <div class="p-2 bg-light">Flex item</div>
        <div class="p-2 bg-light">Flex item</div>
        <div class="p-2 bg-light">Flex item</div>
        <div class="p-2 bg-light">Flex item</div>
        <div class="p-2 bg-light">Flex item</div>
      </div>

Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item

###### Code Example

    <div class="d-flex flex-wrap-reverse bg-light">
        <div class="p-2 bg-light">Flex item</div>
        <div class="p-2 bg-light">Flex item</div>
        <div class="p-2 bg-light">Flex item</div>
        <div class="p-2 bg-light">Flex item</div>
        <div class="p-2 bg-light">Flex item</div>
        <div class="p-2 bg-light">Flex item</div>
        <div class="p-2 bg-light">Flex item</div>
        <div class="p-2 bg-light">Flex item</div>
        <div class="p-2 bg-light">Flex item</div>
        <div class="p-2 bg-light">Flex item</div>
        <div class="p-2 bg-light">Flex item</div>
        <div class="p-2 bg-light">Flex item</div>
        <div class="p-2 bg-light">Flex item</div>
        <div class="p-2 bg-light">Flex item</div>
        <div class="p-2 bg-light">Flex item</div>
      </div>

##### Order

Change the visual order of specific flex items with a handful of `order` utilities. We only provide options for making an item first or last, as well as a reset to use the DOM order.

First flex item
Second flex item
Third flex item

###### Code Example

    <div class="d-flex flex-nowrap bg-light">
      <div class="order-3 p-2 bg-light">First flex item</div>
      <div class="order-2 p-2 bg-light">Second flex item</div>
      <div class="order-1 p-2 bg-light">Third flex item</div>
    </div>

##### Align content

Use align-content utilities on flexbox containers to align flex items together on the cross axis. Choose from start (browser default), end, center, between, around, or stretch. To demonstrate these utilities, we’ve enforced `flex-wrap: wrap` and increased the number of flex items.

Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item

###### Code Example

    <div class="d-flex align-content-start flex-wrap">
      ...
    </div>
    <div class="d-flex align-content-end flex-wrap">...</div>