Skip to content

Commit 0b895ff

Browse files
committed
feat(styles): add grow option for nve-text
- Introduced a new 'Grow' section in typography documentation. - Added CSS rules for 'grow' text to utilize the `text-fit` property. Signed-off-by: Cory Rylan <crylan@nvidia.com>
1 parent 1808462 commit 0b895ff

3 files changed

Lines changed: 22 additions & 0 deletions

File tree

‎projects/site/src/docs/foundations/typography.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@ See the links below for specific integration patterns for the following framewor
9393

9494
{% example '@nvidia-elements/styles/typography.examples.json' 'Size' %}
9595

96+
## Grow
97+
98+
{% example '@nvidia-elements/styles/typography.examples.json' 'Grow' %}
99+
96100
## Line height
97101

98102
Use different attributes with `nve-text` like `loose`, `relaxed`, `moderate`, `snug`, and `tight` to give an element a relative line-height based on its current font-size.

‎projects/styles/src/typography.css‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,3 +344,8 @@ ul[nve-text~='nav'] ul li {
344344
[nve-text~='monospace'] {
345345
font-family: monospace !important;
346346
}
347+
348+
[nve-text~='grow'] {
349+
text-fit: grow;
350+
width:100%;
351+
}

‎projects/styles/src/typography.examples.ts‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,19 @@ export const Size = {
6464
`
6565
}
6666

67+
/**
68+
* @summary Grow text to fill the available width via the CSS `text-fit` property.
69+
*/
70+
exportconstGrow={
71+
render: ()=>html`
72+
<divnve-layout="column gap:xl" >
73+
<pnve-text="body grow" style="width: 400px;">grow text</p>
74+
<pnve-text="body grow" style="width: 300px;">grow text</p>
75+
<pnve-text="body grow" style="width: 200px;">grow text</p>
76+
</div>
77+
`
78+
}
79+
6780
/**
6881
* @summary Color variations for text to convey importance levels and ensure proper contrast in light and dark themes.
6982
* @tags test-case

0 commit comments

Comments
 (0)