Skip to Content

Customize your embed

Customize your embed

Make the embed look and behave like your app, with options that keep working after every release.

Set nothing and the embed already looks right: readable charts, a system font backup, a height that fits its box. When you want more, use three levels, in this order.

LevelUse it forWhere you set itStart here
1. ThemeYour brand: colors, font, corner radius, chart colors, spacing, layout choicesOnce per data app, in the Theming screen or admin-theme-optionsTheme fields
2. PartsOne region the theme does not cover: a border, a shadow, the selected row of a menuCSS on your page, with ::part()Parts and states
3. OptionsWhat this page shows: hide controls, your own words, the heightAttributes on <dbn-dashboard> or <dbn-metric>Hide options, Text overrides, Sizing

Named parts and the new hide and text keys require the plugin release that ships with this docs update ({{PLUGIN_VERSION}} or later).

Every name on these pages is a public contract. A rename or a removal is a major version. Class names and markup inside the embed can change in any release, so never style or select them.

What you get with no settings

  • The chart gets space first. On a small card the title, filters and legend give way before the chart shrinks.
  • A system font backup. If a font does not load, text and charts use the viewer’s system font, never a serif.
  • Existing legend defaults. The legacy design keeps the legend on single-series bar and line charts. V2 can hide a redundant one-series legend. Use the theme position or a chart’s own legend setting to choose what appears.
  • A height that fits its box. The embed fills the box you give it and scrolls inside. Set sizing-mode="auto" to let it grow instead.
  • A metric builder that works on a 13 inch laptop. The chart keeps its space and the builder scrolls.

What to use when

You want toUse
Use your brand color, font and corner radiusTheme fields
Use a font file you hostFonts
Put the filters on their own row, or fit more on a small screenLayout options
Show the chosen date range in wordsMake the date filter match your app
Change one region, such as the selected days in the date pickerParts and states
Remove search, downloads or full screenHide options
Change the words on buttons and empty cards, in more than one languageText overrides
Let the embed grow with its contentSizing
Make a custom chart follow your brandCustom charts
Find elements in your testsTest your embed with Playwright
Stop using CSS on internal class namesMove from internal class names to parts

Guides

If your page has a Content Security Policy

The embed adds its styles at run time as inline <style> elements. It needs a policy that allows them. If your page sets style-src-elem, allow the style elements there. Otherwise, the browser uses style-src.

From plugin {{PLUGIN_VERSION}}, the embed puts your page’s nonce on its own style elements. It reads the nonce from <meta property="csp-nonce" nonce="...">, from a <style id="dbn-styles" nonce="...">, or from the nonce of the script that loads the plugin. The date picker’s style element does not take the nonce yet. If you use 'unsafe-inline' to allow the date picker’s styles, the directive that controls style elements (style-src-elem, or style-src when your page has no style-src-elem) must have no nonce and no hash: a browser ignores 'unsafe-inline' in a directive that has either. When you load the plugin as an ES module, the embed cannot read a script nonce: give it with the <meta property="csp-nonce"> tag or a <style id="dbn-styles"> element. On older plugins a nonce-only policy leaves the whole embed unstyled.

DirectiveValueWhyWithout it
style-src'unsafe-inline'The embed writes its styles as inline <style> elements. From plugin {{PLUGIN_VERSION}} they take your nonce, except the date picker’s.The embed shows unstyled: serif text, menus and the date picker out of place. Legacy and v2.
font-srcdata:The built-in Inter font ships inside the embed as data: files.Text uses the viewer’s system sans font.
font-srcThe host of your font files, if you use general.fontsThe browser loads your files from there.Your font does not load; the system sans font is used.
style-src-elem (or style-src if absent) and font-srchttps://fonts.googleapis.com for the stylesheet and https://fonts.gstatic.com for the font filesNamed Google Fonts families can load from Google Fonts. System families load locally.The embed uses the system sans font if the requested Google font fails to load.
connect-srchttps://api.usedatabrain.com, or your base-urlThe embed reads its data from the Databrain API.No data loads.

Custom charts need more: see CSP for your page.

Some asks have no option on purpose. Not supported, and why gives the reason and what to do instead.