Get started
One provider at the root, subpath imports, explicit slots. That is the whole setup.
1
Install the package
pnpm add @xaui/native@beta
The native peer dependencies are listed in the installation guide.
2
Create the theme once
// theme.tsimport { createTheme } from '@xaui/native/theme'export const appTheme = createTheme({colors: {light: { accent: '#2563EB', accentForeground: '#FFFFFF' },dark: { accent: '#60A5FA', accentForeground: '#0F172A' },},radius: 16,})
Soft, pressed and contrasting colours are derived in OKLab. Do not rebuild the theme during render — its identity has to stay stable.
fontFamilies names a font; it does not load one. If the theme is to point at anything but the system face, load the file first — Fonts is the whole of that step.
3
Mount the provider
import { XAUIProvider } from '@xaui/native/theme'import { appTheme } from './theme'export default function App() {return (<XAUIProvider theme={appTheme}><YourApp /></XAUIProvider>)}
colorMode takes light, dark or system. The portal host mounts with it.
4
Compose a component
import { Button } from '@xaui/native/button'export function SaveButton() {return (<Button variant="primary" onPress={save}><Button.Icon as={SaveIcon} /><Button.Label>Save</Button.Label></Button>)}
- Slots use dot notation and render in JSX order.
variantpicks a semantic appearance;colortakes a raw hue.- Style props keep the full React Native names and values —
padding={16},width="100%". stylestill wins, for transforms, shadows and computed values.