Skip to main content

Interactive Demo

Try out the components with different options in DataBrain’s playground
This reference guide provides detailed documentation for all available options and properties for Databrain’s web components: dbn-dashboard and dbn-metric.

Understanding the Configuration Layers

Databrain components have four configuration layers that are applied in a specific priority order. Understanding this hierarchy is essential for getting the behavior you expect.
Settings are resolved from highest priority (top) to lowest priority (bottom). A higher-priority layer always wins when the same setting exists in multiple layers.
chart-appearance vs custom-chart-settings field names differ. These two layers evolved independently and use different keys for overlapping concepts. See the Field Name Mapping table below for a cross-reference.
custom-chart-settings only applies to newly created metrics. If a metric already exists in the database with saved settings, the custom-chart-settings prop will not override those saved values. This is by design — custom-chart-settings provides defaults for metric creation, not runtime overrides. To override settings on existing metrics, use chart-appearance instead.

Dashboard Component (dbn-dashboard)

The dashboard component displays a complete dashboard with multiple metrics and interactive features.

Required Properties

string
required
Guest token for authentication. Must be generated from your backend using the Databrain API.
string
required
Unique identifier for the dashboard to display.

Display & Layout Options

boolean
default:"false"
Hides the table preview in full screen view.
boolean
default:"false"
Hides chart settings in full screen view.
boolean
default:"false"
Disables the full screen option for the dashboard.
boolean
default:"false"
Enables fullscreen mode when the metric title is clicked. Provides an alternative way for users to enter fullscreen without using the fullscreen button.
string
default:"kebab-menu-vertical"
Controls which options icon to display. Options: kebab-menu-vertical | download
boolean
default:"false"
Makes dashboard filters sticky at the top when scrolling.
object
Controls the visibility and configuration of the settings icon. Must be passed as JSON.stringify(...).
string
Custom label text for the settings button.
string
Custom SVG markup for the settings button icon.
string
default:"bottom-start"
Controls where the settings menu popup is anchored relative to the settings button. Options: "auto" | "auto-start" | "auto-end" | "top" | "bottom" | "right" | "left" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end"
boolean
default:"false"
Enables CSV download option in metric card actions.
boolean
default:"false"
Enables email CSV option in metric card actions.
boolean
default:"false"
Disables PNG download option in full screen mode.
boolean
default:"false"
Enables download option for all metrics at once.
boolean
default:"false"
Enables PDF download option for all metrics at once.

Advanced Configuration

The options prop accepts a JSON object with the following properties:
boolean
default:"false"
Prevents downloading data when no filters are applied.
boolean
default:"false"
Prevents downloading underlying data when no filters are applied.
boolean
default:"false"
Shows a custom screen when no data is available.
boolean
default:"false"
Disables the ability to create new metrics.
boolean
default:"false"
Disables the ability to update existing metrics.
boolean
default:"true"
Controls visibility of dashboard actions like create metric, customize layout.
string
default:"board"
Renames the dashboard “Board” view-filter UI text (tab label, dropdown label, Add/Save CTA, and modal copy). If the value contains multiple words, only the first word is used.
boolean
default:"false"
Enables the dashboard minimap and progress header in an embedded dashboard. The minimap is disabled by default in embeds; set this option to true inside the dashboard options object to enable it. This option applies to dbn-dashboard and does not change the UI Theming setting used by dashboards in the app.
boolean
default:"false"
Makes full screen modal take up space equivalent to the dashboard component.
boolean
default:"false"
When enabled, the component appends state information (such as the active metric) to the browser URL. Useful for deep-linking into a specific view.
string
default:"bottom-right"
Controls the position of the “Exporting Dashboard” prompt that appears while a dashboard export is in progress. Set to "hidden" to suppress the message entirely. Options: "bottom" | "bottom-left" | "bottom-right" | "center" | "top" | "top-left" | "top-right" | "hidden"
object
Controls the horizontal and vertical spacing between the metrics on the grid. Optional hide field hides the Adjust Spacing button from Customize Layout.
string
Optional CSS value for the main dashboard embed wrapper padding. Uses the same rules as the standard CSS padding shorthand (for example "16px", "12px 24px", "8px 12px 16px"). Applied as an inline style on the embed dashboard container.
object
Optional styling overrides for dashboard CTA buttons (primary, secondary, and tertiary variants). Injected styles target .cta-primary, .cta-secondary, and .cta-tertiary, so they apply anywhere those classes are used in the embedded experience (for example dashboard action buttons and full-screen metric controls).Each variant supports optional string fields — pass fragments of CSS declarations (semicolon-separated), similar to inline style text:
  • styles — base state
  • hoverStyles:hover:enabled
  • activeStyles:active
  • disabledStyles:disabled
