ThemeProvider

Utilities & Providers
stable

Overrides the active theme and/or color mode for a sub-tree by setting data-theme and data-mode attributes on a display:contents wrapper.

Structure

Anatomie

Décomposition visuelle de la structure interne du composant avec les appels de classes BEM.

Anatomy of OrigamThemeProviderSchematic of the ThemeProvider — a display:contents wrapper that rewrites data-theme / data-mode. data-theme="ocean" data-mode="dark" display: contents — no layout impact child component A child component B 1 origam-theme-provider
Anatomy of <origam-theme-provider> — a single display:contents wrapper ① that rewrites data-theme and data-mode on its root element. Child components resolve their CSS custom properties against this new scope automatically.
1.origam-theme-provider
Root wrapper element (div by default). display:contents ensures it has no layout impact. data-theme and data-mode are set from the theme and mode props, enabling CSS variable scope resolution for all descendant components.

API

Props

Toutes les props acceptées par ce composant, avec leur type, valeur par défaut et description.

theme
'auto'
Brand/theme name to activate on this sub-tree. Rendered as data-theme="{name}". Pass 'auto' to defer to the closest ancestor (no attribute rendered).
mode
'auto'
Color mode: 'light', 'dark', or 'auto' (inherit from ancestor). Rendered as data-mode="{mode}" so CSS can scope token overrides to this sub-tree.
tag
string
'div'
HTML tag for the wrapper element. Defaults to div (display:contents). Use 'section' / 'article' when the wrapper carries semantic meaning.

API

Slots

Emplacements de contenu exposés par ce composant.

#default
Sub-tree whose CSS custom properties are resolved against the provided theme and/or mode.

Inclusion

Accessibilité

Rôles ARIA, navigation clavier et gestion du focus. Sourcé depuis le template réel du composant.

Rôles ARIA

(none — display:contents wrapper)

Notes

  • The root wrapper uses display:contents — it is invisible to the layout engine and does not create an extra stacking context or box. It should not affect the accessibility tree of its children.
  • When the sub-tree is a semantic region, use tag='section' or tag='article' to add semantic meaning to the wrapper instead of the invisible div default.

Interactif

Playground

Modifiez les props en direct et observez le composant se mettre à jour. Le snippet de code généré suit vos changements.

Rendu de l’aperçu en cours…

Usage

Exemples

Extraits de code prêts à coller dans vos templates.

Dark island inside a light page

vue

Brand sub-tree

vue

Semantic tag override

vue