Skip to content

ConfigProvider

The injection entry point for global configuration, centrally managing locale / size / theme for the wrapped subtree. Component resolution order: own attribute > config-provider > global default.

Locale injection

The config-provider's locale takes precedence over the global setLocale(): components inside use the injected locale for built-in copy.

Switching locale

中文English可关闭标签这是一条警告提示

Size injection

Components inside use the injected size unless they set it explicitly; explicitly set size always wins. size supports five tiers: xs / small / medium (default) / large / xl.

Size injection

XSSmallMediumLargeXLInjected buttonSmall by itselfInjected tag

Theme injection

The config-provider's theme writes data-theme onto itself, and the wrapped subtree (including Shadow DOM) inherits the corresponding theme tokens.

Theme injection

LightDarkTheme buttonFollows theme

Nearest provider wins

An inner config-provider overrides an outer one: components wrapped by the inner provider use its config, while components under the outer provider (not nested further) use the outer config.

Nearest provider wins

Outer enInner zh-CN

API

Attributes

AttributeDescriptionTypeDefault
localeLanguage for built-in copy in the wrapped subtree (must be registered); takes precedence over global setLocale()
sizeDefault size for wrapped components, applied when a component doesn't set it explicitly
themeTheme for the wrapped subtree, written to data-theme

Slots

NameDescription
default
  • Component resolution order: own attribute > config-provider > global default.
  • locale requires the language pack to be registered via registerLocale(); falls back to the global translator when unregistered.