Skip to Content

Customize your embed

Not supported, and why

What the embed does not do, the reason, and the supported way to get the same result.

Use these options when your embed needs a different layout, style or behavior. The new parts, filter key and theme options on this page require the plugin release that ships with this docs update ({{PLUGIN_VERSION}} or later).

Not supportedWhyDo this instead
CSS on our internal class namesThey can change in any release.Theme fields first, named parts second.
Forks and one-off buildsA fork misses every fix we ship after it.The supported options. Every customer gets the same ones.
Backports to an older embedOlder releases get fixes for severe security issues only.Move to the current plugin release.
An option for a single customerEach option is one more thing every customer must learn and we must keep.Theme fields and parts. Tell us the ask; we count it.
New on and off switchesA switch per customer splits the product.Features come with your plan.
A copy of your app inside the embedWe cannot follow each host app’s changes.Theme fields and parts, so the embed looks like yours.
Minimum and maximum height optionsA fixed height squeezes or cuts the chart at some screen sizes.sizing-mode="auto", or a height on the element.
Local time for hour presetsHour presets use UTC.Use a UTC hour preset.
Cross filters between unrelated fieldsA cross filter uses the clicked dimension.Use a shared field on the source and target cards.
CSS for axis titlesThe chart draws them on a canvas.Set the font with chart.axis.titleStyle.
A unique selector from the filter key aloneTwo filters can share a saved column key.Match data-dbn-filter-key on the filter part. Add the filter kind if it gives you one match.
Styling on attributes inside the embedAttributes inside the embed change with the markup.State tokens such as ::part(menu-item--selected).
More statesEach state is a promise on every part that takes it.:hover and :focus-visible after ::part().
A CSS value for layoutA free value cannot be checked or previewed.The layout fields: a value from a fixed list.
Density or a font for one partParts that disagree make the embed look broken.One density and one font in the theme. Parts can set font-size and padding.
Font upload to DatabrainYou keep the font file and its licence.Host the file and list it in general.fonts.
Your own text keysA key we do not know never matches a screen.The fixed text keys of custom-messages.
Hide as a permissionhide only takes a control off the screen.The guest token decides what a viewer can get.
A theme per tenant in the guest tokenA theme in the token changes how tokens work.Pick the theme on your page with theme-name.
The full theme in email reports and PDFsReports draw their own charts on the server, for print.Brand color, logo, chart palette and date format carry over.

CSS on our internal class names

Class names inside the embed carry a build hash, for example _bn-card_9fa1_12. The markup under them also changes. A rule or a test that uses them can break on any release, with no warning.

Do this instead:

  1. Set colors, fonts, card shape, chart colors and layout with theme fields.
  2. Style what the theme does not cover with named parts, for example dbn-dashboard::part(date-filter).
  3. Select the same parts in tests: [part~="date-filter"].

Forks and one-off builds

We do not make a private build or a fork of the embed for one customer. A fork stops getting fixes and security patches the day it is made.

Do this instead: use the supported options. They are the same for every customer, large or small. If an option is missing, tell your Databrain contact what you want the viewer to see.

Backports to an older embed

Older releases of the plugin get fixes for severe security issues only. New features and other fixes ship in the current release.

Do this instead: move to the current release. Install the bare package name, @databrainhq/plugin, to get it.

An option for a single customer

A new prop, theme field or part is a promise we keep for every customer. We add one when three or more customers ask for the same result.

Do this instead:

  1. Look for a theme field or a part that gets the result. Most visual asks are one of these.
  2. Tell your Databrain contact the result you want and why. We count each ask.

New on and off switches

We do not add a switch for one customer. A feature that is not for everyone comes with your plan.

Do this instead: ask your Databrain contact to turn the feature on for your company.

A copy of your app inside the embed

We do not rebuild your app’s buttons, menus or layouts inside the embed. Your app changes on your schedule; the copy would fall behind.

Do this instead: give the embed your brand with theme fields (font, colors, corner radius) and parts (borders, shadows, menu shape). The embed then looks like your app, and keeps up when you change the theme.

Minimum and maximum height options

An embed or dashboard card uses the space its container gives it. Inside a card the chart keeps its space as the title, filters and legend give way. Height, min-height and max-height are on no part’s allowed CSS list.

