# 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`:

```ini
@kela-systems:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}
```

Then install:

```bash
pnpm add @kela-systems/ui-components @kela-systems/icons
```

## Styles

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:

```css
@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:

```tsx
import { DirectionProvider } from "@kela-systems/ui-components";

<DirectionProvider direction="rtl">
  <App />
</DirectionProvider>;
```

## Use the components

Import everything from the package root:

```tsx
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 `variant` or `size`. A `className` on a component adds layout only: placement, sizing, spacing.
- **Lay out with `Stack` and `Grid`, and style text with `Text`**, instead of a `div` or `span` with classes.
- **Compose with `render`.** A part that renders another element takes it through Base UI's `render` prop: `<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 `closeLabel` on a dialog. The library has no translations of its own.

Each [component page](/product/components) says what the component is for, shows it live, and lists its parts, props and variants.

## Icons

```tsx
import { IconAirplane } from "@kela-systems/icons/outline";

<IconAirplane size={16} />;
```

Icons are hidden from screen readers by default. The [Icons](/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`:

```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.
