You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**Note:** Be sure to include a title attribute on labels, it's helpful for people using screen-readers to differentiate a label from other text. I.e. without the title attribute, the following example would read as _"New select component design"_, rather than identifying `design` as a label.
@@ -70,31 +71,31 @@ Labels come in a few different themes. Use a theme that helps communicate the co
70
71
71
72
Use `Label--gray` to create a label with a light gray background and gray text. This label is neutral in color and can be used in contexts where all you need to communicate is metadata, or whe you want a label to feel less prominent compared with labels with stronger colors.
Use `Label--gray-darker` to create a label with a dark-gray background color. This label is also neutral in color, however, since it's background is darker it can stand out more compared to `Label--gray`.
78
79
79
-
```html
80
+
```html title="Label theme dark gray"
80
81
<spantitle="Label: dark gray label"class="Label Label--gray-darker">dark gray label</span>
81
82
```
82
83
83
84
Use `Label--orange` to communicate "warning". The orange background color is very close to red, so avoid using next to labels with a red background color since most people will find it hard to tell the difference.
Use `Label--outline` to create a label with gray text, a gray border, and a transparent background. The outline reduces the contrast of this label in combination with filled labels. Use this in contexts where you need it to stand out less than other labels and communicate a neutral message.
@@ -130,15 +131,15 @@ Use `State--small` for a state label with reduced padding a smaller font size. T
130
131
131
132
Use the `Counter` component to add a count to navigational elements and buttons. Counters come in 3 variations: the default `Counter` with a light gray background, `Counter--gray` with a dark-gray background and inverse white text, and `Counter--gray-light` with a light-gray background and dark gray text.
Use the `Counter` in navigation to indicate the number of items without the user having to click through or count the items, such as open issues in a GitHub repo. See more options in [navigation](../../core/components/navigation).
Copy file name to clipboardExpand all lines: modules/primer-layout/docs/grid.md
+21-19Lines changed: 21 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ The grid is 12 columns and percentage-based. The number of columns a container s
13
13
14
14
Use `.clearfix` on the container and float utilities with columns for a floated grid layout.
15
15
16
-
```html
16
+
```html title="Float based grid"
17
17
<divclass="container-lg clearfix">
18
18
<divclass="col-4 float-left border p-4">
19
19
My column
@@ -31,7 +31,7 @@ Use `.clearfix` on the container and float utilities with columns for a floated
31
31
32
32
To reverse the order of columns, use `float-right` to float columns to the right.
33
33
34
-
```html
34
+
```html title="Float grid reversed"
35
35
<divclass="container-lg clearfix">
36
36
<divclass="col-4 float-right border p-4">
37
37
One
@@ -48,7 +48,7 @@ To reverse the order of columns, use `float-right` to float columns to the right
48
48
## Nesting
49
49
You can infinitely nest grid layouts within other columns since the column widths are percentage based. With great flexibility comes great responsibility - be sensible with how far you nest!
50
50
51
-
```html
51
+
```html title="Nesting grids"
52
52
<divclass="clearfix">
53
53
<divclass="col-6 float-left px-1">
54
54
<divclass="border p-1">Unnested</div>
@@ -74,7 +74,8 @@ You can infinitely nest grid layouts within other columns since the column width
74
74
## Centering a column
75
75
76
76
Use `.mx-auto` to center columns within a container.
77
-
```html
77
+
78
+
```html title="Centering a column"
78
79
<divclass="border">
79
80
<divclass="col-6 p-2 mx-auto border">
80
81
This column is the center of my world.
@@ -85,7 +86,8 @@ Use `.mx-auto` to center columns within a container.
85
86
86
87
## Column widths
87
88
Column widths can be used with any other block or inline-block elements to add percentage-based widths.
@@ -98,7 +100,7 @@ Column widths can be used with any other block or inline-block elements to add p
98
100
99
101
Using column offset classes can push a div over X number of columns. They work responsively using the [breakpoints outlined below](/styleguide/css/modules/grid#responsive-grids).
@@ -108,7 +110,7 @@ Using column offset classes can push a div over X number of columns. They work r
108
110
## Gutters
109
111
Use gutter styles or padding utilities to create gutters. You can use the default gutter style, `gutter`, or either of its modifiers, `gutter-condensed` or `gutter-spacious`. Gutter styles also support responsive breakpoint modifiers. Gutter styles add padding to the left and right side of each column and apply a negative margin to the container to ensure content inside each column lines up with content outside of the grid.
110
112
111
-
```html
113
+
```html title="Gutters"
112
114
<divclass="clearfix gutter-md-spacious border">
113
115
<divclass="col-3 float-left">
114
116
<divclass="border p-3">.col-md-3</div>
@@ -127,7 +129,7 @@ Use gutter styles or padding utilities to create gutters. You can use the defaul
127
129
128
130
Use padding utilities to create gutters for more customized layouts.
129
131
130
-
```html
132
+
```html title="Gutters with padding"
131
133
<divclass="container-lg clearfix">
132
134
<divclass="col-3 float-left pr-2 mb-3">
133
135
<divclass="border bg-gray-light">.pr-2</div>
@@ -156,7 +158,7 @@ Use padding utilities to create gutters for more customized layouts.
156
158
## Inline-block grids
157
159
Use column widths with `d-inline-block` as an alternative to floated grids.
158
160
159
-
```html
161
+
```html title="Inline-block grid"
160
162
<div>
161
163
<divclass="col-4 d-inline-block border">
162
164
.col-4 .d-inline-block
@@ -171,7 +173,7 @@ Use column widths with `d-inline-block` as an alternative to floated grids.
171
173
```
172
174
173
175
You can use column widths and other utilities on elements such as lists to create the layout you need while keeping the markup semantically correct.
@@ -220,7 +222,7 @@ You can also create an alternative [media object](/styleguide/css/utilities/layo
220
222
221
223
Note that table cells will fill the width of their container even when the total columns doesn't add up to 12.
222
224
223
-
```html
225
+
```html title="Table grid cells"
224
226
<divclass="d-table col-12">
225
227
<divclass="col-4 d-table-cell border">
226
228
.col-4 .d-table-cell
@@ -240,7 +242,7 @@ You can use [flex utilities](/styleguide/css/utilities/flexbox) on the container
240
242
241
243
This can be useful for keeping columns the same height, justifying content and vertically aligning items. The flexbox grid is also great for working with responsive layouts.
@@ -273,7 +275,7 @@ We use abbreviations for each breakpoint to keep the class names concise.
273
275
274
276
In this example at the `sm` breakpoint 2 columns will show, at the `md` breakpoint 4 columns will show, and at the `lg` breakpoint 6 columns will show.
@@ -298,7 +300,7 @@ In this example at the `sm` breakpoint 2 columns will show, at the `md` breakpoi
298
300
299
301
For demonstration, this is how the above example would look at the `sm` breakpoint.
300
302
301
-
```html
303
+
```html title="Responsive grid small"
302
304
<divclass="container-lg clearfix">
303
305
<divclass="col-sm-6 float-left p-2 border">
304
306
.col-sm-6
@@ -322,7 +324,7 @@ For demonstration, this is how the above example would look at the `sm` breakpoi
322
324
```
323
325
This is how that same example would look at the `md` breakpoint.
324
326
325
-
```html
327
+
```html title="Responsive grid medium"
326
328
<divclass="container-lg clearfix">
327
329
<divclass="col-md-3 float-left p-2 border">
328
330
.col-md-3
@@ -347,7 +349,7 @@ This is how that same example would look at the `md` breakpoint.
347
349
348
350
This is how that example would look at the `lg` breakpoint.
349
351
350
-
```html
352
+
```html title="Responsive grid large"
351
353
<divclass="container-lg clearfix">
352
354
<divclass="col-lg-2 float-left p-2 border">
353
355
.col-lg-2
@@ -373,7 +375,7 @@ This is how that example would look at the `lg` breakpoint.
373
375
## Containers
374
376
Container widths match our breakpoints and are available at a `md`, `lg`, and `xl` size. Containers apply a max-width rather than a fixed width for responsive layouts, and they center the container.
0 commit comments