Provider
VKBridgeConfigProvider is the preassembled VKUI shell of a mini app: three VKUI providers with defaults computed from the bridge. Wrap the whole app — inside StrictMode, outside your root component.
Composition
Section titled “Composition”<VKBridgeConfigProvider> <App /></VKBridgeConfigProvider>Inside, the provider renders:
<ConfigProvider /* bridge defaults + your overrides */> <AdaptivityProvider /* transformVKBridgeAdaptivity(useBridgeAdaptivity()) */> <AppRoot mode="full" safeAreaInsets={insets}> {children} </AppRoot> </AdaptivityProvider></ConfigProvider>The order is fixed: ConfigProvider → AdaptivityProvider → AppRoot. AppRoot carries mode="full" — the app lives not in a widget but on the host’s full screen.
What is computed
Section titled “What is computed”| ConfigProvider prop | Source |
|---|---|
colorScheme |
VKWebAppUpdateConfig + a VKWebAppGetConfig bootstrap (useBridgeAppearance) |
platform |
"vkcom" when vk_platform === "desktop_web" in the launch params |
isWebView |
bridge.isWebView() |
hasCustomPanelHeaderAfter |
always true, reserving the PanelHeader corner for the host controls |
AdaptivityProvider props |
transformVKBridgeAdaptivity(useBridgeAdaptivity()) |
AppRoot.safeAreaInsets |
VKWebAppUpdateInsets and config insets via useBridgeInsets |
The logic of each source is in the hooks: the provider just assembles them into one tree.
Overrides
Section titled “Overrides”The provider’s props are the whole Partial<ConfigProviderProps> surface plus children. A prop passed explicitly wins over the computed value: the provider spreads the overrides last, after the bridge defaults.
// pin the theme regardless of the host<VKBridgeConfigProvider colorScheme="dark"> <App /></VKBridgeConfigProvider>Typical uses: a forced theme for a settings view, a debug platform, locale. Pass nothing — and the bridge defaults apply.
Boundaries
Section titled “Boundaries”platformis computed fordesktop_webonly; on every other platform it staysundefined, and VKUI derives the platform from its own heuristics.useBridgeAppearancereturnsundefinedoutside the sandbox (see hooks) — in a plain browser VKUI resolves the theme unless you passcolorSchemeexplicitly.- Outside a mini app the
VKWebAppGetConfigbootstrap fails: the error lands in the console but never touches the app.