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