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.5 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 | App-specific Tailwind v4 utilities compile automatically with CLI 2.5. Import |
| 75 | `@colineapp/ui/styles.css` and then `./app.css`; use complete class names. |
| 76 |
| 77 | The starter includes a React home and editor, tree mobile fallback, and a tool. |
| 78 | Use `coline.tools.invoke` or `actions.invokeTool` to run the same declared tool |
| 79 | from UI that Kairo runs. Save with `expectedVersion` to detect concurrent edits. |
| 80 | Homes/editors can write within grants; previews and server render handlers cannot. |
| 81 | `createTestWorkspace(app).client()` tests the interactive contract and |
| 82 | `grantedPermissions` simulates revoked consent. |
| 83 |
| 84 | New `tasks`, `calendar`, `messages`, and `references` capabilities require their |
| 85 | explicit manifest permissions and retain the invoking user's workspace access. |
| 86 | Use `files.list({ scope: "workspace" })` for shared files; document writes stay |
| 87 | with the owning app. Collections are install-private. Code integration and a |
| 88 | native mobile React runtime are separate work. |
| 89 |
| 90 | ### Live data |
| 91 |
| 92 | `useLiveCollection<RecordType>("collection", { where, orderBy, limit })` returns |
| 93 | `records`, `pending`, `status`, `error`, `nextCursor`, `insert`, `update`, `delete`, |
| 94 | `setAccess`, and `refresh`. Inline query objects are supported. Mutations update |
| 95 | local UI immediately and reject on conflicts or permission failures; catch their |
| 96 | promises to present the error. The hook owns subscription cleanup and reconnect |
| 97 | recovery. Use filtered/paged views (at most 200 records), not an entire workspace |
| 98 | in one hook. Structured-record sync does not imply CRDT text editing or offline |
| 99 | write persistence. |
| 100 |
| 101 | ## Screen patterns |
| 102 |
| 103 | Use `AppPage` and `PageToolbar` for consistent hierarchy, `RecordTable` with |
| 104 | `SplitView`/`DetailPanel` for queues, `Board`/`BoardColumn`/`BoardCard` for stages, |
| 105 | and `SettingsSection` for configuration. `EmptyState`, `AppErrorState`, |
| 106 | `AppLoadingState`, and `StatusBadge` cover common states. Their CSS ships in |
| 107 | `@colineapp/ui/styles.css`; they require no app-side utility generation. |
| 108 |
| 109 | Patterns compose around your domain and capabilities. They do not supply data, |
| 110 | routing, drag-and-drop, or persistence. `RecordTable` provides a first-cell button |
| 111 | when `onOpen` is set (don't nest a second control there); secondary columns hide |
| 112 | at narrow widths. Split details stack on mobile; the app owns focus management. |
| 113 | See the scaffold's `examples/` for complete interactive references. |
| 114 |
| 115 | ## Shared controls and motion (0.4.1) |
| 116 |
| 117 | `Tabs` uses the same raised selection as Coline and Upstream. Selection springs |
| 118 | and content transitions are automatic; no indicator or animation wrapper is |
| 119 | required. Each tabs group owns its indicator so multiple groups never collide. |
| 120 | `TabsIndicator` remains available for existing custom compositions. |
| 121 |
| 122 | ```tsx |
| 123 | <Tabs defaultValue="inbox"> |
| 124 | <TabsList aria-label="Views"> |
| 125 | <TabsTrigger value="inbox">Inbox</TabsTrigger> |
| 126 | <TabsTrigger value="roadmap">Roadmap</TabsTrigger> |
| 127 | </TabsList> |
| 128 | <TabsContent value="inbox">{/* Inbox */}</TabsContent> |
| 129 | <TabsContent value="roadmap">{/* Roadmap */}</TabsContent> |
| 130 | </Tabs> |
| 131 | <FilterMenu |
| 132 | aria-label="Filter by status" |
| 133 | value={status} |
| 134 | onValueChange={setStatus} |
| 135 | options={[{ value: "all", label: "All statuses" }, { value: "planned", label: "Planned" }]} |
| 136 | /> |
| 137 | ``` |
| 138 |
| 139 | `FilterMenu` composes the exact Coline `DropdownMenu` radio group, surface, and |
| 140 | sliding highlight. Use `DropdownMenu` directly for action menus. `PageToolbar` |
| 141 | is borderless. `RecordTable` uses separated, rounded selection/hover rows. |
| 142 | Dialogs and menus include their animation CSS; the provider respects reduced |
| 143 | motion, including portals. Buttons default to `type="button"`; use |
| 144 | `type="submit"` for a form's submit action. |
| 145 |
| 146 | Use component defaults rather than copying their CSS into the app. Custom CSS |
| 147 | variables scoped to `AppPage` do not reach portalled dialogs/menus. Keep decorative |
| 148 | app variables at `:root` when they must cross portals, and retain host theme tokens. |
| 149 | App bundles include their dependencies: upgrade, rebuild and push to adopt a UI |
| 150 | release. Updating npm does not rewrite already-published app bundles. |
| 151 |