Use the v-dt-mode directive to control the color mode of a region, component, or element. It creates a scoped region with the specified mode. Descendant elements retain their original styling but are rendered with the specified mode.
<dt-textv-dt-mode:darktone="positive"> Dark content </dt-text><dt-textv-dt-mode:lighttone="positive"> Light content </dt-text><dt-textv-dt-mode:inverttone="positive"> Inverted — opposite of parent or root </dt-text>
CSS tokens activate via [data-dt-mode="light"] and [data-dt-mode="dark"] attribute selectors
High-contrast tokens layer via [data-dt-mode][data-dt-contrast="high"]
Contrast is inherited from the root <html> element and kept in sync via MutationObserver
Material is inherited from the root <html> element the same way — data-dt-material propagates onto the island/directive element so --dt-color-black-* re-binds correctly inside inverted regions
For invert mode, the directive reads the nearest ancestor's data-dt-mode, computes the opposite, and reacts when it changes
data-dt-brand (theme) and data-dt-material cannot be overridden on mode islands — brand and material are root-level by design (material is paired to brand for visual coherence; see brand-locked materials)
Mode boundaries can be nested. Each v-dt-mode:invert reads the nearest parent boundary and flips. In this example the first level is explicitly set to light mode, the second level inverts against that, and the third level inverts again.
Popovers, Dropdowns, Modals, and Hovercards render their content outside the normal DOM tree, so v-dt-mode on the component itself won't reach the positioned element. These components provide a contentMode prop that applies the mode directly to the positioned content.
<!-- Hovercard --><dt-hovercardplacement="top-start"content-mode="invert"><template#anchor><dt-button:size="200"kind="muted"importance="outlined">Default</dt-button></template><template#content><ExampleProfileCard/></template></dt-hovercard><!-- Popover --><dt-popovercontent-mode="invert"placement="top-start"dialogClass="d-w-350"><template#anchor><dt-button:size="200"kind="muted"importance="outlined"> Inverted </dt-button></template><template#content="{ close }"><dt-textas="p">This Popover content is in the <dt-textstrength="strong">inverted</dt-text> mode.</dt-text></template></dt-popover><!-- Dropdown --><dt-dropdowncontent-mode="invert"navigation-type="arrow-keys"placement="bottom-start"><template#anchor="{ attrs }"><dt-buttonv-bind="attrs":size="200"kind="muted"importance="outlined">
Inverted
<template#endIcon="{ iconSize }"><dt-iconname="chevron-down":size="iconSize"/></template></dt-button></template><template#list="{ close }"><dt-list-itemv-for="item in items":key="item.id"role="menuitem":navigation-type="arrow - keys"@click="close">
{{ item.name }}
</dt-list-item></template></dt-dropdown>
The <dt-mode-island> component is the underlying abstraction that the directive builds on. The key rendered difference is that it creates a wrapper element, while the directive attaches to mode to the existing element.
<dt-mode-islandas="section">
Rendered as a section element inverted
</dt-mode-island><dt-mode-island>
Inverted (default)
</dt-mode-island><dt-mode-islandmode="light">
Light
</dt-mode-island><dt-mode-islandmode="dark">
Dark
</dt-mode-island>