array
Array of color strings for chart styling. Defaults to Recharts default colors.
array
Array of custom color palette options that users can select from. Each palette should contain a name and an array of 9 colors for comprehensive chart coverage.
object
Detailed chart styling configuration for tooltips, labels, margins, legends, and axes.
Configure global filters for the dashboard:
object
Custom theme configuration for component styling.
string
Name of a predefined theme from app settings UI theming.
object
Advanced UI theming configuration for the dashboard. Controls fonts, backgrounds, CTA colors, card styling, and chart palettes. Must be passed as JSON.stringify(...).
string
Name of the theme.
string
Global font family applied to the dashboard.
string
Date format string for date pickers (e.g. "DD-MM-YYYY", "MM-DD-YYYY", "YYYY-MM-DD").
string
Background color of the dashboard container.
string
Primary call-to-action button color.
string
Text color for call-to-action buttons.
string
default:"medium"
Size of filter select boxes. Options: "small" | "medium" | "large"
string
default:"floating"
Style variant for filter select boxes. Options: "floating" | "static"
string
Border radius for filter select boxes (e.g. "8px").
string
Text color for filter select boxes.
string
Background color of individual metric cards.
string
Font size of metric card titles (e.g. "16px").
string
Font weight of metric card titles (e.g. "600").
string
Text color of standard metric card titles (.dbn-metric-card-title).
string
Text color for element metric titles — titles rendered in the element layout (.dbn-metric-element-title). Use when element metrics should differ from cardTitle.color. Applied with !important when set.
string
Font size of metric card descriptions.
string
Font weight of metric card descriptions.
string
Text color of standard metric card descriptions (.dbn-metric-card-description).
string
Text color for element metric descriptions (.dbn-metric-element-description). Separate from cardDescription.color; applied with !important when set.
array
Array of custom chart color palettes. Each palette has a name and an array of colors.
array
Array of palette name strings available for selection.
string
Name of the currently selected palette.
string
Font family applied to chart axis labels, legend text, and chart titles (e.g. "Roboto").
string
Default text color for chart axis labels, legend text, and chart titles (e.g. "#333333").
string
Letter spacing applied to chart text elements (e.g. "0.5px").
object
Global tooltip font configuration with nested header, label, and value objects. Each accepts fontFamily, fontSize, fontWeight, and fontColor.
Known limitation: The chart-level font fields (chart.fontFamily, chart.fontColor, chart.letterSpacing, chart.tooltip) are currently only applied from saved admin themes (configured via the Databrain admin UI or the theme-name prop). Passing them directly via the admin-theme-options prop will not affect chart rendering. Other admin-theme-options fields (dashboard colors, card styling, palettes, datePickerFormat) work correctly via the prop.
string
Inner padding of metric cards (e.g. "16px").
string
Border radius of metric cards (e.g. "8px").
string
Box shadow of metric cards (e.g. "0 2px 8px rgba(0,0,0,0.1)").
boolean
default:"false"
Disables the shadow effect when hovering over metric cards.
boolean
default:"false"
Disables the border stroke around metric cards.
string
Border stroke color for metric cards when stroke is enabled (e.g. "#E0E0E0").

Additional Dashboard Properties

object
Controls the appearance of metric long-description tooltips. Must be passed as JSON.stringify(...).
array
Restricts which columns are available to end users for each metric. Each entry targets a specific metric. Must be passed as JSON.stringify(...).

Per-Metric Chart Settings

object
Per-metric chart settings that allow you to set default values and control whether end users can edit each setting. Must be passed as JSON.stringify(...). Refer to the Custom Chart Settings Reference section below for the complete schema.

Internationalization

string
default:"en"
Language code for component localization (e.g., “fr”, “es”, “de”).
object
Custom translation dictionary for component text.
string
default:"default"
Calendar system to use. Options: default | ind

Event Handling

string
Name of a global function to handle server events. Define the function in the global scope.

Custom Chart Click Action

string
Name of a global function to call when a user clicks on a chart data point. Define the function in the global scope.
The shape of the data parameter depends on the chart type:
When Pass Complete Data is not enabled, the clicked value is directly passed instead of the data object.

Custom Messages

object
Custom messages for various component states.

Custom Chart Settings Reference

The custom-chart-settings prop allows you to configure default values and control end-user editability for individual chart settings on each metric card. Every field follows the shape { defaultValue: <value>, canEdit: true | false }.
custom-chart-settings defaults are only applied when a metric is first created. They do not override settings already saved on existing metrics. See Understanding the Configuration Layers.

Field Name Mapping

The chart-appearance prop (Priority 1) and custom-chart-settings prop (Priority 3) use different field names for overlapping concepts. Use this table to find the equivalent field when switching between layers.

Metric Component (dbn-metric)

The metric component displays a single metric with customizable appearance and interactions.

Required Properties

