LoadingRenderer
Since v1.7.0
Custom loading renderer function. Returns an element or HTML string to display as the loading indicator.
Used with the loadingRenderer property in GridConfig to replace
the default spinner with custom content.
When a string is returned it is passed through the grid’s HTML sanitizer
before being inserted (same as cell and empty-state renderers), so scripts
and event-handler attributes are stripped. Return an HTMLElement if you
need full control over the produced DOM.
type LoadingRenderer = (context: LoadingContext) => HTMLElement | stringExample
Section titled “Example”// Simple text loading indicatorconst textLoader: LoadingRenderer = () => { const el = document.createElement('div'); el.textContent = 'Loading...'; return el;};
// Custom spinner with size awarenessconst customSpinner: LoadingRenderer = (ctx) => { const spinner = document.createElement('my-spinner'); spinner.size = ctx.size === 'large' ? 48 : 24; return spinner;};
// Material Design-style progress barconst progressBar: LoadingRenderer = () => { const container = document.createElement('div'); container.className = 'progress-bar-container'; container.innerHTML = '<div class="progress-bar"></div>'; return container;};
grid.gridConfig = { loadingRenderer: customSpinner,};See Also
Section titled “See Also”LoadingContextfor the context object passed to the rendererLoadingSizefor size variants (‘large’ | ‘small’)
AI assistants: For complete API documentation, implementation guides, and code examples for this library, see https://toolboxjs.com/llms-full.txt