Hook for provider components (e.g. Box, Card) to resolve and provide bg context.
Resolution rules:
bg is undefined -- transparent, no context change, returns { bg: undefined }.
This is the default for Box, Flex, and Grid (they do not auto-increment).
bg is 'neutral' -- when the parent bg is neutral, increments the neutral
level from the parent context, capping at neutral-3. When the parent bg is
an intent ('danger' | 'warning' | 'success'), the intent passes through
unchanged (i.e. bg: 'neutral' does not override the parent intent). The
increment is always relative to the parent; it is not possible to pin a
container to an explicit neutral level.
bg is 'danger' | 'warning' | 'success' -- sets the bg to that intent
explicitly, regardless of the parent value.
Capping:
Provider components cap at neutral-3. The neutral-4 level is not a valid
prop value -- it exists only in consumer component CSS (e.g. a Button on a
neutral-3 surface renders with neutral-4 tokens via data-on-bg).
The caller is responsible for wrapping children with BgProvider when the
resolved bg is defined.
Hook for provider components (e.g. Box, Card) to resolve and provide bg context.
Resolution rules:
bgisundefined-- transparent, no context change, returns{ bg: undefined }. This is the default for Box, Flex, and Grid (they do not auto-increment).bgis'neutral'-- when the parent bg is neutral, increments the neutral level from the parent context, capping atneutral-3. When the parent bg is an intent ('danger'|'warning'|'success'), the intent passes through unchanged (i.e.bg: 'neutral'does not override the parent intent). The increment is always relative to the parent; it is not possible to pin a container to an explicit neutral level.bgis'danger'|'warning'|'success'-- sets the bg to that intent explicitly, regardless of the parent value.Capping:
Provider components cap at
neutral-3. Theneutral-4level is not a valid prop value -- it exists only in consumer component CSS (e.g. a Button on aneutral-3surface renders withneutral-4tokens viadata-on-bg).The caller is responsible for wrapping children with
BgProviderwhen the resolved bg is defined.