Skip to content

Commit 344224f

Browse files
Add width utility to limit line length for readability (#2410)
* Add class to limit max-width to 65ch * Update layout.md with example of new class * Update layout.scss * Create .changeset/shy-cats-hug.md --------- Co-authored-by: simurai <simurai@github.com>
1 parent f560798 commit 344224f

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

.changeset/shy-cats-hug.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@primer/css": patch
3+
---
4+
5+
Add width utility to limit line length for readability

docs/content/utilities/layout.md

+8
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,14 @@ Use `.width-auto` to reset width to `auto` (initial value). Typically used with
204204
</div>
205205
```
206206

207+
Use `.width-comfortable` to set width to `65ch`. This can be used on text elements to shorten the line length for better readability.
208+
209+
```html live
210+
<p class="width-comfortable">
211+
Bacon ipsum dolor amet meatball flank beef tail pig boudin ham hock chicken capicola. Shoulder ham spare ribs turducken pork tongue. Bresaola corned beef sausage jowl ribeye kielbasa tenderloin andouille leberkas tongue. Ribeye tri-tip tenderloin pig, chuck ground round chicken tongue corned beef biltong.
212+
</p>
213+
```
214+
207215
Use `.height-fit` to set max-height 100%.
208216

209217
```html live

src/utilities/layout.scss

+6-4
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,15 @@
7171
// Width and height utilities, helpful in combination
7272
// with display-table utilities and images
7373
/* Max width 100% */
74-
.width-fit { max-width: 100% !important; }
74+
.width-fit { max-width: 100% !important; }
7575
/* Set the width to 100% */
76-
.width-full { width: 100% !important; }
76+
.width-full { width: 100% !important; }
77+
/* Set the max-width to 65 characters */
78+
.width-comfortable { max-width: 65ch !important; }
7779
/* Max height 100% */
78-
.height-fit { max-height: 100% !important; }
80+
.height-fit { max-height: 100% !important; }
7981
/* Set the height to 100% */
80-
.height-full { height: 100% !important; }
82+
.height-full { height: 100% !important; }
8183

8284
/* Remove min-width from element */
8385
.min-width-0 { min-width: 0 !important; }

0 commit comments

Comments
 (0)