Skip to Content

Reference

Parts and states

Every named region of the embed: what CSS it takes, its states, and the selector to style and test it.

Parts are named regions of the embed. Style them from your page with ::part() and select them in tests with [part~="name"]. Each part lists the CSS it accepts; height, width, display, position, transform, z-index and margin are on no list, so the embed keeps its layout.

Named parts, including the builder and layout controls, require the plugin release that ships with this docs update ({{PLUGIN_VERSION}} or later). The same version adds data-dbn-filter-key.

Style a part

Put the rules in a stylesheet on your page:

<style>
  dbn-dashboard::part(card) {
    box-shadow: 0 1px 2px rgb(0 0 0 / 0.08);
  }
  dbn-dashboard::part(card-title) {
    letter-spacing: 0.01em;
  }
  dbn-dashboard::part(date-filter) {
    border-radius: 8px;
  }
  :is(dbn-dashboard, dbn-metric, #dbn-portal, [data-dbn-embed-portal])::part(button-primary):hover {
    opacity: 0.9;
  }
  :is(dbn-dashboard, dbn-metric, #dbn-portal, [data-dbn-embed-portal])::part(date-filter-menu) {
    border-radius: 12px;
  }
</style>
  • In-card parts: start the rule with dbn-dashboard::part(name) or dbn-metric::part(name).
  • Popover parts open outside the card. In the legacy design, menus, the date picker and dialogs open in #dbn-portal, an element at the end of <body>; the metric builder opens in [data-dbn-embed-portal]. dbn-dashboard::part(name) does not reach them. Start the rule with the host set :is(dbn-dashboard, dbn-metric, #dbn-portal, [data-dbn-embed-portal]), which reaches every layer.
  • Parts that can open in a popover too use the same host set: buttons (Apply in the date picker), and the chart, table and states in the full screen view.
  • The Style with column of the table below gives the right selector for each part. Copy it as it is.
  • A bare ::part(name) also works, but it also matches any other web component on your page that uses the same part name.
  • Two embeds on one page share #dbn-portal. A popover rule styles the popovers of both.
  • An element can have more than one name, for example part="menu card-menu". ::part(menu) styles every menu. ::part(card-menu) styles only the card menu.
  • ::part() takes states such as :hover and :focus-visible. It does not reach inside a part: ::part(card) span matches nothing.
  • A value the theme sets wins over a part rule. For example, when the theme sets the card corner radius (cardCustomization.borderRadius) or the card title weight (cardTitle.fontWeight), a part rule does not change it. Change it in the theme. The Allowed CSS column marks these properties.
  • Text from your page flows into the embed. Your page rules for box styling (background, border, padding, shadow) never reach inside the embed. Inherited text properties do: in the legacy design, color, font-family, font-size, line-height, letter-spacing, text-transform and cursor pass from body or html into the embed wherever the embed does not set them itself. In the v2 design (ui-version="v2"), the embed resets font-family, line-height, letter-spacing, word-spacing, text-transform, text-indent, font-style, font-variant and text-shadow. Other inherited properties, such as color, font-size and cursor, still pass in. This is on purpose: the embed picks up your page font and text style unless you say otherwise. A value from the theme or from a part wins over the inherited one. To control them, set them in the theme or on a part, not on your page.
  • Use only the allowed CSS of a part. Other properties can stop working in any release.

Parts

