Installation
One package, one stylesheet, and you're done. There is no provider to add.
1. Install
$ npm install oks-ui2. Import the styles once
In your app entry or root layout. This one line brings in the design tokens, the opt-in utility layer, and every component's CSS.
import "oks-ui/styles.css";Need just the tokens and utilities, without component styles?
import "oks-ui/tokens.css";
import "oks-ui/utilities.css";3. Use a component
import { Button } from "oks-ui";
export const Example = () => {
return <Button color="primary">Save</Button>;
};Barrel vs. per-component imports
The example above imports from the oks-ui barrel — simplest, and fine for most apps. For the smallest possible bundle, import each component from its own subpath and add its stylesheet:
import { Button } from "oks-ui/button";
import "oks-ui/button.css";Your bundler then ships only the components you actually import. In webpack, Vite, Rollup and Rspack the stylesheet import inside oks-ui/button is followed automatically; under Next.js with Turbopack, add the .css line yourself.
oks-ui/button, oks-ui/modal, …). Since oks-ui 1.3.1 those are client components you can use directly in a Server Component, except oks-ui/text-editor and oks-ui/pagination. Those two, and the main oks-ui entry, need a file that starts with "use client" to render their components. Static prerendering of the initial HTML works either way.What it costs
Gzipped sizes measured on oks-ui 1.3.1 on : JavaScript minified with esbuild and React left out, importing each component from its own subpath; CSS as shipped in the package.
| What you import | JavaScript | CSS |
|---|---|---|
| Button | 5.6 KB | 3.5 KB |
| Modal | 7.0 KB | 2.5 KB |
| Table | 40.6 KB | 18.9 KB |
| Chart (all seven types) | 62.9 KB | 21.1 KB |
| Everything (main entry, oks-ui/styles.css) | 119.0 KB | 51.3 KB |
The last row is the ceiling if you used everything. A bundler ships only what you import, so most pages cost far less. Per-component breakdowns are on the zero dependencies page, and the CSS trade-off inside Next.js is on the Next.js page.
Requirements
- React 18 or newer (React 19 included).
- Any bundler. No build plugin required.