[Text] It should be possible to set a line-height for a Text component
See original GitHub issueš Feature request
Itās currently not possible to add a line-height value to a Text component without using exceptionallySetClassName
. I think it would be help to have a lineHeight
property added so that consumers can control the leading of their typography.
The values for the line height would need to be determined.
Motivation
The motivation comes from needing to add line height to copy rendered within an application.
Example
This feature could be used any time you want to use a Text component to render multiline copy.
Possible implementations
- A
lineHeight
property could be an absolute value.
.lineHeight-small { line-height: 1.2; }
.lineHeight-medium { line-height: 1.6; }
.lineHeight-large { line-height: 2.0; }
- A
lineHeight
property could work as a āmultiplierā on thesize
prop.
.size-caption {
font-size: var(--reactist-font-size-caption);
line-height: var(--reactist-line-height-caption);
}
.line-height-caption-small {
line-height: calc(var(--reactist-line-height-caption) - 0.2);
}
.line-height-caption-medium {
line-height: var(--reactist-line-height-caption);
}
.line-height-caption-large {
line-height: calc(var(--reactist-line-height-caption) + 0.2);
}
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:8 (5 by maintainers)
Top Results From Across the Web
line-height - CSS: Cascading Style Sheets - MDN Web Docs
The line-height CSS property sets the height of a line box. It's commonly used to set the distance between lines of text.
Read more >The ideal line length & line height in web design - Pimp my Type
Line height and line length are crucial if you want to set your text properly, and in this article and video will tell...
Read more >How to Tame Line Height in CSS
When a browser encounters the line-height property, what it actually does is take the line of text and place it in the middle...
Read more >How do set text line height in flutter? - Stack Overflow
Yes, there is also a height property in TextStyle which allows you to manually adjust the height of the line. Code Snippet Text('Hey...
Read more >Set a default line height | Webflow University
Changing the line height on a text element will only affect its text content. It overrides the styles that are coming from the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@tsamoudakis thanks for the follow-up. I do not recall having expressed any concerns about the feasibility to go forward with any typography styles in the short term. Maybe I was misunderstood, but on this particular topic I see little hurdles ahead, or none at all. Itās just a matter of making the time.
Right now, in this particular issue, the ball is in our court. Weāll ping you when we have the situation ready to try, either behind a feature flag, or on staging in Twist and Todoist for us to try before releasing.
Paul, thatās all super clear. And yes, TD could be affected too, good point.
Anyway, about the approach you suggest, that could work. I was hoping to avoid introducing more feature flags and involving to have to do TD or TW releases. Iām still inclined to validate things on staging first.