Parts list version 1.0.0, 58 parts. The popover host set is :is(dbn-dashboard, dbn-metric, #dbn-portal, [data-dbn-embed-portal]).

PartWhat the viewer seesStyle withAllowed CSSDesign
dashboardThe whole dashboard, behind every card.dbn-dashboard::part(dashboard), dbn-metric::part(dashboard)Surface set. When the theme sets background or background-color, the theme winsLegacy and v2
dashboard-headerThe row with the dashboard name and actions.dbn-dashboard::part(dashboard-header), dbn-metric::part(dashboard-header)Surface setLegacy and v2
dashboard-titleThe dashboard name.dbn-dashboard::part(dashboard-title), dbn-metric::part(dashboard-title)Text setLegacy and v2
filter-barThe row of dashboard filters above the cards.dbn-dashboard::part(filter-bar), dbn-metric::part(filter-bar)Surface setLegacy and v2
filterAny one filter in the filter bar.:is(dbn-dashboard, dbn-metric, #dbn-portal, [data-dbn-embed-portal])::part(filter)Control setLegacy and v2
filter-labelThe name of a filter, above it or inside it.:is(dbn-dashboard, dbn-metric, #dbn-portal, [data-dbn-embed-portal])::part(filter-label)Text set. When the theme sets color or font-family, the theme winsLegacy and v2
filter-selectA filter that picks one value from a list.:is(dbn-dashboard, dbn-metric, #dbn-portal, [data-dbn-embed-portal])::part(filter-select)Control setLegacy and v2
filter-multi-selectA filter that picks many values from a list.:is(dbn-dashboard, dbn-metric, #dbn-portal, [data-dbn-embed-portal])::part(filter-multi-select)Control setLegacy and v2
filter-number-rangeA filter that takes a number range.:is(dbn-dashboard, dbn-metric, #dbn-portal, [data-dbn-embed-portal])::part(filter-number-range)Control setLegacy and v2
filter-searchA filter where the viewer types a value.:is(dbn-dashboard, dbn-metric, #dbn-portal, [data-dbn-embed-portal])::part(filter-search)Control setLegacy and v2
filter-menuThe list of values that opens from a filter.:is(dbn-dashboard, dbn-metric, #dbn-portal, [data-dbn-embed-portal])::part(filter-menu)Popover setLegacy and v2
date-filterThe date filter button that shows the chosen range, in the filter bar or on a card.dbn-dashboard::part(date-filter), dbn-metric::part(date-filter)Control set. When the theme sets color or background or background-color or font-family, the theme winsLegacy and v2
date-filter-menuThe date picker that opens from the date filter: presets and calendar.:is(dbn-dashboard, dbn-metric, #dbn-portal, [data-dbn-embed-portal])::part(date-filter-menu)Popover setLegacy and v2
date-filter-presetOne preset in the date picker, for example “Last 7 days” or “Custom”.:is(dbn-dashboard, dbn-metric, #dbn-portal, [data-dbn-embed-portal])::part(date-filter-preset)color, background, background-color, border-radius, padding, gap, font-family, font-size, font-weight, line-height, opacity, cursorLegacy and v2
date-filter-dayOne day in the date picker calendar.:is(dbn-dashboard, dbn-metric, #dbn-portal, [data-dbn-embed-portal])::part(date-filter-day)color, background, background-color, border, border-color, border-radius, font-weight, opacity, cursorLegacy and v2
date-filter-valueThe words that say the chosen range, shown when the theme turns the date range label on.dbn-dashboard::part(date-filter-value), dbn-metric::part(date-filter-value)color, font-family, font-size, font-weight, font-style, line-height, letter-spacing, text-transformLegacy and v2
button-primaryThe main action button, for example Apply.:is(dbn-dashboard, dbn-metric, #dbn-portal, [data-dbn-embed-portal])::part(button-primary)Control set. When the theme sets background or background-color, the theme winsLegacy and v2
button-secondaryA second action button, for example Clear or Cancel.:is(dbn-dashboard, dbn-metric, #dbn-portal, [data-dbn-embed-portal])::part(button-secondary)Control set. When the theme sets background or background-color, the theme winsLegacy and v2
cardOne chart, table or number card.dbn-dashboard::part(card), dbn-metric::part(card)Surface set. When the theme sets border-radius or box-shadow, the theme winsLegacy and v2
card-headerThe top row of a card: title, description and actions.dbn-dashboard::part(card-header), dbn-metric::part(card-header)Surface setLegacy and v2
card-titleThe card name.dbn-dashboard::part(card-title), dbn-metric::part(card-title)Text set. When the theme sets color or font-size or font-weight, the theme winsLegacy and v2
card-descriptionThe short text under the card name.dbn-dashboard::part(card-description), dbn-metric::part(card-description)Text set. When the theme sets color or font-size or font-weight, the theme winsLegacy and v2
card-actionsThe buttons at the top right of a card.dbn-dashboard::part(card-actions), dbn-metric::part(card-actions)Control setLegacy and v2
card-menuThe menu that opens from the card actions: download, full screen and more.:is(dbn-dashboard, dbn-metric, #dbn-portal, [data-dbn-embed-portal])::part(card-menu)Popover setLegacy and v2
chartThe area that draws the chart.:is(dbn-dashboard, dbn-metric, #dbn-portal, [data-dbn-embed-portal])::part(chart)background, background-color, border-radius, padding, opacityLegacy and v2
chart-legendThe chart legend where it is drawn as text (gauge charts). Other legends are drawn inside the chart and take color and font from the theme.:is(dbn-dashboard, dbn-metric, #dbn-portal, [data-dbn-embed-portal])::part(chart-legend)color, font-family, font-size, font-weight, font-style, line-height, letter-spacing, text-transform, text-decoration, gap, paddingLegacy only
chart-tooltipThe box that opens when the viewer points at a data point. Its text takes color and font from the theme tooltip fields. The v2 chart engine draws its tooltip inside the chart, so there all of it comes from the theme.:is(dbn-dashboard, dbn-metric, #dbn-portal, [data-dbn-embed-portal])::part(chart-tooltip)background, background-color, border, border-color, border-style, border-width, border-radius, box-shadow, opacity, paddingLegacy only
single-valueThe big number on a number card.:is(dbn-dashboard, dbn-metric, #dbn-portal, [data-dbn-embed-portal])::part(single-value)Text setLegacy and v2
tableA table of rows inside a card.:is(dbn-dashboard, dbn-metric, #dbn-portal, [data-dbn-embed-portal])::part(table)Surface setLegacy and v2
table-headerOne header cell of a table.:is(dbn-dashboard, dbn-metric, #dbn-portal, [data-dbn-embed-portal])::part(table-header)Table row set. When the theme sets font-weight, the theme winsLegacy and v2
table-cellOne cell in a table row.:is(dbn-dashboard, dbn-metric, #dbn-portal, [data-dbn-embed-portal])::part(table-cell)Table row setLegacy and v2
empty-stateWhat a card shows when there is no data.:is(dbn-dashboard, dbn-metric, #dbn-portal, [data-dbn-embed-portal])::part(empty-state)Surface and text setLegacy and v2
error-stateWhat a card shows when its data cannot load.:is(dbn-dashboard, dbn-metric, #dbn-portal, [data-dbn-embed-portal])::part(error-state)Surface and text setLegacy and v2
loading-stateWhat a card shows while its data loads.:is(dbn-dashboard, dbn-metric, #dbn-portal, [data-dbn-embed-portal])::part(loading-state)background, background-color, border-radius, opacity, colorLegacy and v2
menuAny drop-down menu.:is(dbn-dashboard, dbn-metric, #dbn-portal, [data-dbn-embed-portal])::part(menu)Popover setLegacy and v2
menu-itemOne row in any drop-down list: a filter value, a card menu entry.:is(dbn-dashboard, dbn-metric, #dbn-portal, [data-dbn-embed-portal])::part(menu-item)color, background, background-color, border-radius, padding, gap, font-family, font-size, font-weight, line-height, opacity, cursorLegacy and v2
tooltipA short help text that opens on hover, not on a chart.:is(dbn-dashboard, dbn-metric, #dbn-portal, [data-dbn-embed-portal])::part(tooltip)Popover set. When the theme sets padding, the theme winsLegacy and v2
dialogA window that opens over the embed, for example full screen or download.:is(dbn-dashboard, dbn-metric, #dbn-portal, [data-dbn-embed-portal])::part(dialog)Popover setLegacy and v2
metric-builderThe whole screen where a viewer builds or edits a metric.:is(dbn-dashboard, dbn-metric, #dbn-portal, [data-dbn-embed-portal])::part(metric-builder)Surface setLegacy and v2
builder-chart-areaThe chart preview in the metric builder.:is(dbn-dashboard, dbn-metric, #dbn-portal, [data-dbn-embed-portal])::part(builder-chart-area)Surface setLegacy and v2
builder-backThe back button that closes the metric builder.:is(dbn-dashboard, dbn-metric, #dbn-portal, [data-dbn-embed-portal])::part(builder-back)Control setLegacy and v2
builder-titleThe metric name at the top of the metric builder.:is(dbn-dashboard, dbn-metric, #dbn-portal, [data-dbn-embed-portal])::part(builder-title)Text setLegacy and v2
builder-fieldOne column in the data panel of the metric builder, ready to drag.:is(dbn-dashboard, dbn-metric, #dbn-portal, [data-dbn-embed-portal])::part(builder-field)color, background, background-color, border-radius, padding, gap, font-family, font-size, font-weight, line-height, opacity, cursorLegacy and v2
builder-dimensionsThe area in the metric builder where dimensions are dropped.:is(dbn-dashboard, dbn-metric, #dbn-portal, [data-dbn-embed-portal])::part(builder-dimensions)Surface setLegacy and v2
builder-measuresThe area in the metric builder where measures are dropped.:is(dbn-dashboard, dbn-metric, #dbn-portal, [data-dbn-embed-portal])::part(builder-measures)Surface setLegacy and v2
builder-filtersThe Filters button in the metric builder.:is(dbn-dashboard, dbn-metric, #dbn-portal, [data-dbn-embed-portal])::part(builder-filters)Control setLegacy and v2
builder-sortThe Sort button in the metric builder.:is(dbn-dashboard, dbn-metric, #dbn-portal, [data-dbn-embed-portal])::part(builder-sort)Control setLegacy and v2
builder-chart-typeThe button that opens the chart type picker in the metric builder.:is(dbn-dashboard, dbn-metric, #dbn-portal, [data-dbn-embed-portal])::part(builder-chart-type)Control setLegacy and v2
builder-appearanceThe button that opens the chart appearance settings in the metric builder.:is(dbn-dashboard, dbn-metric, #dbn-portal, [data-dbn-embed-portal])::part(builder-appearance)Control setLegacy and v2
builder-saveThe Save to dashboard button at the top of the metric builder.:is(dbn-dashboard, dbn-metric, #dbn-portal, [data-dbn-embed-portal])::part(builder-save)Control setLegacy and v2
metric-name-inputThe metric name field in the window that saves or updates a metric.:is(dbn-dashboard, dbn-metric, #dbn-portal, [data-dbn-embed-portal])::part(metric-name-input)Control setLegacy and v2
metric-save-confirmThe button that saves a new metric or updates an edited one.:is(dbn-dashboard, dbn-metric, #dbn-portal, [data-dbn-embed-portal])::part(metric-save-confirm)Control setLegacy and v2
create-metricThe Create metric button on the dashboard.dbn-dashboard::part(create-metric), dbn-metric::part(create-metric)Control setLegacy and v2
card-editThe action on a card that opens the metric in the builder.:is(dbn-dashboard, dbn-metric, #dbn-portal, [data-dbn-embed-portal])::part(card-edit)Control setLegacy and v2
layout-customizeThe Customize layout action that lets the viewer move and resize cards.:is(dbn-dashboard, dbn-metric, #dbn-portal, [data-dbn-embed-portal])::part(layout-customize)Control setLegacy and v2
layout-saveThe Save layout button shown while the viewer customizes the layout.dbn-dashboard::part(layout-save), dbn-metric::part(layout-save)Control setLegacy and v2
layout-discardThe Discard button that leaves the layout as it was.dbn-dashboard::part(layout-discard), dbn-metric::part(layout-discard)Control setLegacy and v2
layout-resize-handleThe corner handle that resizes a card while the viewer customizes the layout. The card itself is what the viewer drags to move it.dbn-dashboard::part(layout-resize-handle), dbn-metric::part(layout-resize-handle)background, background-color, background-image, border, border-color, border-radius, opacity, cursorLegacy and v2

Allowed CSS sets (the Allowed CSS column names one of these):

SetProperties
Surfacecolor, background, background-color, background-image, border, border-color, border-style, border-width, border-radius, box-shadow, opacity, padding, gap
Textcolor, font-family, font-size, font-weight, font-style, line-height, letter-spacing, text-transform, text-decoration
Controlcolor, background, background-color, background-image, border, border-color, border-style, border-width, border-radius, box-shadow, opacity, padding, gap, font-family, font-size, font-weight, letter-spacing, text-transform, outline, outline-color, outline-offset, cursor
Popovercolor, background, background-color, background-image, border, border-color, border-style, border-width, border-radius, box-shadow, opacity, padding, gap, font-family, font-size, font-weight, line-height
Table rowcolor, background-color, border-top, border-bottom, border-color, padding, font-family, font-size, font-weight, font-style, line-height, letter-spacing, text-transform, text-decoration, text-align
Surface and textcolor, background, background-color, background-image, border, border-color, border-style, border-width, border-radius, box-shadow, opacity, padding, gap, font-family, font-size, font-weight, font-style, line-height, letter-spacing, text-transform, text-decoration

What the embed keeps

Where the Allowed CSS column says the theme wins, change the value in the theme. Date presets also carry a button part when selected. Their fill can still be set with ::part(date-filter-preset--selected).

To select one dashboard filter in a test, match data-dbn-filter-key on its filter part. See Pick one dashboard filter for an example.

States

A part can say what state it is in: open, selected, disabled, invalid or active. Style and select the state with its token, for example date-filter-day--selected:

<style>
  :is(dbn-dashboard, dbn-metric, #dbn-portal, [data-dbn-embed-portal])::part(date-filter-day--selected) {
    background: #4f46e5;
    color: #ffffff;
  }
  :is(dbn-dashboard, dbn-metric, #dbn-portal, [data-dbn-embed-portal])::part(menu-item):hover {
    background: #f5f5f5;
  }
  dbn-dashboard::part(date-filter--open) {
    border-color: #4f46e5;
  }
</style>
The date picker with the example CSS: rounded picker corners, the selected days filled indigo with white numbers, and the open date filter with an indigo border.

5 states. A state is one more token in the part’s part attribute, written <part>--<state>.

StateWhat it meansRead by screen readers as
selectedA chosen value: a chosen option, a chosen preset, a day inside the chosen range.aria-selected="true"
openThe menu or picker this control opens is open now.aria-expanded="true"
disabledIt cannot be used now, for example a filter with no values, or Apply with nothing changed.aria-disabled="true"
invalidThe value fails a check: a minimum above the maximum, an end date before the start date.aria-invalid="true"
activeThe row the keyboard or pointer is on in an open list. It does not mean “has a value”.Keyboard focus is on the row (or the list points aria-activedescendant at it)
PartStatesTokens to style and select
filteropen, disabled, invalidfilter--open, filter--disabled, filter--invalid
filter-selectopen, disabledfilter-select--open, filter-select--disabled
filter-multi-selectopen, disabledfilter-multi-select--open, filter-multi-select--disabled
filter-number-rangeopen, disabled, invalidfilter-number-range--open, filter-number-range--disabled, filter-number-range--invalid
filter-searchdisabledfilter-search--disabled
date-filteropen, disabled, invaliddate-filter--open, date-filter--disabled, date-filter--invalid
date-filter-presetselected, disabled, activedate-filter-preset--selected, date-filter-preset--disabled, date-filter-preset--active
date-filter-dayselected, disabled, activedate-filter-day--selected, date-filter-day--disabled, date-filter-day--active
button-primarydisabledbutton-primary--disabled
button-secondarydisabledbutton-secondary--disabled
card-actionsopencard-actions--open
menu-itemselected, disabled, activemenu-item--selected, menu-item--disabled, menu-item--active

Every other part takes no state.

  • The token is there only while the state is true.
  • A state token takes the allowed CSS of its part. It adds no properties.
  • Hover and keyboard focus are not states. Use ::part(menu-item):hover and ::part(menu-item):focus-visible.
  • filter takes the states of every filter type, so ::part(filter--open) styles any open filter.
  • Menus, the date picker and dialogs exist only while open, so they take no open token.
  • The two ends of a chosen date range take the same selected token as the days between them.

Next, select the same parts in your tests.