Fade on the last line. When applying custom line height, keep in mind that accessible font scaling can be applied. You can account for it using --tui-font-offset CSS variable or TUI_FONT_OFFSET signal DI token.
Daenerys of the House Targaryen, the First of Her Name, The Unburnt, Queen of the Andals, the Rhoynar and the First Men, Queen of Meereen, Khaleesi of the Great Grass Sea, Protector of the Realm, Lady Regent of the Seven Kingdoms, Breaker of Chains and Mother of Dragons.
<div class="wrapper">
<div
tuiFade
tuiFadeHeight="calc(1.25rem + var(--tui-font-offset))"
tuiFadeOffset="4.5rem"
class="fade"
[class.fade_expanded]="expanded"
>
Daenerys of the House Targaryen, the First of Her Name, The Unburnt, Queen of the Andals, the Rhoynar and the
First Men, Queen of Meereen, Khaleesi of the Great Grass Sea, Protector of the Realm, Lady Regent of the Seven
Kingdoms, Breaker of Chains and Mother of Dragons.
@if (expanded) {
<button
tuiLink
type="button"
(click)="toggle()"
>
Show less
</button>
}
</div>
<button
tuiLink
type="button"
class="expand"
[class.expand_hidden]="expanded"
(click)="toggle()"
>
Read more
</button>
</div>
Scrollable vertical container with automatic fade on the edges.
Daenerys of the House Targaryen, the First of Her Name, The Unburnt, Queen of the Andals, the Rhoynar and the First Men, Queen of Meereen, Khaleesi of the Great Grass Sea, Protector of the Realm, Lady Regent of the Seven Kingdoms, Breaker of Chains and Mother of Dragons.
<div
tuiFade="vertical"
tuiScrollRef
class="fade"
>
<tui-scroll-controls />
Daenerys of the House Targaryen, the First of Her Name, The Unburnt, Queen of the Andals, the Rhoynar and the First
Men, Queen of Meereen, Khaleesi of the Great Grass Sea, Protector of the Realm, Lady Regent of the Seven Kingdoms,
Breaker of Chains and Mother of Dragons.
</div>
In multiline mode you can use hyphen CSS rule to avoid long words wrapping to the next line entirely which can cause fade effect to not be visible at all due to last visible line becoming too short.
Use CSS hyphens and declare lang on your html tag so that you don't get a situation where a whole long word is shifted to the new line and you observe no fade effect
Daenerys of the House Targaryen, the First of Her Name, The Unburnt, Queen of the pneumonoultramicroscopicsilicovolcanoconiosis Men, Queen of Meereen, Khaleesi of the Great Grass Sea, Protector of the Realm, Lady Regent of the Seven Kingdoms, Breaker of Chains and Mother of Dragons.
<div tuiNotification>
Use CSS hyphens and declare
<code>lang</code>
on your
<code>html</code>
tag so that you don't get a situation where a whole long word is shifted to the new line and you observe no fade
effect
</div>
<p
tuiFade
tuiFadeHeight="1.25rem"
tuiFadeOffset="4.5rem"
>
Daenerys of the House Targaryen, the First of Her Name, The Unburnt, Queen of the
pneumonoultramicroscopicsilicovolcanoconiosis Men, Queen of Meereen, Khaleesi of the Great Grass Sea, Protector of
the Realm, Lady Regent of the Seven Kingdoms, Breaker of Chains and Mother of Dragons.
</p>