ColumnViewRenderer
Custom view renderer function for cell content.
Returns one of:
Node- DOM element to display in the cellstring- HTML string (parsed and inserted)void | null- Use default text rendering
type ColumnViewRenderer = (ctx: CellRenderContext<TRow, TValue>) => Node | string | void | nullExample
Section titled “Example”// DOM element (recommended for interactivity)const avatarRenderer: ColumnViewRenderer<Employee> = (ctx) => { const img = document.createElement('img'); img.src = ctx.row.avatarUrl; img.alt = ctx.row.name; img.className = 'avatar'; return img;};
// HTML string (simpler, good for static content)const emailRenderer: ColumnViewRenderer = (ctx) => { return `<a href="mailto:${ctx.value}">${ctx.value}</a>`;};
// Conditional renderingconst conditionalRenderer: ColumnViewRenderer = (ctx) => { if (!ctx.value) return null; // Use default return `<em>${ctx.value}</em>`;};See Also
Section titled “See Also”CellRenderContextfor available context properties
AI assistants: For complete API documentation, implementation guides, and code examples for this library, see https://raw.githubusercontent.com/OysteinAmundsen/toolbox/main/llms-full.txt