Do this instead:

  • To make the embed as tall as its content, set sizing-mode="auto". Your page scrolls, and the dbn-height-change event tells an iframe or a container the new height.
  • To give the embed a fixed box, set a height on <dbn-dashboard> or its container. With the default sizing-mode="fixed" the embed fills that box and scrolls inside it.
  • To change spacing or the legend inside a card, use general.density, chart.legend.position and parts.
  • The metric builder sizes itself and scrolls inside. If you already set options.metricEditorPreviewHeight, see The metric builder for its preview bounds.
<dbn-dashboard
  token="GUEST_TOKEN"
  dashboard-id="DASHBOARD_ID"
  sizing-mode="auto"
></dbn-dashboard>

Size the embed has the event and an iframe example. Set min-height: 0 on your own flex item if it needs to shrink. The embed has no such default.

Local time for hour presets

Hour presets use UTC. Today so far starts at midnight UTC. Use the hour preset settings for a rolling window or the current UTC day.

Cross filters between unrelated fields

A cross filter uses the clicked dimension. There is no setting to map its field id to an unrelated field id on another card. Build the source and target with a shared field.

CSS for axis titles

The chart draws axis titles on a canvas. Set their font with chart.axis.titleStyle.

A stable key for one dashboard filter

A dashboard filter exposes its saved key in data-dbn-filter-key. In a test, combine [part~="filter"] with the key, for example [data-dbn-filter-key="region"]. A filter kind can narrow the match when two filters share a key. See Pick one dashboard filter for an example.

Move, resize or select a card

Use layout-customize to enter layout editing. Drag the card itself to move it and layout-resize-handle to resize it. Use layout-save or layout-discard to finish. These are among the 18 builder, action and layout additions in Parts and states.

To select a particular card in a test, combine [part~="card"] with the card element’s id. Test with Playwright has an example.

Styling on attributes inside the embed

A rule such as [data-state="open"] or [aria-selected="true"] cannot reach inside the embed: ::part() takes part names only. A rule added inside the shadow root on these attributes breaks when the markup changes.

Do this instead: style the state token. It is on the part only while the state is true.

:is(dbn-dashboard, dbn-metric, #dbn-portal, [data-dbn-embed-portal])::part(menu-item--selected) {
  font-weight: 600;
}

States lists each part’s states.

More states

The embed has five states: selected, open, disabled, invalid and active. There is no hover, focus, checked, sorted, applied or range-start state.

Do this instead:

  • For hover and keyboard focus, use the pseudo-classes: ::part(menu-item):hover, ::part(menu-item):focus-visible.
  • For a checked row, use selected.
  • Tell your Databrain contact which state you need and why. We add one when three or more customers ask.

A CSS value for layout

The layout fields take a value from a fixed list, for example "full-width". They never take a CSS value such as "13px". A fixed list can be checked, shown in the Theming screen and explained. A free value can break the layout on a screen size we did not test.

Do this instead: use the layout options. For space inside a part, set padding or gap on the part.

Density or a font for one part

general.density and general.fontFamily apply to the whole embed. There is no density or font family per part.

Do this instead: set one density and one font in the theme. To make one part stand out, set font-size, font-weight or padding on that part.

Font upload to Databrain

We do not store font files. You host the file, so you keep control of the file and its licence.

Do this instead: put the .woff2 file on your own https host and list it in general.fonts. Allow that host in your page’s font-src.

Your own text keys

custom-messages takes a fixed list of keys, such as filter.apply. A key that is not on the list is left out, with one console warning. The keys are fixed like part names, so your words never stop matching after a release.

Do this instead: use the text keys. For other copy, use translationDictionary.

Hide as a permission

hide takes a control off the screen. It does not change what the viewer can get from the server.

Do this instead: limit what a viewer can see and do in the guest token. Use hide only to make the screen simpler.

A theme per tenant in the guest token

The guest token does not carry a theme.

Do this instead: save one theme per brand and choose it on your page with theme-name, or pass admin-theme-options for the tenant who is signed in.

The full theme in email reports and PDFs

Scheduled email reports and the PDF download draw their own charts on the server, made for print. They take four things from your theme:

  • the brand color, dashboard.ctaColor,
  • the logo,
  • the chart palette,
  • the date format, general.datePickerFormat.

Nothing else from the theme or your page applies there: no parts or states, no chart.gradient (reports use flat fills, because a gradient prints as a muddy band), no general.fonts (reports print in their own font), no general.density, layout options, legend position, hide or custom-messages.

Do this instead: set the brand color, logo and palette in the theme. The embed and your reports then share them.