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.
| 7 |
| 8 | ```tsx |
| 9 | import { |
| 10 | Button, |
| 11 | Card, |
| 12 | ColineAppProvider, |
| 13 | Input, |
| 14 | useColine, |
| 15 | useColineQuery, |
| 16 | } from "@colineapp/ui"; |
| 17 | import "@colineapp/ui/styles.css"; |
| 18 |
| 19 | function NotesList() { |
| 20 | const coline = useColine(); |
| 21 | const notes = useColineQuery( |
| 22 | (c) => c.files.list({ typeKey: "notes.note" }), |
| 23 | [], |
| 24 | ); |
| 25 |
| 26 | return ( |
| 27 | <Card> |
| 28 | {notes.data?.files.map((file) => ( |
| 29 | <Button key={file.fileId} variant="ghost"> |
| 30 | {file.name} |
| 31 | </Button> |
| 32 | ))} |
| 33 | </Card> |
| 34 | ); |
| 35 | } |
| 36 |
| 37 | export default function App() { |
| 38 | return ( |
| 39 | <ColineAppProvider> |
| 40 | <NotesList /> |
| 41 | </ColineAppProvider> |
| 42 | ); |
| 43 | } |
| 44 | ``` |
| 45 |
| 46 | ## What's inside |
| 47 |
| 48 | - 21 components: Button, Card, Dialog, Input, Select, Checkbox, Switch, |
| 49 | Tabs, Table, Badge, Tooltip, DropdownMenu, and more — Radix-based, |
| 50 | accessible, keyboard-friendly. |
| 51 | - `ColineAppProvider` — connects the sandbox bridge and provides context. |
| 52 | - Hooks: `useColine` (the capability API), `useColineContext` (workspace / |
| 53 | surface / file context), `useColineQuery` (data fetching with |
| 54 | loading/error state), `useColorScheme`. |
| 55 | - `styles.css` — the compiled stylesheet; theme tokens are overridden at |
| 56 | runtime by the host, so one CSS file serves every workspace theme. |
| 57 |
| 58 | Used inside a Coline App's react-tier surface (`{ tier: "react", entry: |
| 59 | "main.tsx" }` in the manifest). Scaffold a working app with |
| 60 | `npx create-coline-app my-app`. |
| 61 |
| 62 | ## Docs |
| 63 |
| 64 | Full guides at [coline.app/developers/docs](https://coline.app/developers/docs). |
| 65 |
| 66 | MIT © Coline |
| 67 |
| 68 | ## SDK 0.4 / CLI 2.4 workflow |
| 69 |
| 70 | Run `coline-app check` before pushing: it checks types, the manifest, hosted logic, |
| 71 | and the React bundle without uploading. `dev --internal` updates one development |
| 72 | version; install it in the workspace and reload after changes. The CLI bundles |
| 73 | from the app's installed dependencies and preserves imported CSS and inline assets. |
| 74 | Compile app-specific Tailwind utilities to CSS before importing them. |
| 75 |
| 76 | The starter includes a React home and editor, tree mobile fallback, and a tool. |
| 77 | Use `coline.tools.invoke` or `actions.invokeTool` to run the same declared tool |
| 78 | from UI that Kairo runs. Save with `expectedVersion` to detect concurrent edits. |
| 79 | Homes/editors can write within grants; previews and server render handlers cannot. |
| 80 | `createTestWorkspace(app).client()` tests the interactive contract and |
| 81 | `grantedPermissions` simulates revoked consent. |
| 82 |
| 83 | New `tasks`, `calendar`, `messages`, and `references` capabilities require their |
| 84 | explicit manifest permissions and retain the invoking user's workspace access. |
| 85 | Use `files.list({ scope: "workspace" })` for shared files; document writes stay |
| 86 | with the owning app. Collections are install-private. Code integration and a |
| 87 | native mobile React runtime are separate work. |
| 88 |
| 89 | ### Live data |
| 90 |
| 91 | `useLiveCollection<RecordType>("collection", { where, orderBy, limit })` returns |
| 92 | `records`, `pending`, `status`, `error`, `nextCursor`, `insert`, `update`, `delete`, |
| 93 | `setAccess`, and `refresh`. Inline query objects are supported. Mutations update |
| 94 | local UI immediately and reject on conflicts or permission failures; catch their |
| 95 | promises to present the error. The hook owns subscription cleanup and reconnect |
| 96 | recovery. Use filtered/paged views (at most 200 records), not an entire workspace |
| 97 | in one hook. Structured-record sync does not imply CRDT text editing or offline |
| 98 | write persistence. |
| 99 |