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.
| Level | Use it for | Where you set it | Start here |
|---|---|---|---|
| 1. Theme | Your brand: colors, font, corner radius, chart colors, spacing, layout choices | Once per data app, in the Theming screen or admin-theme-options | Theme fields |
| 2. Parts | One region the theme does not cover: a border, a shadow, the selected row of a menu | CSS on your page, with ::part() | Parts and states |
| 3. Options | What this page shows: hide controls, your own words, the height | Attributes 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 to | Use |
|---|---|
| Use your brand color, font and corner radius | Theme fields |
| Use a font file you host | Fonts |
| Put the filters on their own row, or fit more on a small screen | Layout options |
| Show the chosen date range in words | Make the date filter match your app |
| Change one region, such as the selected days in the date picker | Parts and states |
| Remove search, downloads or full screen | Hide options |
| Change the words on buttons and empty cards, in more than one language | Text overrides |
| Let the embed grow with its content | Sizing |
| Make a custom chart follow your brand | Custom charts |
| Find elements in your tests | Test your embed with Playwright |
| Stop using CSS on internal class names | Move from internal class names to parts |
Guides
- Match your brand in 5 minutes
- Make the date filter match your app
- Test your embed with Playwright
- Set up an embed with an AI agent
- Move from internal class names to parts
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.
| Directive | Value | Why | Without 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-src | data: | The built-in Inter font ships inside the embed as data: files. | Text uses the viewer’s system sans font. |
font-src | The host of your font files, if you use general.fonts | The 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-src | https:/ for the stylesheet and https:/ for the font files | Named 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-src | https:/, or your base-url | The 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.