BitsConfig

Utilities
Local guide ↗ import { BitsConfig } from "bits-ui"

Inherited defaults

A nested provider inherits the parent locale while overriding only its portal target

Parent target

#config-parent-target

Child target

#config-child-target

Parent config

locale
fr-FR
portal target
#config-parent-target

Nested config

locale
fr-FR
portal target
#config-child-target

The nested scope inherits fr-FR, but its Portal resolves to the nearer target override.

BitsConfig supplies scoped defaults to Bits UI descendants. A direct component prop has highest priority, followed by the nearest BitsConfig, inherited ancestor configs, and finally the built-in default. This lets one nested scope override defaultPortalTo while retaining an ancestor's defaultLocale.

defaultPortalTo accepts an Element or selector string; without a configured value, portals use document.body. defaultLocale falls back to en. Provider defaults affect only components inside the provider's subtree.