Theme Scope
Applies a Syntara theme, colour scheme and density to everything inside it.
Preview
Installation
pnpm add @syntara/react @syntara/tokensimport { ThemeScope } from '@syntara/react';Usage
import { ThemeScope } from '@syntara/react';
export function App() {
return (
<ThemeScope theme="qamar" scheme="dark" locale="ar-AE">
{/* your app */}
</ThemeScope>
);
}Accessibility
No keyboard interaction of its own.
- Pass locale for other-language or right-to-left regions: React Aria reads direction from the locale, not the DOM dir attribute.
- Overlays opened inside the scope copy its theme, scheme, density, dir and lang when they open.
- numerals changes only how digits are written; screen readers read the number the same either way.
Guidelines
Do
- Put the theme, scheme and density attributes on one element — token CSS needs them together.
Don’t
- Don't nest scopes with different schemes inside inline text; scope whole regions.
API reference
ThemeScope
themestringTenant id whose tokens are loaded under [data-syntara-theme]. Omit to inherit the page theme.
schemelightdefaultdarkauto
Colour scheme for the subtree. 'auto' follows the visitor's system setting.
densitycomfortablecompact
Overrides the tenant's default density.
localestringBCP 47 locale, e.g. "ar-AE". Sets React Aria's locale (arrow-key direction, date formats, placement) and, unless given, lang and dir. Right-to-left regions need it.
numeralsnativelatin
Digits for dates and numbers in the scope. 'native' uses the language's own (Arabic ١٢٣, Hindi १२३); 'latin' forces 1 2 3. Omit to let the locale choose (ar-AE and hi-IN choose 1 2 3). Needs locale.
Tokens
The semantic tokens this component reads, grouped by what they control. Swatches show this site’s theme; change a tenant’s brand and the component follows with no code change.
- Colour2
surface.canvastext.default- Type2
font.bodyfont.size.md