string
required
Guest token for authentication.
string
required
Unique identifier for the metric to display.

Display Properties

string|number
default:"500"
Width of the metric component in pixels.
string|number
default:"300"
Height of the metric component in pixels.
string
default:"card"
Display variant. Options: card | fullscreen
string
default:"svg"
Chart rendering method. Options: svg | canvas

Behavior Options

boolean
default:"false"
Enables CSV download in metric card actions.
boolean
default:"false"
Enables email CSV option in metric card actions.
boolean
default:"false"
Disables PNG download in full screen mode.
boolean
default:"false"
Disables the full screen button.
boolean
default:"false"
Hides table preview in full screen view.
boolean
default:"false"
Hides chart settings in full screen view.
boolean
default:"false"
Disables access to underlying data.
boolean
default:"false"
Removes border from metric card.
boolean
default:"false"
Removes shadow from metric card.
boolean
default:"false"
Hides the metric card title.
boolean
default:"false"
Enables fullscreen mode when the metric title is clicked.
string
default:"kebab-menu-vertical"
Controls which options icon to display. Options: kebab-menu-vertical | download
boolean
default:"false"
Prevents downloading underlying data when no filters are applied.
boolean
default:"false"
Prevents downloading data when no filters are applied.

Filter Configuration

boolean
default:"false"
Allows multiple metric filters.
string
default:"inside"
Position of metric filters. Options: inside | outside
object
Configuration for metric-specific filters.

Chart Appearance

object
Detailed chart styling configuration.
object
Interactive appearance options for the metric.

Internationalization & Configuration

string
default:"en"
Language code for component localization (e.g., "fr", "es", "de").
object
Custom translation dictionary for metric text. Must be passed as JSON.stringify(...). See the dashboard Internationalization section for the full schema.
string
default:"default"
Calendar system to use. Options: default | ind
string
Name of a predefined theme from app settings UI theming.
object
Custom messages for component states. Must be passed as JSON.stringify(...).
object
Pre-configured filter values for the metric. Must be passed as JSON.stringify(...). See the dashboard Global Filter Options section for the full schema.
object
Controls the appearance of metric long-description tooltips. Must be passed as JSON.stringify(...).
object
Restricts which columns are available to end users for this metric. Must be passed as JSON.stringify(...).

Event Callbacks

string
Name of global function to call when metric is minimized.

Common Properties

These properties are available for both dashboard and metric components:

Styling & Customization

string
Inline CSS styles for the component.
string
CSS class name for custom styling.
array
Array of colors for chart elements.

No Data Handling

string
SVG code as string to display when no data is available.
string
SVG code as string to display when no data is found in dashboard.

Date Picker Configuration

array
Array of date picker option labels to hide.

Usage Examples


Frequently Asked Questions

Web components don’t automatically re-render when properties change. Here are several approaches:Method 1: Force Re-render with Key
Method 2: Loading State Approach
This usually happens due to incorrect format or timing. Here are common solutions:Ensure Proper Format:
Use JSON.stringify for Complex Objects:
Check CSS Specificity:
Set Up Custom Messages:
Handle Server Events:
Automatic Token Refresh:
Hide Specific Date Picker Options:
Custom Filter Styling:
Global Filter Configuration:
Common Causes & Solutions:
  1. Invalid Token:
  1. Incorrect Dashboard ID:
  1. Missing Import:
  1. Network/CORS Issues:
Client-Side Implementation:
Backend Token Generation:
Enable Canvas Rendering:
Disable Heavy Features:
Lazy Loading Implementation:
Responsive Width/Height:
CSS Media Queries:
Mobile-Specific Options:
Global Error Handler:
Component-Level Error Boundaries:
Advanced Tooltip Customization:
Legend Positioning:
Complete Chart Appearance:

Migration & Updates

When updating from older versions, note that some property names may have changed. Always refer to this reference for the latest property names and structures.
For dynamic property updates, web components don’t automatically re-render. Consider using a loading state and temporarily hiding/showing the component when updating properties.

Troubleshooting Quick Reference

  • ✅ Check if @databrainhq/plugin/web is imported
  • ✅ Verify token is valid and not expired
  • ✅ Confirm dashboard-id/metric-id exists
  • ✅ Check browser console for errors
  • ✅ Ensure CORS is properly configured
  • ✅ Use JSON.stringify() for object props
  • ✅ Check CSS specificity conflicts
  • ✅ Verify color format (use hex codes)
  • ✅ Test with !important to identify overrides
  • ✅ Enable canvas rendering for large datasets
  • ✅ Disable unnecessary features (loaders, underlying data)
  • ✅ Implement lazy loading for multiple components
  • ✅ Use shouldFitFullScreen for better performance

Need More Help?

Check our comprehensive troubleshooting guide for additional solutions