# Effect UI Kit

> For agents: start with the [agent guide](https://ratstack.sh/llms.txt). Every page is Markdown by default; add `Accept: text/html` for HTML.

New on /news: [Pleat 0.2 moves its typed styles to Effect UI](/news).

Joel chose effectcn components as written on Tailwind v4, using rat-stack’s existing CSS tokens.
We retired StyleX so effectcn components can be copied without rewriting their styles.
The old build emitted StyleX class names without their CSS. The Tailwind build ships the authored styles with the page.

## What it does

`@effect/ui-kit` supplies headless controls: the kit handles interaction, and the app supplies the styles.
The [directory](/directory) uses its Toggle for stack filters.
Each Toggle renders a native button and exposes its pressed state to assistive technology.
The directory still owns the selected letters and the filter logic.

## The standard

- Use `@effect/ui-kit` primitives for interactive browser UI instead of writing focus, keyboard or ARIA behaviour by hand. Keep native controls when the browser already supplies the behaviour.
- Copy effectcn components as written from `/components/<slug>.md`, such as [Toggle](https://www.effectcn.com/components/toggle.md). Set variants or classes at the call site.
  You may trim unused effectcn variants when copying a component.
- Use Tailwind v4. `@theme inline` maps utilities to the existing CSS tokens. Keep the existing CSS and omit Tailwind Preflight.
- Map the effectcn tokens behind utilities such as `bg-primary`, `ring`, and `bg-card` to existing tokens in `apps/web/src/tailwind.css`. Do not add a palette.
- `tailwind-merge` costs about 8.8 KB gzip on pages that import `cn`. Only the directory imports it today.
- Keep hot pink as the only accent. Use named colour tokens instead of arbitrary colour values in class strings.
- Use the same commit snapshot for `@effect/ui-kit` and `@effect/ui`. Bump them together.

## How to check

Run the build and test suite:

```sh
pnpm turbo run check test build --summarize
```

The directory tests in `apps/web/test/directory-effect-ui.test.ts` check that pressing a filter narrows the list and clearing restores it.
They also check pressed state and that a toggle survives hydration and updates in place.
The accent tests in `apps/site/test/accent.test.ts` and `apps/web/test/accent.test.ts` check where pink can appear.
The web test also rejects arbitrary colour values in classes.
`apps/web/test/prerender-styles.test.ts` checks that the HTML ships with CSS selectors for its styled classes.

## Sources

1. [Installation](https://www.effectcn.com/docs/installation.md)
   effectcn. The Tailwind setup and class merge helper. Accessed 2026-11-29.

2. [Toggle](https://www.effectcn.com/components/toggle.md)
   effectcn. The copyable wrapper for the headless Toggle. Accessed 2026-11-29.

3. [Toggle at the pinned Effect UI snapshot](https://github.com/Effect-TS/ui/blob/e2cb60ec65f2f2bd37813c5c5dc5378c42b03c85/packages/ui-kit/src/Toggle.ts)
   Effect. The native button and its pressed state. Accessed 2026-11-29.

## Lore on this page

- [Accumulate independent errors before writing output](/lore/accumulate-independent-errors)
- [Web](/systems/web)

## Linked from

- Agent guide → An Effect stack so pure (aspirational) Kit Langton will blush. → [Read page](https://ratstack.sh/llms.txt)

- Agent rules for rat-stack (AGENTS.md) → What you may change, which commands to run, and which changes need approval. → [Read page](https://ratstack.sh/AGENTS.md)

- Change log → What changed in the files served here, newest first. → [Read page](https://ratstack.sh/log)

- Full agent guide → An Effect stack so pure (aspirational) Kit Langton will blush. → [Read page](https://ratstack.sh/llms-full.txt)

- Rat Stack systems | rat-stack → The systems rat-stack ships, the standard each keeps, and how to check it. → [Read page](https://ratstack.sh/systems)

- Source change history (log.md) → The generated change log as Markdown. → [Read page](https://ratstack.sh/log.md)
