Version:
Install
shell
npm i @mate/accessible-textImport
javascript
import '@mate/accessible-text';Variants
One line - With clamp
html
<mate-accessible-text max-lines="1">
This is a very long text that should be truncated into one single line,
as the parent is only maybe 100px wide. But it should still show more than 80 characters,
because it is a single line.
</mate-accessible-text>More than one line - With clamp
html
<mate-accessible-text max-lines="2">
This is a very long text that should be truncated into multiple lines,
but not more than two and also make sure that it does not show more than 80 characters
per line as else this is not accessible
</mate-accessible-text>More than one - No clamp
html
<mate-accessible-text>
This is just a block of text, that should not be truncated / clamped,
but is still accessible due to having only 80 characters in a single line,
when words are wrapped into the next line.
</mate-accessible-text>Tooltip description - No clamp
html
<mate-accessible-text tooltip-text="The explanation of this text">
This is text is explained in the tooltip.
</mate-accessible-text>Tooltip description - With clamp
html
<mate-accessible-text max-lines="1" tooltip-text="The explanation of this text">
This is text is explained in the tooltip, but is also too big and needs
to be truncated to one line. Resize the browser or zoom in to see what happens.
The tooltip will show both, the clamped text and the description.
</mate-accessible-text>