The Coline design system: accessible React components for Coline Apps, themed live by the host workspace, and for Coline Sites in light and dark. Tailwind v4 stylesheet included. MIT.
| ## Required app setup |
| 8 |
| 9 | ```tsx |
| 10 | import { createRoot } from "react-dom/client"; |
| 11 | import { |
| 12 | Button, |
| 13 | ColineAppProvider, |
| 14 | useColine, |
| 15 | useColineQuery, |
| 16 | } from "@colineapp/ui"; |
| 17 | import "@colineapp/ui/styles.css"; |
| 18 |
| 19 | function Home() { |
| 20 | const coline = useColine(); |
| 21 | const items = useColineQuery( |
| 22 | (capabilities) => capabilities.files.list({ limit: 100 }), |
| 23 | [], |
| 24 | ); |
| 25 | return <Button onClick={() => items.refetch()}>Refresh</Button>; |
| 26 | } |
| 27 |
| 28 | const root = document.getElementById("root"); |
| 29 | if (root) { |
| 30 | createRoot(root).render( |
| 31 | <ColineAppProvider> |
| 32 | <Home /> |
| 33 | </ColineAppProvider>, |
| 34 | ); |
| 35 | } |
| 36 | ``` |
| 37 |
| 38 | The package requires React 19 and ReactDOM 19 as peer dependencies. The |
| 39 | scaffold installs them for app authors. `ColineAppProvider` is mandatory |
| 40 | before using `useColine`, `useColineContext`, `useColineQuery`, or |
| 41 | `useColorScheme`; it intentionally renders nothing until the bridge connects. |
| 42 |
| 43 | ## Data and sandbox rules |
| 44 |
| 45 | - All app data goes through the injected `coline.*` capability client. |
| 46 | - Do not use `fetch`, localStorage, cookies, direct API routes, or credentials |
| 47 | in a sandboxed app. Network access belongs behind `coline.net.fetch` and the |
| 48 | manifest allowlist. |
| 49 | - `useColineQuery(loader, deps)` is a small loading/error/refetch helper, not a |
| 50 | cache. Keep loaders bounded and put stable values in `deps`. |
| 51 | - Use host theme tokens and the exported components. Do not hardcode light-only |
| 52 | colors or invent a second provider. |
| 53 |
| 54 | ## Component contract |
| 55 |
| 56 | The public barrel exports the provider/hooks plus accessible components such |
| 57 | as `Button`, `Card`, `Input`, `Textarea`, `Badge`, `Dialog`, `Select`, |
| 58 | `Checkbox`, `Switch`, `Tabs`, `Table`, `Skeleton`, and `Tooltip`. Check the |
| 59 | component source and declaration output before documenting a new prop. |
| 60 |
| 61 | The CLI bundles `main.tsx`, installed client dependencies, and imported CSS. |
| 62 | Coline rebuilds the uploaded artifact; the sandbox does not install packages. |
| 63 | Browser-compatible npm dependencies can be added to the app package. |
| 64 |
| 65 | ## Verification and release |
| 66 |
| 67 | - Run `pnpm --filter @colineapp/ui typecheck` after component/provider changes. |
| 68 | - Keep CSS export and component export changes together. |
| 69 | - Preserve React peer dependency ranges and the `./styles.css` export. |
| 70 | - Update README examples and the scaffold skill when an app-facing contract |
| 71 | changes. The generated app must be able to use the documented API after a |
| 72 | clean `npm install`. |
| 73 |
| 74 | ## SDK 0.4 / CLI 2.4 workflow |
| 75 |
| 76 | Run `coline-app check` before pushing: it checks types, the manifest, hosted logic, |
| 77 | and the React bundle without uploading. `dev --internal` updates one development |
| 78 | version; install it in the workspace and reload after changes. The CLI bundles |
| 79 | from the app's installed dependencies and preserves imported CSS and inline assets. |
| 80 | CLI 2.5 compiles app-specific Tailwind v4 and ordinary CSS automatically. |
| 81 | Import UI styles, then app.css; use complete class names. Local `preview` uses |
| 82 | the public test workspace and sandbox bridge, requires no credentials, and can |
| 83 | capture light/dark/mobile/error states with `--screenshots <directory>`. |
| 84 |
| 85 | The starter includes a React home and editor, tree mobile fallback, and a tool. |
| 86 | Use `coline.tools.invoke` or `actions.invokeTool` to run the same declared tool |
| 87 | from UI that Kairo runs. Save with `expectedVersion` to detect concurrent edits. |
| 88 | Homes/editors can write within grants; previews and server render handlers cannot. |
| 89 | `createTestWorkspace(app).client()` tests the interactive contract and |
| 90 | `grantedPermissions` simulates revoked consent. |
| 91 |
| 92 | New `tasks`, `calendar`, `messages`, and `references` capabilities require their |
| 93 | explicit manifest permissions and retain the invoking user's workspace access. |
| 94 | Use `files.list({ scope: "workspace" })` for shared files; document writes stay |
| 95 | with the owning app. Collections are install-private. Code integration and a |
| 96 | native mobile React runtime are separate work. |
| 97 |
| 98 | `src/live-collection.ts` wraps the SDK's canonical live-record implementation. |
| 99 | Keep state/conflict/sync logic in the SDK; React owns only subscriptions and |
| 100 | lifecycle. Inline serializable query objects must not restart the view on each |
| 101 | render. React Strict Mode cleanup/start must remain supported. Never infer record |
| 102 | permission from optimistic state or broadcast private fields to an install room. |
| 103 |