Chapter 01 Start
Getting started
Follow every step, in order, and skip none: each one is required. The steps and the code follow the framework picked at the top of the page.
Setting up for Angular. Using another framework? Pick it at the top first.
Framework guides
Step 1. Check the requirements
Every line must be true before you install. Older versions are not supported.
| What | Minimum |
|---|---|
| Node.js | 22 |
| Angular (core, common, forms, router) | 22.2 |
| Angular CDK | 22.2, the same major version as Angular |
| RxJS | 7.8 |
| Tailwind CSS | 4.1 |
| Browsers | Chrome and Edge 123, Firefox 128, Safari 17.5 |
Step 2. Install the packages
pnpm add @okaapi-ui/angular @okaapi-ui/css @angular/cdk@^22.2.0
pnpm add -D tailwindcss @tailwindcss/postcss- Tailwind runs under the kit: its classes read the kit's tokens, so
p-4,bg-primaryandrounded-xlare the kit's own space, colour and radius. - Install
@okaapi-ui/cssyourself, even though the framework package depends on it. With pnpm, a package you did not add is not visible to your own imports, and step 3 imports it. - Each
@okaapi-ui/*package has its own version. When you update a framework package, update@okaapi-ui/csswith it, so your direct css install matches the version the framework package depends on. @angular/cdkmust have the same major version as@angular/core.
Step 3. Load the stylesheet once
Tailwind first, then the kit's tailwind.css: it loads the fonts and every component style, and makes the kit's tokens Tailwind's theme. Load them once, globally.
/* src/styles.css: the global stylesheet, first lines */
@import 'tailwindcss';
@import '@okaapi-ui/css/tailwind.css';
@import '@angular/cdk/overlay-prebuilt.css';
@import '@angular/cdk/a11y-prebuilt.css';
/* your own theme and styles below */// .postcssrc.json, next to angular.json
{
"plugins": {
"@tailwindcss/postcss": {}
}
}- Put it in the global stylesheet listed under
stylesinangular.json(orproject.json). Never in a component'sstylesorstyleUrl. - The CDK overlay stylesheet is required: select, combobox, menu, popover and tooltip float on it.
- The CDK a11y stylesheet is required: it hides the text that toasts and dialogs announce to screen readers. Without it that text sits at the bottom of the page and adds a scrollbar.
- Extend the theme in your own
@themeblock after the import; override a token on:rootto re-brand. - Write your own CSS inside
@layer baseor@layer components, or a plain rule on an element (a,button) beats the kit's classes. - Without Tailwind, load
ui.csson its own and use the kit'sui-classes:ui-p-4,ui-head-md.
Step 4. Set the language and direction
lang and dir on <html> are required. Fonts, spacing and keyboard direction all read them. When the reader switches language, change both together.
<!-- English -->
<html lang="en" dir="ltr">
<!-- Arabic -->
<html lang="ar" dir="rtl">The components also say words of their own: close buttons, announcements, pagination, empty lists. Give them Arabic in one place, and switch it with the language.
// app.config.ts: lang() is your language signal
import { computed } from '@angular/core';
import { arabicLabels, englishLabels, provideUiLabels } from '@okaapi-ui/angular';
providers: [
provideUiLabels(computed(() => (lang() === 'ar' ? arabicLabels : englishLabels))),
]Step 5. Add the app-wide parts
Nothing to provide: UiDialog, UiAlertDialog and UiToast are provided in root, so inject them where you need them.
// Nothing to set up: inject the services where you need them.
import { inject } from '@angular/core';
import { UiToast } from '@okaapi-ui/angular';
private readonly toast = inject(UiToast);Step 6. Use a component
import { Component } from '@angular/core';
import { ButtonComponent } from '@okaapi-ui/angular';
@Component({
selector: 'app-save-bar',
imports: [ButtonComponent],
template: `<button ui-button>Save</button>`,
})
export class SaveBarComponent {}Every component page shows each option live, with the code for your framework. Start with the button.
With server rendering
The components render on the server and hydrate in the browser. Nothing is needed beyond Angular's own setup. Code of yours that reads the page goes through DOCUMENT or afterNextRender.
// app.config.ts
import { ApplicationConfig } from '@angular/core';
import { provideClientHydration, withEventReplay } from '@angular/platform-browser';
export const appConfig: ApplicationConfig = {
providers: [provideClientHydration(withEventReplay())],
};Step 7. Check that it works
Run the app and check each line. Stop at the first one that fails and find it in the table below.
- The text is in IBM Plex Sans (DevTools, Computed, Rendered fonts).
- The primary button is Okaapi blue with white text.
- Pressing Tab to the button shows a focus ring around it.
data-theme="dark"on<html>turns the page dark.dir="rtl"on<html>mirrors the layout.- An open select shows its list right under the field.
When a check fails
| What you see | Cause and fix |
|---|---|
| No styles at all | tailwind.css is not loaded. Redo step 3; with pnpm, check that step 2 added @okaapi-ui/css. |
| Kit components look right, Tailwind classes do nothing | Tailwind is not running: the build file in step 3 is missing, or @import 'tailwindcss' is not the first line. |
| System font instead of Plex | The font files return 404 (Network tab, filter woff2). Keep fonts next to ui.css. |
| Components look wrong in places | Your own CSS sits outside a layer, or overrides a .ui-* class. Put it in @layer components, and restyle through tokens or Tailwind classes only. |
| Text at the bottom of the page, or a scrollbar, after a toast | @angular/cdk/a11y-prebuilt.css is missing from the global stylesheet (step 3). |
| A select list shows at the bottom of the page | @angular/cdk/overlay-prebuilt.css is missing from the global stylesheet (step 3). |
| Arabic shows in the Latin font | lang="ar" is missing (step 4). |
Rules
- Restyle only through the
--ui-*tokens and Tailwind classes. Never override a.ui-*class or the Angular CDK'scdk-*classes: they change without notice. - Never copy the kit's CSS into your project. Update the package instead, so fixes reach you.
- Never let colour carry meaning alone: an error also has text.
- In an Arabic app, give the components Arabic words with
arabicLabels(step 4), and write your own labels in Arabic too.
Re-brand for a client
Override the primary colours after the stylesheet. The "on" colour must reach 7:1 against its ground, and the focus colour 3:1 against the page, in both themes.
:root {
--ui-primary: light-dark(#0f5132, #6ee7b7);
--ui-on-primary: light-dark(#ffffff, #0b1020);
--ui-focus: light-dark(#0f5132, #6ee7b7);
--ui-highlight: light-dark(#d1fae5, #064e3b);
--ui-on-highlight: light-dark(#0b1020, #f6f7fb);
}