Surface Contrast Scoping

Surface Contrast Scoping

Layout primitives accept a surface prop that creates a local contrast scope — semantic tokens remap independently of the page theme. Switch between the four modes below to see how each behaves on light vs dark pages.

PropLight pageDark pageUse case
darkdark tokensinverts → lightContrast band against page
lightlight tokensinverts → darkContrast band against page
dark-alwaysdark tokensdark tokensDark media bg — text stays light
light-alwayslight tokenslight tokensLight media bg — text stays dark
light pagesurface="dark-always"

Section title

Content inside the surface scope.

dark pagesurface="dark-always"

Section title

Content inside the surface scope.

surface prop — live preview
<Flex direction="column" gap="3" surface="dark-always"
  bgImage="https://images.unsplash.com/photo-1719841602002-1dcc795bed24"
  bgOverlays="dark-50"
  className="rounded-[var(--radius-panel)] p-6">
  <Heading size="sm">Section title</Heading>
  <Text size="xs" color="subtle">Content inside the surface scope.</Text>
  <Flex direction="row" gap="2">
    <Button size="sm" variant="solid" tone="accent">Action</Button>
    <Button size="sm" variant="outline">Cancel</Button>
  </Flex>
</Flex>

The surface prop is on the layout primitives; see Theme System for themes and scoped providers.

Configure Theme
Theme
Accent Color
Custom
Gray Family
Appearance
Radius
Scaling
Panel Style
Heading Font
Body Font