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 | ## On a Coline Site |
| 44 |
| 45 | A site's page (`surfaces.site.entry`) has no Coline host. Wrap it in |
| 46 | `ColineSiteProvider` (follows the visitor's light/dark preference; pass |
| 47 | `theme="light"` or `"dark"` to fix one), import `@colineapp/ui/styles.css`, |
| 48 | and import `@colineapp/ui/theme.css` after `tailwindcss` in the site's CSS so |
| 49 | `bg-card`, `text-muted-foreground`, `border-border` and `dark:` match the |
| 50 | components. Build every control from these components; don't hand-roll |
| 51 | buttons, inputs or cards. |
| 52 |
| 53 | A site looks like Coline. Its one design choice is `accent` on |
| 54 | `ColineSiteProvider` (sets `--action` on the root, lifted for dark mode |
| 55 | unless `{ light, dark }` is passed). Everything else stays Coline's: no |
| 56 | className or CSS that changes a component's colors, borders, radius, |
| 57 | padding or fonts, no custom fonts or palettes, `Tabs` / `SegmentedControl` |
| 58 | for navigation. `coline-app check` warns about each of these |
| 59 | (`packages/create-coline-app/src/site-design.ts`). Keep the rules in this |
| 60 | file, the site template's AGENTS.md, the docs' `sites/design` page and |
| 61 | `apps/docs/src/lib/agents.ts` saying the same thing. |
| 62 |
| 63 | Workspace-only, unavailable on sites: `ColineAppProvider`, `useColine`, |
| 64 | `useColineContext`, `useColineQuery`, `useColorScheme`, `useToast`, |
| 65 | `FilePreview`, `FileDropzone`, `SaveAsButton`, `useFilePicker`, |
| 66 | `ConnectButton`. Sites read data with `@colineapp/sdk/site/react` |
| 67 | (`createSiteHooks<typeof app>()`) and upload with `useUpload`. |
| 68 |
| 69 | ## Data and sandbox rules |
| 70 |
| 71 | - All app data goes through the injected `coline.*` capability client. |
| 72 | - Do not use `fetch`, localStorage, cookies, direct API routes, or credentials |
| 73 | in a sandboxed app. Network access belongs behind `coline.net.fetch` and the |
| 74 | manifest allowlist. |
| 75 | - `useColineQuery(loader, deps)` is a small loading/error/refetch helper, not a |
| 76 | cache. Keep loaders bounded and put stable values in `deps`. |
| 77 | - Use host theme tokens and the exported components. Do not hardcode light-only |
| 78 | colors or invent a second provider. |
| 79 |
| 80 | ## Component contract |
| 81 |
| 82 | The public barrel exports the provider/hooks plus accessible components such |
| 83 | as `Button`, `Card`, `Input`, `Textarea`, `Badge`, `Dialog`, `Select`, |
| 84 | `Checkbox`, `Switch`, `Tabs`, `Table`, `Skeleton`, and `Tooltip`. Check the |
| 85 | component source and declaration output before documenting a new prop. |
| 86 |
| 87 | The CLI bundles `main.tsx`, installed client dependencies, and imported CSS. |
| 88 | Coline rebuilds the uploaded artifact; the sandbox does not install packages. |
| 89 | Browser-compatible npm dependencies can be added to the app package. |
| 90 |
| 91 | ## Verification and release |
| 92 |
| 93 | - Run `pnpm --filter @colineapp/ui typecheck` after component/provider changes. |
| 94 | - Keep CSS export and component export changes together. |
| 95 | - Preserve React peer dependency ranges and the `./styles.css` export. |
| 96 | - Update README examples and the scaffold skill when an app-facing contract |
| 97 | changes. The generated app must be able to use the documented API after a |
| 98 | clean `npm install`. |
| 99 |
| 100 | ## SDK 0.4 / CLI 2.4 workflow |
| 101 |
| 102 | Run `coline-app check` before pushing: it checks types, the manifest, hosted logic, |
| 103 | and the React bundle without uploading. `dev --internal` updates one development |
| 104 | version; install it in the workspace and reload after changes. The CLI bundles |
| 105 | from the app's installed dependencies and preserves imported CSS and inline assets. |
| 106 | CLI 2.5 compiles app-specific Tailwind v4 and ordinary CSS automatically. |
| 107 | Import UI styles, then app.css; use complete class names. Local `preview` uses |
| 108 | the public test workspace and sandbox bridge, requires no credentials, and can |
| 109 | capture light/dark/mobile/error states with `--screenshots <directory>`. |
| 110 |
| 111 | The starter includes a React home and editor, tree mobile fallback, and a tool. |
| 112 | Use `coline.tools.invoke` or `actions.invokeTool` to run the same declared tool |
| 113 | from UI that Kairo runs. Save with `expectedVersion` to detect concurrent edits. |
| 114 | Homes/editors can write within grants; previews and server render handlers cannot. |
| 115 | `createTestWorkspace(app).client()` tests the interactive contract and |
| 116 | `grantedPermissions` simulates revoked consent. |
| 117 |
| 118 | New `tasks`, `calendar`, `messages`, and `references` capabilities require their |
| 119 | explicit manifest permissions and retain the invoking user's workspace access. |
| 120 | Use `files.list({ scope: "workspace" })` for shared files; document writes stay |
| 121 | with the owning app. Collections are install-private. A native mobile React runtime is separate |
| 122 | work; Coline Code builds and publishes apps (see `docs/sdk/full-stack.md`). |
| 123 |
| 124 | `src/live-collection.ts` wraps the SDK's canonical live-record implementation. |
| 125 | Keep state/conflict/sync logic in the SDK; React owns only subscriptions and |
| 126 | lifecycle. Inline serializable query objects must not restart the view on each |
| 127 | render. React Strict Mode cleanup/start must remain supported. Never infer record |
| 128 | permission from optimistic state or broadcast private fields to an install room. |
| 129 |
| 130 | ## UI 0.4.1 defaults |
| 131 |
| 132 | Use `Tabs` / `TabsList` / `TabsTrigger` / `TabsContent` for app views. The raised |
| 133 | sliding selection and content transition are automatic. Do not recreate tab |
| 134 | buttons or choose the opt-in line variant for standard Coline navigation. |
| 135 | Use `FilterMenu` for value filters, and `DropdownMenu` for actions. Both use the |
| 136 | canonical Coline menu surface and highlight. `pnpm check:parity` enforces the |
| 137 | vendored dropdown implementation; `pnpm sync:platform` refreshes it. |
| 138 | Keep animation CSS in the package, respect reduced motion, and verify controls |
| 139 | in a portalled dialog as well as on the page. A form submit button needs explicit |
| 140 | `type="submit"`. Do not restyle shared controls with app-specific CSS. |
| 141 |
| 142 | The menu parity sync includes `menu-item-styles.ts`, the shared class definition |
| 143 | used by dropdown items. Keep this dependency in the sync list when canonical |
| 144 | controls extract helpers; a public package build must work in a fresh checkout. |
| 145 |
| 146 | The stylesheet includes the Latin Geist variable font and its SIL Open Font |
| 147 | License in `dist/fonts`. The CLI embeds the font in the app bundle, so sandbox |
| 148 | text uses Coline typography without remote font requests. Other scripts use the |
| 149 | system fallback. Keep font assets and their license in release tarballs. |
| 150 |
| 151 | ## UI 0.6 contract |
| 152 |
| 153 | - Components consume host tokens only. Status and chart colors come from the |
| 154 | sandbox bridge (`--status-*`, `--action`, `--chart-*`); never hard-code hex |
| 155 | or raw Tailwind palette colors. |
| 156 | - Motion goes through `lib/motion.ts` (`transitions.enter|quick|indicator|spring`, |
| 157 | `staggerDelay`) and every animation respects `useReducedMotion`. |
| 158 | - After changing components or styles: `pnpm --filter @colineapp/ui typecheck`, |
| 159 | `pnpm --filter @colineapp/ui build:css`, `node scripts/sync-sandbox-styles.mjs` |
| 160 | (regenerates `apps/web/src/lib/apps/sandbox-styles.generated.ts`), and |
| 161 | `pnpm --filter @colineapp/ui check:parity`. |
| 162 | - Re-scaffold every create-coline-app template and run `coline-app check`; the |
| 163 | templates are the kit's real consumers. |
| 164 |