@xsolla/xui-core
v0.106.0
Published
Design system foundation providing theming, context, design tokens, and shared utilities for the XUI toolkit.
Downloads
34,496
Readme
@xsolla/xui-core
Design system foundation providing theming, context, design tokens, and shared utilities for the XUI toolkit.
Installation
yarn add @xsolla/xui-coreUsage
import { XUIProvider, useDesignSystem } from '@xsolla/xui-core';
function App() {
return (
<XUIProvider initialMode="dark">
<MyApp />
</XUIProvider>
);
}
function MyComponent() {
const { theme, mode, setMode } = useDesignSystem();
return <div style={{ color: theme.colors.content.primary }}>Hello</div>;
}Available Theme Modes
| Mode | Theme |
|------|-------|
| "light" | Pentagram Light (default) |
| "dark" | Pentagram Dark (default) |
| "xsollaLight" | Xsolla Light |
| "xsollaDark" | Xsolla Dark |
| "ltg-dark" | LTG Dark |
Aliases: "pentagram-light", "pentagram-dark", "xsolla-light", "xsolla-dark"
Exports
XUIProvider— Root context provider; acceptsinitialMode(see theme modes above)useDesignSystem— Hook returning{ theme, mode, setMode }; falls back to dark theme if no providerthemeConfig— Function returning the full theme object for a givenThemeModeuseId— Stable unique ID hook; polyfillsReact.useIdfor React < 18ModalIdContext— Context holding the current modal's ID for portal-based componentsuseModalId— Hook returning the current modal ID, ornullif outside a modalThemeMode— Type:"dark"|"light"|"xsollaLight"|"xsollaDark"|"ltg-dark"| aliasesThemeColors— Type of the colour token objectcolors— Raw colour tokens for all themesspacing— Spacing scale (xs,s,m,l,xl)radius— Border-radius tokens (button, card, input, tag, avatar variants)shadow— Shadow tokensfonts— Font-family definitionsisWeb/isNative/isIOS/isAndroid— Platform detection booleans
