ui: Add text_ellipsis method to Labels (#22118)

This PR adds a `text_ellipsis` method to `Label`s.

This can be used to truncate the text with an ellipsis without needing
to wrap the `Label` in another element.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2024-12-16 18:43:01 -05:00 committed by GitHub
parent ac24f074df
commit 8e71e46867
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 57 additions and 39 deletions

View file

@ -217,11 +217,10 @@ impl PickerDelegate for SlashCommandDelegate {
)),
)
.child(
div().overflow_hidden().text_ellipsis().child(
Label::new(info.description.clone())
.size(LabelSize::Small)
.color(Color::Muted),
),
Label::new(info.description.clone())
.size(LabelSize::Small)
.color(Color::Muted)
.text_ellipsis(),
),
),
),