Skip to content

Commit 0c7f359

Browse files
feat!: Update hyphenation tokens (#1914)
Co-authored-by: Aram <37216945+alimpens@users.noreply.github.com>
1 parent adc5e59 commit 0c7f359

File tree

4 files changed

+15
-30
lines changed

4 files changed

+15
-30
lines changed

packages/css/src/common/hyphenation.scss

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55

66
@mixin hyphenation {
7-
hyphenate-limit-chars: var(--ams-hyphenation-hyphenate-limit-chars);
8-
hyphens: var(--ams-hyphenation-hyphens);
9-
overflow-wrap: var(--ams-hyphenation-overflow-wrap);
7+
hyphenate-limit-chars: var(--ams-typography-hyphenate-limit-chars);
8+
hyphens: auto;
9+
overflow-wrap: break-word; // Break overflowing words for browsers that don’t support CSS hyphens.
1010
}

proprietary/tokens/src/brand/ams/typography.tokens.json

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"ams": {
33
"typography": {
44
"font-family": { "value": "'Amsterdam Sans', Arial, sans-serif" },
5+
"hyphenate-limit-chars": { "value": "12 8 4" },
56
"body-text": {
67
"font-size": { "value": "clamp(1.125rem, calc(1.0313rem + 0.4688vw), 1.5rem)" },
78
"font-weight": { "value": "400" },

proprietary/tokens/src/common/ams/hyphenation.tokens.json

-9
This file was deleted.

storybook/src/brand/design-tokens/typography.docs.mdx

+11-18
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,17 @@ If it is not available, we use Arial or the generic sans-serif instead.
9090
| :---------------------------------- | :------------------------------------ |
9191
| `var(--ams-typography-font-family)` | `'Amsterdam Sans', Arial, sans-serif` |
9292

93+
## Hyphenation
94+
95+
Words that do not fit on a single line will be split with a hyphen and continue on the next line.
96+
This happens automatically, but only for words of 12 or more characters.
97+
There must be at least 8 characters before the hyphen and 4 characters after it.
98+
This rule helps keep the text readable and prevents strange hyphenations.
99+
100+
| CSS variable | Value |
101+
| :-------------------------------------------- | :------- |
102+
| `var(--ams-typography-hyphenate-limit-chars)` | `12 8 4` |
103+
93104
## Design
94105

95106
### Responsive
@@ -272,21 +283,3 @@ Exceptions:
272283
Long lines of text are challenging to read.
273284
Around 80 characters per line is the maximum.
274285
In the 12-column [grid](/docs/components-layout-grid--docs), paragraphs meet this when they occupy 8 columns or fewer.
275-
276-
### Word breaking
277-
278-
The Dutch language has many long words, such as ‘gemeenteraadsverkiezingen’ (municipal elections).
279-
Ensure in your application that these words are hyphenated neatly and do not break out of their container or get hidden.
280-
One way to do this is with the following CSS snippet, combining `hyphens` and `word-break`:
281-
282-
```css
283-
.class {
284-
hyphens: auto;
285-
/* only hyphenate words longer than 12 chars, for browsers that support it */
286-
hyphenate-limit-chars: 12;
287-
/* break overflowing words for browsers that don’t support CSS hyphens */
288-
overflow-wrap: break-word;
289-
}
290-
```
291-
292-
Further reading: [Wrapping and breaking text on MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_text/Wrapping_breaking_text)

0 commit comments

Comments
 (0)