-
Notifications
You must be signed in to change notification settings - Fork 78
chore(Kb): kb for add tooltip to each chip in chiplist #3082
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,84 @@ | ||||||
--- | ||||||
title: Adding Tooltips for Chips in a ChipList | ||||||
description: Learn how to display tooltips for chips in the Telerik Blazor ChipList component. | ||||||
type: how-to | ||||||
page_title: How to Display Tooltips for Chips in Telerik Blazor ChipList | ||||||
meta_title: How to Display Tooltips for Chips in Telerik Blazor ChipList | ||||||
slug: add-tooltips-chips-chiplist | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The slug is normally the same as the md file, but there is
Suggested change
|
||||||
tags: blazor, chiplist, tooltip, itemtemplate | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
res_type: kb | ||||||
ticketid: 1691888 | ||||||
--- | ||||||
|
||||||
## Environment | ||||||
|
||||||
<table> | ||||||
<tbody> | ||||||
<tr> | ||||||
<td>Product</td> | ||||||
<td>Telerik UI for Blazor ChipList</td> | ||||||
</tr> | ||||||
</tbody> | ||||||
</table> | ||||||
|
||||||
## Description | ||||||
|
||||||
You can display additional information for each chip in the [ChipList](slug:chiplist-overview) by showing a tooltip. This approach helps you keep the chip text concise while providing more details on hover. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can also link to the Tooltip Overview here.
Suggested change
|
||||||
|
||||||
This article answers the following questions: | ||||||
- How do you show extra details for chips in a ChipList? | ||||||
- Can you display a TelerikTooltip for each chip in the ChipList? | ||||||
- How do you use `ItemTemplate` in Telerik Blazor ChipList? | ||||||
|
||||||
## Solution | ||||||
|
||||||
To add tooltips to chips in the ChipList, use the `ItemTemplate` to customize chip rendering and set a tooltip for each chip. Follow these steps: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Link to ChipList Templates here. |
||||||
|
||||||
1. Add a `Description` property to the model used for the ChipList. | ||||||
2. Use the `ItemTemplate` to render each chip and set the `title` attribute for a native tooltip. | ||||||
3. Optionally, use the `TelerikTooltip` component for enhanced tooltip appearance and behavior. | ||||||
|
||||||
**Example: Displaying Tooltips for Chips** | ||||||
|
||||||
```razor | ||||||
<TelerikChipList Data="@ChipListSource"> | ||||||
<ItemTemplate> | ||||||
<div title="@context.Description" class="chip-description"> | ||||||
<TelerikSvgIcon Icon="@context.Icon"></TelerikSvgIcon> | ||||||
@context.Text | ||||||
</div> | ||||||
</ItemTemplate> | ||||||
</TelerikChipList> | ||||||
|
||||||
<TelerikTooltip TargetSelector=".chip-description" /> | ||||||
|
||||||
@code { | ||||||
private List<ChipModel> ChipListSource { get; set; } = new List<ChipModel> | ||||||
{ | ||||||
new ChipModel | ||||||
{ | ||||||
Text = "Audio", | ||||||
Icon = SvgIcon.FileAudio, | ||||||
Description = "Audio file chip." | ||||||
}, | ||||||
new ChipModel | ||||||
{ | ||||||
Text = "Video", | ||||||
Icon = SvgIcon.FileVideo, | ||||||
Description = "Video file chip." | ||||||
} | ||||||
}; | ||||||
|
||||||
public class ChipModel | ||||||
{ | ||||||
public string Text { get; set; } | ||||||
public ISvgIcon Icon { get; set; } | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can make this compatible with both SVG and Font icons.
Suggested change
|
||||||
public string Description { get; set; } | ||||||
} | ||||||
} | ||||||
``` | ||||||
|
||||||
## See Also | ||||||
- [ChipList Overview](slug:chiplist-overview) | ||||||
- [ChipList Templates](slug:chiplist-templates#item-template) | ||||||
- [Tooltip Overview](slug:tooltip-overview) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider "Add" instead of "Adding". You don't google with "-ing"