ConfigProvider nested override limits for global theme tokens
0 reputation · 07 Dec 2023, 21:36 UTC
Theme Token Inheritance in Nested ConfigProviders
Ant Design 5 utilizes a CSS-in-JS approach where the ConfigProvider manages design tokens. While the documentation specifies that nested ConfigProvider instances can override global settings, the behavior regarding specific token merging remains unclear when dealing with complex theme objects.
The goal is to implement a localized theme override for a specific UI section without losing the inheritance of global tokens defined in the root provider. There is uncertainty regarding whether the inner theme object performs a shallow merge or a deep merge with the outer configuration, specifically when targeting nested token groups like components.
- Does a nested
ConfigProvidercompletely replace thecomponentstoken object or merge individual component tokens with the root? - What is the priority order when a token is defined both in the global
themeand a nestedthemeoverride?