Docs
Semantic & Foundation

Semantic & Foundation Tokens

ApollionProvider exposes two public token layers — each with a clear role and a different audience.

LayerWho uses itQuestion it answers
Foundation (theme.foundation.*)Product (you)"What's the ergonomic alias?" (primary, surface, text…)
Semantic (theme.semantic.*)DS components"What's the visual intent?" (primary, danger, success…)

Foundation is what product consumes day to day. Semantic is the internal layer @apollion-dsi/core components use to dress themselves. You rarely touch Semantic, except when composing a new component in the DS's own pattern.

Foundation — recommended for product

import { Flex } from '@apollion-dsi/core/containers/flex';
import { Text } from '@apollion-dsi/core/elements/text';
 
<Flex bgColor="primary" p="large">
  <Text color="primary" fontWeight="bold">
    Content
  </Text>
</Flex>;

Foundation aliases are resolved against the current theme — switching ApollionProvider from light to dark (or from one brand to another) re-resolves without rewriting the component.

Live demo

The same Foundation alias (primary) renders differently depending on the current theme. There's no if (isDark) in consumer code — the component stays a single one.

bgColor="primary" + color="primary"

Content

bgColor="danger" + color="danger"

Warning

bgColor="success" + color="success"

Ok

Semantic — used by DS components

@apollion-dsi/core components consume theme.semantic.<intent> internally. You rarely touch this layer — unless you're composing a new component in the DS's own pattern.

const StyledButton = styled.button`
  background: ${({ theme, $intent }) => theme.semantic[$intent].background};
  color: ${({ theme, $intent }) => theme.semantic[$intent].text};
`;

Best practices

  1. Default: Foundation. Anyone designing product screens stays in this layer.
  2. New component in the DS pattern: Semantic, mirroring the pattern of core's own components.
  3. One-off override: prefer creating a new Foundation alias before pointing at a literal palette value.

See also