On this page
@addTagHelper *, Webority.Ui.RazorBy width
Cut a long name to the width its column gives, with the whole text one hover or focus away.
In a narrow column
In a flex row put min-w-0 on the item that holds the text, or pass width; without a width limit the row grows instead of cutting.
By line count
Show up to three lines of a description, then the ellipsis, so a card keeps an even height.
Three lines
Text that fits
Text that fits shows whole with no tooltip and no tab stop, so nothing extra is announced.
Fits, so no tooltip
Every option
Every value of every prop, one cell each.
children
children, the text between the tags
lines
lines="1" (default)
lines="2"
lines="3"
lines="6"
width
width omitted (default): the width it is given
width="12rem"
style
style, React only: style={{ fontWeight: 600 }} makes the cut text bold
className
class: extra classes on the root, no visible change alone (React: className)
Guidance
What to do, and what to avoid.
Use it when
- Names and descriptions in cards, rows and lists where the layout fixes the width.
- Any text where the full value still matters on demand.
Reach for something else when
- Text a reader must see in full to act on. → Let it wrap
- Long copy that needs a read-more. → Show it in full on its own page
Reference
Try every prop, read the full list, and check keyboard and screen reader behaviour.
2 props. The 2 most used come first.
Used on most screens 2 props
| Prop | Type | Default | Description |
|---|---|---|---|
| linesdefault 1 | int | 1 | How many lines show before the cut. 1 is a single line cut by width. |
| widthdefault - | string | - | A CSS length the text never exceeds, such as 12rem or 240px. Without it the text takes the width it is given. |
Screen reader
3 notes- Text that is cut gets a tab stop and shows its full text in a tooltip on hover and on keyboard focus.
- Text that fits takes no tab stop and shows no tooltip.
- The whole text stays in the page as ordinary text, so assistive technology reads all of it.