Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Document flex order
  • Loading branch information
simurai committed Jul 16, 2019
commit b34927880a3fba430c4ec31bc3446cf07af6236f
43 changes: 43 additions & 0 deletions pages/css/utilities/flexbox.md
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,49 @@ Use these classes to adjust the alignment of an individual flex item on the cros
</div>
```

## Order

Use these classes to change the order of flex items. Keep in mind that it won't affect screen readers or navigating with the keyboard and it's advised to keep the markup in a logical source order.

#### CSS

```css
.flex-order-1 { order: 1; }
.flex-order-2 { order: 2; }
.flex-order-none { order: inherit; }

```

#### Classes

| Class | Description |
| --- | --- |
| `.flex-order-1` | Set order to be 1 |
| `.flex-order-2` | Set order to be 2 |
| `.flex-order-none` | Remove order (typically used with responsive variants) |

#### flex-order (1+2)

```html
<div class="border d-flex">
<div class="p-5 border bg-gray-light flex-order-2">1. .flex-order-2</div>
<div class="p-5 border bg-gray-light">2.</div>
<div class="p-5 border bg-gray-light flex-order-1">3. .flex-order-1</div>
</div>
```

#### flex-order-none

Resize window to see the effect.

```html
<div class="border d-flex">
<div class="p-5 border bg-gray-light flex-order-1 flex-md-order-none">1. .flex-order-1 .flex-md-order-none</div>
<div class="p-5 border bg-gray-light">2.</div>
<div class="p-5 border bg-gray-light">3.</div>
</div>
```

## Responsive flex utilities

All flexbox utilities can be adjusted per [breakpoint](/css/objects/grid#breakpoints) using the following formulas:
Expand Down
2 changes: 1 addition & 1 deletion src/utilities/flexbox.scss
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@
flex-basis: 0;
}

.flex#{$variant}-order-none { order: inherit !important; }
.flex#{$variant}-order-1 { order: 1 !important; }
.flex#{$variant}-order-2 { order: 2 !important; }
.flex#{$variant}-order-none { order: inherit !important; }
Copy link
Contributor

@simurai simurai Jul 17, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we could also use order: 0 instead of inherit to "remove" the order since 0 is the default value?

}
}