Angular List - Add Tooltips to Items

Use the onItemRendered event to add a title attribute to each item element after it is rendered. The browser displays this text as a native tooltip when a user hovers over the item.

app.component.html
app.component.ts
  • <dx-list
  • [items]="items"
  • (onItemRendered)="onItemRendered($event)">
  • </dx-list>
  • import { Component } from "@angular/core";
  • import { DxListModule } from "devextreme-angular";
  • import { ItemRenderedEvent } from "devextreme/ui/list";
  •  
  • @Component({
  • selector: "app-root",
  • templateUrl: "./app.component.html",
  • standalone: true,
  • imports: [DxListModule]
  • })
  • export class AppComponent {
  • items = [
  • { text: "Item 1", hint: "Description for item 1" },
  • { text: "Item 2", hint: "Description for item 2" }
  • ];
  •  
  • onItemRendered(e: ItemRenderedEvent) {
  • (e.itemElement as HTMLElement).title = e.itemData.hint;
  • }
  • }