# Effect UI examples Runnable apps built with `effect/ui` and its host packages. Several are ports of [Foldkit's examples](https://github.com/devinjameson/foldkit/tree/main/examples). Each one is a private workspace package, so `pnpm check` type checks it and `pnpm lint` lints it with the rest of the repository. Install once from the repository root: ```sh pnpm install ``` Then start a web example with Vite and open the printed URL: ```sh pnpm --filter counter dev ``` The terminal examples run on Node with `--experimental-ffi`, or on Bun: ```sh pnpm --filter snake-tui start pnpm --filter snake-tui start:bun ``` The native examples need a device toolchain and have their own READMEs. | Example | Host | What it shows | | ------------------------------------------------ | -------- | ------------------------------------------------------------------------------------------------------------------ | | [`auth`](auth) | Browser | Sign-in with guarded routes and a `SessionStore` service | | [`canvas-art`](canvas-art) | Browser | A `` animation drawn with `Canvas` and `HtmlSubscription` | | [`counter`](counter) | Browser | A counter with kit `Button`s, `Head` updates, a `Story` test and the DevTools workbench | | [`counters`](counters) | Browser | A keyed list of child `Counter` components | | [`domains`](domains) | Browser | Foldkit's domain search, server-rendered with a shared `HttpApi` and kit popups. `build` and `preview` scripts too | | [`file-preview`](file-preview) | Browser | Reading local files with `HtmlFiles` and switch-mode `Command`s | | [`interrupting-commands`](interrupting-commands) | Browser | Concurrent uploads, `Command` interruption and `@effect/ui-devtools` | | [`launch`](launch) | Browser | The Effect UI launch article, prerendered with `HtmlServerVite`. `build` and `preview` scripts too | | [`routing`](routing) | Browser | Typed routes, lazy pages, `Query` and `NavigationLinks` | | [`snake`](snake) | Browser | Keyboard Subscriptions, timers and `@effect/ui-devtools`. Its `SnakeGameLogic` is shared with `snake-tui` | | [`virtual-list`](virtual-list) | Browser | `VirtualList` and `VirtualGrid`, one page per feature. See [its README](virtual-list/README.md) | | [`web-components`](web-components) | Browser | Third-party Web Components with `Html.customElement` | | [`routing-tui`](routing-tui) | Terminal | An issue tracker on `RouterStack` and `@effect/ui-opentui`. `pnpm --filter routing-tui start /issues/2` opens one | | [`snake-tui`](snake-tui) | Terminal | `snake` in the terminal, with `DevToolsHeadless` | | [`native`](native) | Native | An Expo app on `@effect/ui-native` for iOS and Android. See [its README](native/README.md) | | [`native-macos`](native-macos) | Native | The `native` app on react-native-macos. See [its README](native-macos/README.md) | ## Tests Most examples keep Vitest suites beside their sources. Run one example's suite from the repository root: ```sh pnpm vitest run --project examples/ui examples/ui/routing/ ``` `pnpm test-ui` runs all of them with the effect/ui suites. Two examples also have browser checks that need Playwright's browsers (`pnpm exec playwright install`): `pnpm --filter virtual-list check-history` and `pnpm --filter interrupting-commands check-devtools`. ## Formatting `examples/dprint.json` inherits the repository's dprint configuration with an 80-column line width across `examples/`. It also runs `scripts/stack-chains.mjs` over `examples/ui` TypeScript, except `*.test.ts(x)` files: when two or more method calls follow the start of a chain (such as `h.div`), each goes on its own line, so a view reads as a tree.