Truncate
Use truncate to shorten overflowing text with an ellipsis.
- Deprecated
- Not reviewed for accessibility
Use Truncate
to shorten overflowing text with an ellipsis.
Name | Type | Default | Description |
---|---|---|---|
tag | Symbol | :div | One of :div , :p , :span , or :strong . |
inline | Boolean | false | Whether the element is inline (or inline-block). |
expandable | Boolean | false | Whether the entire string should be revealed on hover. Can only be used in conjunction with inline . |
max_width | Integer | nil | Sets the max-width of the text. |
system_arguments | Hash | N/A | System arguments |
branch-name-that-is-really-long
<div class="col-2"><%= render(Primer::Truncate.new(tag: :p)) { "branch-name-that-is-really-long" } %></div>
<%= render(Primer::Truncate.new(tag: :span, inline: true)) { "branch-name-that-is-really-long" } %>
<%= render(Primer::Truncate.new(tag: :span, inline: true, expandable: true)) { "branch-name-that-is-really-long" } %>
<%= render(Primer::Truncate.new(tag: :span, inline: true, expandable: true, max_width: 100)) { "branch-name-that-is-really-long" } %>
<%= render(Primer::Truncate.new(tag: :span, inline: true, expandable: true, max_width: 100)) do %><span>branch-name-that-is-really-long</span><% end %>