Skip to Content

Customize your embed

Appearance

Each look the embed can take, as a screenshot with the exact settings that make it. Copy the settings to your page.

Each section below is one look, with the settings that make it. Copy the settings, paste them on your <dbn-dashboard>, and change the values to yours. The screenshots use sample dashboard data. Switch the docs to dark mode to see the examples with a dark preview.

The examples set admin-theme-options only, so each one starts from the built-in look, not from a theme saved in your data app. To start from a saved theme, add theme-name: each field you set then goes on top of it.

To try a look on live demo data, paste its settings into the Code tab of the Embed Playground and select Run. New theme settings such as general.density and dashboard.filterBar require the plugin release that ships with this docs update ({{PLUGIN_VERSION}} or later).

LookThe setting
The built-in looknone
Brand colordashboard.ctaColor, chart.selected: "Brand"
Fontgeneral.fontFamily
Corner radiuscardCustomization.borderRadius, dashboard.selectBoxBorderRadius
Compact spacinggeneral.density
Dark modecolor-scheme
Filter bardashboard.filterBar
All togetherall of the above

The built-in look

With no theme fields, the embed uses the Inter font, cards with a 4px radius and near-black primary buttons. Start here and set only what is different in your app.

The Demo Dashboard with the built-in look: Inter text, cards with small rounded corners, filters in one row above the cards.
The built-in look
<dbn-dashboard
  token="GUEST_TOKEN"
  dashboard-id="DASHBOARD_ID"
  admin-theme-options='{}'
></dbn-dashboard>

Brand color

Set your brand color and select the built-in Brand palette. This teal example derives a teal shade for the first chart swatch. The embed also derives shades for states such as focus, hover and pressed.

A sample dashboard with teal chart colors.
Brand color
<dbn-dashboard
  token="GUEST_TOKEN"
  dashboard-id="DASHBOARD_ID"
  admin-theme-options='{
    "dashboard": { "ctaColor": "#0F766E" },
    "chart": { "selected": "Brand" }
  }'
></dbn-dashboard>

A brand color with enough hue can supply the built-in chart palette. Neutral colors such as gray can leave charts on their existing palette. A saved chart palette named Brand keeps its own colors. Theme fields lists the shades the embed makes from your color.

Font

Name a Google Fonts family and it loads on its own. The charts use it too. To use a font file you host, see Fonts.

The Demo Dashboard with Manrope in the card titles, the values and the chart axis.
Font
<dbn-dashboard
  token="GUEST_TOKEN"
  dashboard-id="DASHBOARD_ID"
  admin-theme-options='{
    "general": { "fontFamily": "Manrope" }
  }'
></dbn-dashboard>

Corner radius

Cards and filter controls have their own radius, from 0 to 32px for cards and 0 to 24px for controls. Set both to match the corners in your app.

Cards with 16px corners and filter controls with 8px corners.
Corner radius
<dbn-dashboard
  token="GUEST_TOKEN"
  dashboard-id="DASHBOARD_ID"
  admin-theme-options='{
    "dashboard": { "selectBoxBorderRadius": "8px" },
    "cardCustomization": { "borderRadius": "16px" }
  }'
></dbn-dashboard>

Compact spacing

compact moves card padding, the gaps between cards, filter height and table rows one step down on the 4px grid. Text size stays the same, and click targets stay 28px or taller. Use it when your users have small laptops.

Compact spacing: less space between the cards, around the filters and inside each card.
Compact spacing
<dbn-dashboard
  token="GUEST_TOKEN"
  dashboard-id="DASHBOARD_ID"
  admin-theme-options='{
    "general": { "density": "compact" }
  }'
></dbn-dashboard>

Dark mode

Dark mode needs plugin 0.17.0 or later. If you use an older version, update the plugin. Choose a version.

Set color-scheme to light, dark, system or theme. system follows the viewer’s device setting. theme uses the saved theme’s mode.

From plugin {{PLUGIN_VERSION}}, color-scheme="auto" follows your page’s own light or dark switch. The embed looks at itself and each parent up to <html>, and the nearest one that names a mode wins: a data-theme, data-color-mode, data-color-scheme, data-mode or data-bs-theme attribute whose value has dark or light, or a dark, dark-mode, theme-dark, light, light-mode or theme-light class. If none names a mode, it uses the CSS color-scheme it inherits, then the viewer’s device setting. It changes when your page switches. In options.colorScheme, auto works as system. A value that is not on this list is left out, with one console warning.

The Demo Dashboard in dark mode with the built-in theme.
Dark mode
<dbn-dashboard
  token="GUEST_TOKEN"
  dashboard-id="DASHBOARD_ID"
  color-scheme="dark"
></dbn-dashboard>

With plugin {{PLUGIN_VERSION}} or later, the built-in Brand palette supports derived brand shades in Dark mode. Dark mode can adjust a neutral primary color for contrast. The shared calendar can use its own primary color. See Style the date filter to target the date filter with named parts.

To use other colors in dark mode only, put theme fields in general.darkOverrides. Theme fields lists the fields it takes.

Filter bar

Layout options take one value from a fixed list. Here the filters share the row and stretch to its end, each filter name sits above its control, and the line above the date filter says the chosen range in words.

The date filter takes a wide share of the filter row, filter names sit above the controls, and the line above the date filter reads Date of Sale: Last Year.
Filter bar
<dbn-dashboard
  token="GUEST_TOKEN"
  dashboard-id="DASHBOARD_ID"
  admin-theme-options='{
    "dashboard": {
      "filterBar": { "layout": "full-width", "labelPlacement": "above", "dateRangeLabel": "on" }
    }
  }'
></dbn-dashboard>

Layout options has every value, and the chart legend position.

All together

Combine the brand color and built-in Brand palette with the font, corner radius, compact spacing, filter bar and legend.

The sample dashboard with teal charts, compact spacing, rounded cards and labels above the filter controls.
All together
<dbn-dashboard
  token="GUEST_TOKEN"
  dashboard-id="DASHBOARD_ID"
  admin-theme-options='{
    "general": { "fontFamily": "Manrope", "density": "compact" },
    "dashboard": {
      "ctaColor": "#0F766E",
      "selectBoxBorderRadius": "8px",
      "filterBar": { "layout": "full-width", "labelPlacement": "above", "dateRangeLabel": "on" }
    },
    "cardCustomization": { "borderRadius": "12px" },
    "chart": { "selected": "Brand", "legend": { "position": "bottom" } }
  }'
></dbn-dashboard>

To keep a look for every embed of the data app, save the same values in the Theming screen and load the theme with theme-name.

Change the look while the page is open

Change an attribute on the element and the embed repaints in place. The page does not reload.

Each new attribute value replaces the previous one. Read the current settings before changing a field to keep the rest of the look, including Brand.

Change the corner radius
const dashboard = document.querySelector('dbn-dashboard');
const theme = JSON.parse(dashboard.getAttribute('admin-theme-options') ?? '{}');
dashboard.setAttribute(
  'admin-theme-options',
  JSON.stringify({
    ...theme,
    cardCustomization: { ...theme.cardCustomization, borderRadius: '16px' },
  })
);

Follow your app’s mode the same way. Call this when your app switches between light and dark:

Switch to dark mode
document.querySelector('dbn-dashboard').setAttribute('color-scheme', 'dark');

Next