# Tooltips

There is no built-in tooltip API on ColumnDef. Use the standard title attribute, an accessible <dialog>, or any popover library - wired through a custom cell renderer.

With title (no JS, screen-reader friendly)

{
  field: 'description',
  cell: (ctx) => renderSnippet(EllipsisCell, {
    value: String(ctx.getValue() ?? ''),
  }),
}
{#snippet EllipsisCell(p: { value: string })}
  <span title={p.value} class="block truncate">{p.value}</span>
{/snippet}

title is the safest default: screen readers announce it; mouse users see a tooltip; keyboard users see it on focus (when wrapped in a focusable element).

With a popover library

Pass a component instead of a snippet:

import TooltipCell from './TooltipCell.svelte'
import { renderComponent } from 'sv-grid-community'

{
  field: 'description',
  cell: (ctx) => renderComponent(TooltipCell, {
    value: String(ctx.getValue() ?? ''),
    tip: ctx.row.original.fullDescription,
  }),
}

Header tooltips

The same pattern, but via the header: field - see Custom header components.

Gotchas

See also