Skip to content

Config Provider

YhConfigProvider provides scoped or global configuration for theme color, locale, component size, z-index, and message behavior.

Theme Switching

Use the theme prop to switch the active primary color. Preset names and hex values are both supported.

Theme Switching

Global Component Size

Use the size prop to make nested YH-UI components follow the same size.

Global Size

Full Configuration Example

This example combines theme, locale, and size in one local provider scope.

MessageActive
Full Configuration

Use in Nuxt

YhConfigProvider works in Nuxt SSR. Wrap the part of the page that needs scoped configuration, and the provider will apply theme styles through inline CSS variables while locale and size are passed through context.

Use in Nuxt

API

Props

NameDescriptionTypeDefault
themeGlobal or scoped theme preset / primary colorstring | PresetTheme'default'
localeLocale object passed to nested componentsLanguagezhCn
sizeShared component size'small' | 'default' | 'large''default'
z-indexBase z-index value exposed through provider contextnumber2000
messageGlobal message behavior overridesConfigProviderContext['message']{}
globalWhether theme styles are applied globally instead of the local provider scopebooleantrue

Events

This component does not expose component events.

Slots

NameDescriptionParameters
defaultContent rendered inside the provider scope-

Expose

This component does not expose public instance methods or properties.

Theme Variables

This component does not provide component-level themeOverrides. Theme, locale, size, z-index, and message behavior are passed to child components through provider context, and theme CSS variables are generated by the theme manager for the provider scope or :root.

Type Exports

NameDescription
YhConfigProviderPropsProps type for YhConfigProvider
YhConfigProviderSlotsSlots type for YhConfigProvider
YhConfigProviderInstancePublic instance type for YhConfigProvider
ConfigProviderContextProvider context type

Released under the MIT License.