
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
@kong-ui-public/dashboard-renderer
Advanced tools
Render Analytics charts on a page from a JSON definition.
Render Analytics charts on a page from a JSON definition.
vue must be initialized in the host applicationAnalyticsBridge must be installed in the root of the application.
provide the necessary methods to adhere to the AnalyticsBridge interface defined in @kong-ui-public/analytics-utilities.@kong-ui-public/analytics-chart@kong-ui-public/analytics-utilities@kong-ui-public/analytics-metric-provider@kong-ui-public/i18n@kong/kongponentsswrvvueThis component takes two properties:
v-model. When in editable mode, changes to tiles or the layout will automatically update the reactive reference bound to v-model.| Property | Type | Required | Default | Description |
|---|---|---|---|---|
| filters | AllFilters[] | Yes | - | Filters to be applied to the dashboard. Context filters are merged into tile specic filters. Filters that are not relevent to the tile's query datasource are ignored. |
| timeSpec | TimeRangeV4 | No | 7 days | The time range for queries. Tiles can provide their own time range, which will override the global time range for that tile. |
| tz | string | No | Local timezone | Timezone to include with queries, if different than the browser timezone |
| refreshInterval | number | No | DEFAULT_TILE_REFRESH_INTERVAL_MS | Interval for refreshing tiles |
| editable | boolean | No | false | Enables dashboard editing capabilities |
The DashboardRenderer component emits the following events.
| Event | Payload | Description |
|---|---|---|
tile-time-range-zoom | TileZoomEvent | Emitted when a timeseries chart tile is zoomed by selecting an area within the chart. |
<DashboardRenderer
v-model="config"
:context="context"
@tile-time-range-zoom="onZoom"
/>
with the following data:
import type { DashboardRendererContext, DashboardConfig } from '@kong-ui-public/dashboard-renderer'
import { DashboardRenderer } from '@kong-ui-public/dashboard-renderer'
const context: DashboardRendererContext = {
filters: [],
timeSpec: {
type: 'relative',
time_range: '15M',
},
editable: true, // Enable editing capabilities
}
const config: DashboardConfig = {
tiles: [
{
id: 'unique-tile-id', // Required for editable dashboards
definition: {
chart: {
type: 'horizontal_bar',
},
// Request count by route
query: {
metrics: ['request_count'],
dimensions: ['route']
},
},
layout: {
// Position at column 0, row 0
position: {
col: 0,
row: 0,
},
// Spans 3 columns and 1 rows
size: {
cols: 3,
rows: 1,
}
}
},
{
definition: {
chart: {
type: 'top_n',
chart_title: 'Top N Table',
description: 'Table description',
},
// Top 5 routes by request_count
query: {
metrics: ['request_count'],
dimensions: ['route'],
limit: 5,
},
},
layout: {
// Position at column 3, row 0
position: {
col: 3,
row: 0,
},
// Spans 3 columns and 1 rows
size: {
cols: 3,
rows: 1,
}
}
},
],
}
const onZoom = async (tileZoomEvent: TileZoomEvent) => {
// Update the time spec passed to the dashboard.
}
<DashboardRenderer
v-model="config"
:context="context"
>
<!-- use the `id` set in the tile config for the slot name -->
<template #slot-1>
<div>
<h3>Custom Slot</h3>
<p>This is a slotted tile</p>
</div>
</template>
</DashboardRenderer>
import type { DashboardRendererContext, DashboardConfig } from '@kong-ui-public/dashboard-renderer'
import { DashboardRenderer } from '@kong-ui-public/dashboard-renderer'
const context: DashboardRendererContext = {
filters: [],
timeSpec: {
type: 'relative',
time_range: '15M',
},
}
const config: DashboardConfig = {
tiles: [
{
// Line chart
definition: {
chart: {
type: 'timeseries_line',
},
// requests by status code over time
query: {
metrics: ['request_count'],
dimensions: ['status_code', 'time']
},
},
layout: {
// Position at column 0, row 0
position: {
col: 0,
row: 0,
},
// Spans 3 columns and 1 rows
size: {
cols: 3,
rows: 1,
}
}
},
{
// Slottable tile
definition: {
chart: {
type: 'slottable',
id: 'slot-1' // slot name
},
query: {},
},
layout: {
// Position at column 3, row 0
position: {
col: 3,
row: 0,
},
// Spans 3 columns and 1 rows
size: {
cols: 3,
rows: 1,
}
}
},
],
}
Note: this will only work in non-editable mode
This example will create a dynamically-sized row that fits to its content rather than being fixed at the configured row height. Note that this works because each chart is only rendered in 1 row; if a chart has fit_to_content and layout.size.rows > 1, the fit_to_content setting will be ignored.
Rendering AnalyticsChart components (e.g., horizontal bar, vertical bar, timeseries charts) with dynamic row heights may lead to undefined behavior. This option is best used with non-canvas charts (e.g., TopN charts).
import type { DashboardRendererContext, DashboardConfig } from '@kong-ui-public/dashboard-renderer'
import { DashboardRenderer } from '@kong-ui-public/dashboard-renderer'
const context: DashboardRendererContext = {
filters: [],
timeSpec: {
type: 'relative',
time_range: '15M',
},
}
const config: DashboardConfig = {
tiles: [
{
definition: {
chart: {
type: 'top_n',
chart_title: 'Top N chart of mock data',
description: 'Description'
},
query: {},
},
layout: {
position: {
col: 0,
row: 0,
},
size: {
cols: 4,
rows: 1,
fit_to_content: true,
},
},
},
{
definition: {
chart: {
type: 'top_n',
chart_title: 'Top N chart of mock data',
description: 'Description',
},
query: {},
},
layout: {
position: {
col: 3,
row: 0,
},
size: {
cols: 2,
rows: 1,
fit_to_content: true,
},
},
},
],
}
const context: DashboardRendererContext = {
filters: [],
timeSpec: {
type: 'relative',
time_range: '15M',
},
editable: true, // Enable editing capabilities
}
const config = ref<DashboardConfig>({
tiles: [
{
id: 'unique-tile-id', // Required for editable dashboards
definition: {
chart: {
type: 'horizontal_bar',
},
query: {
metrics: ['request_count'],
dimensions: ['route']
},
},
layout: {
position: {
col: 0,
row: 0,
},
size: {
cols: 3,
rows: 1,
}
}
}
]
})
watch(() => config.value.tiles, (tiles) => {
// Watch for changes to tiles.
})
<DashboardRenderer
v-model="config"
:context="context"
@edit-tile="handleEditTile"
/>
When editable is enabled:
The DashboardRenderer component emits the following events when in editable mode:
| Event | Payload | Description |
|---|---|---|
edit-tile | GridTile<TileDefinition> | Emitted when the edit button is clicked on a tile. The payload includes the complete tile configuration including its layout and metadata. |
remove-tile | GridTile<TileDefinition> | Emitted when a tile is removed via the kebab menu. The payload includes the configuration of the removed tile. |
<DashboardRenderer
v-model="config"
:context="context"
@edit-tile="handleTileEdit"
@remove-tile="handleTileRemoval"
/>
const handleEditTile = (tile: GridTile<TileDefinition>) => {
// Handle tile editing, e.g., open an edit modal
console.log('Editing tile:', tile.id)
}
const handleRemoveTile = (tile: GridTile<TileDefinition>) => {
// Handle tile removal, e.g., update backend
console.log('Removed tile:', tile.id)
}
watch(() => config.value.tiles, (tiles) => {
// Watch for changes to tiles.
console.log('Update tiles:', tiles)
})
Note: These events are only emitted when the dashboard is in editable mode (context.editable = true).
Note: When using editable dashboards, each tile should have a unique id property to properly track changes and handle events correctly. If no id is provided, one will be generated automatically, but this may lead to unexpected behavior when tracking changes to the tile.
The dashboard configuration schema is defined in @kong-ui-public/analytics-utilities.
The root configuration type for a dashboard.
interface DashboardConfig {
tiles: TileConfig[] // Array of tile configurations
tile_height?: number // Optional height of each tile in pixels
}
Configuration for individual dashboard tiles.
interface TileConfig {
definition: TileDefinition // The tile's chart and query configuration
layout: TileLayout // The tile's position and size in the grid
id?: string // Optional unique identifier (required for editable dashboards)
}
Configuration for the chart and query within a tile.
interface TileDefinition {
chart: ChartOptions // Configuration for the chart type and options
query: ValidDashboardQuery // Configuration for the data query
}
Chart type and options configuration.
interface ChartOptions {
type: DashboardTileType // The type of chart
chart_title?: string // Optional title for the chart
synthetics_data_key?: string // Optional key for synthetic tests
allow_csv_export?: boolean // Optional flag to allow CSV export
chart_dataset_colors?: AnalyticsChartColors | string[] // Optional custom colors for datasets
}
The following chart types are supported:
horizontal_bar: Horizontal bar chartvertical_bar: Vertical bar chartgauge: Gauge charttimeseries_line: Line chart for time series datatimeseries_bar: Bar chart for time series datagolden_signals: Metric cards showing key performance indicatorstop_n: Table showing top N resultsslottable: Custom content slotEach chart type has its own configuration schema with specific options.
Most chart types support these common properties:
chart_title: String title for the chartsynthetics_data_key: Key for synthetic tests (if applicable)allow_csv_export: Boolean to enable/disable CSV exportchart_dataset_colors: Custom colors for datasets (object or array) { [key: string]: string } | string[]See here for explore query types.
Queries can be configured for three different data sources:
advanced: Uses the advanced explore APIbasic: Uses the basic explore APIai: Uses the AI explore APIEach query type supports:
metrics: Array of aggregations to collectdimensions: Array of attributes to group by (max 2)filters: Array of query filterstime_range: Time range configuration (relative or absolute)granularity: Time bucket size for temporal querieslimit: Number of results to returnSee here for time range types.
Note: Providing a time range in with the tile query will override the global time range provided in the dashboard context.
Two types of time ranges are supported:
{
type: 'relative'
time_range: string // e.g., '1h', '7d'
tz?: string // Renderer defaults to browser timezone if not provided'
}
{
type: 'absolute'
start: string // Start timestamp
end: string // End timestamp
tz?: string // Timezone
}
The TileLayout type controls tile positioning and sizing:
interface TileLayout {
position: {
col: number // Starting column (0-based)
row: number // Starting row (0-based)
}
size: {
cols: number // Number of columns to span
rows: number // Number of rows to span
fit_to_content?: boolean // Enable auto-height for the row
}
}
const dashboardConfig: DashboardConfig = {
tiles: [{
id: 'requests-by-route',
definition: {
chart: {
type: 'horizontal_bar',
chart_title: 'Requests by Route'
},
query: {
datasource: 'advanced',
metrics: ['request_count'],
dimensions: ['route']
}
},
layout: {
position: { col: 0, row: 0 },
size: { cols: 3, rows: 1 }
}
}]
}
FAQs
Render Analytics charts on a page from a JSON definition.
The npm package @kong-ui-public/dashboard-renderer receives a total of 8,331 weekly downloads. As such, @kong-ui-public/dashboard-renderer popularity was classified as popular.
We found that @kong-ui-public/dashboard-renderer demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.