Skip to content
Okaapiأوكابي
Framework for the code
Theme
Okaapi on GitHub

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.

WhatMinimum
Node.js22
Angular (core, common, forms, router)22.2
Angular CDK22.2, the same major version as Angular
RxJS7.8
Tailwind CSS4.1
BrowsersChrome and Edge 123, Firefox 128, Safari 17.5

Step 2. Install the packages

Terminal
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-primary and rounded-xl are the kit's own space, colour and radius.
  • Install @okaapi-ui/css yourself, 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/css with it, so your direct css install matches the version the framework package depends on.
  • @angular/cdk must 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.

Angular
/* 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 */
Angular
// .postcssrc.json, next to angular.json
{
  "plugins": {
    "@tailwindcss/postcss": {}
  }
}
  • Put it in the global stylesheet listed under styles in angular.json (or project.json). Never in a component's styles or styleUrl.
  • 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 @theme block after the import; override a token on :root to re-brand.
  • Write your own CSS inside @layer base or @layer components, or a plain rule on an element (a, button) beats the kit's classes.
  • Without Tailwind, load ui.css on its own and use the kit's ui- 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.

index.html
<!-- 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.

Angular
// 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.

Angular
// 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

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

Angular
// 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.

  1. The text is in IBM Plex Sans (DevTools, Computed, Rendered fonts).
  2. The primary button is Okaapi blue with white text.
  3. Pressing Tab to the button shows a focus ring around it.
  4. data-theme="dark" on <html> turns the page dark.
  5. dir="rtl" on <html> mirrors the layout.
  6. An open select shows its list right under the field.

When a check fails

What you seeCause and fix
No styles at alltailwind.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 fontlang="ar" is missing (step 4).

Rules

  • Restyle only through the --ui-* tokens and Tailwind classes. Never override a .ui-* class or the Angular CDK's cdk-* 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.

CSS
: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);
}