React
Install the packages, import the styles once, and render a first component.
Install
The packages are published to GitHub Packages. Add an .npmrc with a GitHub token that has read:packages:
@kela-systems:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}Then install:
pnpm add @kela-systems/ui-components @kela-systems/iconsStyles
Import the styles once, in the app's entry stylesheet, after Tailwind. Then point Tailwind at the components, so it generates the classes they use:
@import "tailwindcss";
@import "@kela-systems/ui-components/styles.css";
@source "../node_modules/@kela-systems/ui-components/dist";The @source path is relative to the stylesheet. Without it, components render unstyled. styles.css brings the tokens, the utilities, the Aeonik fonts and the animations the components use.
Themes
The theme is a class on <html>:
| Theme | Class |
|---|---|
| Light | none |
| Dark | dark |
| Dark contrast | dark dark-contrast |
Right to left
Set dir and lang on <html> together; the right-to-left styles read both. Then wrap the app in DirectionProvider with the same direction, so menus, popups, sliders and arrow keys follow it:
import { DirectionProvider } from "@kela-systems/ui-components";
<DirectionProvider direction="rtl">
<App />
</DirectionProvider>;Use the components
Import everything from the package root:
import { Button, Stack, Text } from "@kela-systems/ui-components";
<Stack gap={2}>
<Text variant="body-sm-regular">{t("clipReady")}</Text>
<Button variant="outline">{t("export")}</Button>
</Stack>;- Pick a look with a variant, such as
variantorsize. AclassNameon a component adds layout only: placement, sizing, spacing. - Lay out with
StackandGrid, and style text withText, instead of adivorspanwith classes. - Compose with
render. A part that renders another element takes it through Base UI'srenderprop:<DialogTrigger render={<Button variant="outline" />}>. - Pass every string translated. Every label a component renders or announces is a prop with an English default, such as
closeLabelon a dialog. The library has no translations of its own.
Each component page says what the component is for, shows it live, and lists its parts, props and variants.
Icons
import { IconAirplane } from "@kela-systems/icons/outline";
<IconAirplane size={16} />;Icons are hidden from screen readers by default. The Icons page lists every glyph and how to label one.
Lint
The package ships oxlint rules that catch unknown classes, restyled components, raw colours and physical directions. Extend both configs in the app's .oxlintrc.json:
"extends": [
"./node_modules/@kela-systems/ui-components/lint/oxlintrc.json",
"./node_modules/@kela-systems/ui-components/lint/app.oxlintrc.json"
]The app also needs a components.json naming its entry stylesheet. lint/README.md in the package has the details.