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 | [Docs](https://docs.coline.app/sdk/ui) · |
| 9 | [Source](https://upstream.codes/coline/ui) · |
| 10 | [npm](https://www.npmjs.com/package/@colineapp/ui) |
| 11 |
| 12 | ```sh |
| 13 | npm install @colineapp/ui |
| 14 | ``` |
| 15 |
| 16 | ```tsx |
| 17 | import { |
| 18 | Button, |
| 19 | Card, |
| 20 | ColineAppProvider, |
| 21 | Input, |
| 22 | useColine, |
| 23 | useColineQuery, |
| 24 | } from "@colineapp/ui"; |
| 25 | import "@colineapp/ui/styles.css"; |
| 26 |
| 27 | function NotesList() { |
| 28 | const coline = useColine(); |
| 29 | const notes = useColineQuery( |
| 30 | (c) => c.files.list({ typeKey: "notes.note" }), |
| 31 | [], |
| 32 | ); |
| 33 |
| 34 | return ( |
| 35 | <Card> |
| 36 | {notes.data?.files.map((file) => ( |
| 37 | <Button key={file.fileId} variant="ghost"> |
| 38 | {file.name} |
| 39 | </Button> |
| 40 | ))} |
| 41 | </Card> |
| 42 | ); |
| 43 | } |
| 44 |
| 45 | export default function App() { |
| 46 | return ( |
| 47 | <ColineAppProvider> |
| 48 | <NotesList /> |
| 49 | </ColineAppProvider> |
| 50 | ); |
| 51 | } |
| 52 | ``` |
| 53 |
| 54 | ## On a Coline Site |
| 55 |
| 56 | Sites are public websites with no Coline host around them. Use |
| 57 | `ColineSiteProvider` instead of `ColineAppProvider`: it follows the visitor's |
| 58 | light or dark preference. Give the site's Tailwind the same token names with |
| 59 | `theme.css`. |
| 60 |
| 61 | ```tsx |
| 62 | // site/main.tsx |
| 63 | import { Button, Card, ColineSiteProvider } from "@colineapp/ui"; |
| 64 | import "@colineapp/ui/styles.css"; |
| 65 | import "./app.css"; // @import "tailwindcss"; @import "@colineapp/ui/theme.css"; |
| 66 |
| 67 | createRoot(root).render( |
| 68 | <ColineSiteProvider> |
| 69 | <App /> |
| 70 | </ColineSiteProvider>, |
| 71 | ); |
| 72 | ``` |
| 73 |
| 74 | A site looks like Coline. Use the components as they ship (`className` only |
| 75 | for layout), with no custom fonts, no palette of your own and `Tabs` or |
| 76 | `SegmentedControl` for navigation. The one choice a site makes is an accent |
| 77 | color: `<ColineSiteProvider accent="#0f766e">` recolors selection, radio |
| 78 | choices, the selected date, steps, info badges and the first chart series in |
| 79 | light and dark (checkboxes, switches and buttons stay Coline's neutral), |
| 80 | and `bg-action` / `text-action` use it in your own layout. `coline-app check` |
| 81 | warns about anything else. |
| 82 |
| 83 | Every component works on a site except the ones that need a workspace: |
| 84 | `FilePreview`, `FileDropzone`, `SaveAsButton`, `useFilePicker`, |
| 85 | `ConnectButton`, `useColine`, `useColineContext`, `useColineQuery`, |
| 86 | `useColorScheme` and `useToast`. Read data with the site hooks from |
| 87 | `@colineapp/sdk/site/react` instead. |
| 88 |
| 89 | ## What's inside |
| 90 |
| 91 | - Components: Button, Card, Dialog, Sheet, Input, Textarea, Select, Combobox, |
| 92 | Checkbox, Switch, Tabs, SegmentedControl, Table, DataGrid, Badge, Avatar, |
| 93 | Tooltip, DropdownMenu, Popover, Calendar, DatePicker, charts, Kanban, |
| 94 | Timeline, Steps, EmptyState and more — Radix-based, accessible, |
| 95 | keyboard-friendly. |
| 96 | - `ColineAppProvider` — connects the sandbox bridge and provides context. |
| 97 | - `ColineSiteProvider` — light and dark for a Coline Site. |
| 98 | - Hooks: `useColine` (the capability API), `useColineContext` (workspace / |
| 99 | surface / file context), `useColineQuery` (data fetching with |
| 100 | loading/error state), `useColorScheme`. |
| 101 | - `styles.css` — the compiled stylesheet; theme tokens are overridden at |
| 102 | runtime by the host, so one CSS file serves every workspace theme. |
| 103 |
| 104 | Used inside a Coline App's react-tier surface (`{ tier: "react", entry: |
| 105 | "main.tsx" }` in the manifest). Scaffold a working app with |
| 106 | `npx create-coline-app my-app`. |
| 107 |
| 108 | ## Docs |
| 109 |
| 110 | Full guides at [docs.coline.app](https://docs.coline.app): [UI](https://docs.coline.app/sdk/ui), |
| 111 | [Sites](https://docs.coline.app/sites). |
| 112 |
| 113 | ## Workflow |
| 114 |
| 115 | Run `coline-app check` before pushing: it checks types, the manifest, hosted logic, |
| 116 | and the React bundle without uploading. `dev --internal` updates one development |
| 117 | version; install it in the workspace and reload after changes. The CLI bundles |
| 118 | from the app's installed dependencies and preserves imported CSS and inline assets. |
| 119 | App-specific Tailwind v4 utilities compile automatically with CLI 2.5. Import |
| 120 | `@colineapp/ui/styles.css` and then `./app.css`; use complete class names. |
| 121 |
| 122 | The starter includes a React home and editor, tree mobile fallback, and a tool. |
| 123 | Use `coline.tools.invoke` or `actions.invokeTool` to run the same declared tool |
| 124 | from UI that Kairo runs. Save with `expectedVersion` to detect concurrent edits. |
| 125 | Homes/editors can write within grants; previews and server render handlers cannot. |
| 126 | `createTestWorkspace(app).client()` tests the interactive contract and |
| 127 | `grantedPermissions` simulates revoked consent. |
| 128 |
| 129 | New `tasks`, `calendar`, `messages`, and `references` capabilities require their |
| 130 | explicit manifest permissions and retain the invoking user's workspace access. |
| 131 | Use `files.list({ scope: "workspace" })` for shared files; document writes stay |
| 132 | with the owning app. Collections are install-private. A native mobile React runtime is separate |
| 133 | work; Coline Code builds and publishes apps (see [full-stack apps](https://docs.coline.app/sdk/full-stack)). |
| 134 |
| 135 | ### Live data |
| 136 |
| 137 | `useLiveCollection<RecordType>("collection", { where, orderBy, limit })` returns |
| 138 | `records`, `pending`, `status`, `error`, `nextCursor`, `insert`, `update`, `delete`, |
| 139 | `setAccess`, and `refresh`. Inline query objects are supported. Mutations update |
| 140 | local UI immediately and reject on conflicts or permission failures; catch their |
| 141 | promises to present the error. The hook owns subscription cleanup and reconnect |
| 142 | recovery. Use filtered/paged views (at most 200 records), not an entire workspace |
| 143 | in one hook. Structured-record sync does not imply CRDT text editing or offline |
| 144 | write persistence. |
| 145 |
| 146 | ## Screen patterns |
| 147 |
| 148 | Use `AppPage` and `PageToolbar` for consistent hierarchy, `RecordTable` with |
| 149 | `SplitView`/`DetailPanel` for queues, `Board`/`BoardColumn`/`BoardCard` for stages, |
| 150 | and `SettingsSection` for configuration. `EmptyState`, `AppErrorState`, |
| 151 | `AppLoadingState`, and `StatusBadge` cover common states. Their CSS ships in |
| 152 | `@colineapp/ui/styles.css`; they require no app-side utility generation. |
| 153 |
| 154 | Patterns compose around your domain and capabilities. They do not supply data, |
| 155 | routing, drag-and-drop, or persistence. `RecordTable` provides a first-cell button |
| 156 | when `onOpen` is set (don't nest a second control there); secondary columns hide |
| 157 | at narrow widths. Split details stack on mobile; the app owns focus management. |
| 158 | See the scaffold's `examples/` for complete interactive references. |
| 159 |
| 160 | ## Shared controls and motion |
| 161 |
| 162 | `Tabs` uses the same raised selection as Coline and Upstream. Selection springs |
| 163 | and content transitions are automatic; no indicator or animation wrapper is |
| 164 | required. Each tabs group owns its indicator so multiple groups never collide. |
| 165 | `TabsIndicator` remains available for existing custom compositions. |
| 166 |
| 167 | ```tsx |
| 168 | <Tabs defaultValue="inbox"> |
| 169 | <TabsList aria-label="Views"> |
| 170 | <TabsTrigger value="inbox">Inbox</TabsTrigger> |
| 171 | <TabsTrigger value="roadmap">Roadmap</TabsTrigger> |
| 172 | </TabsList> |
| 173 | <TabsContent value="inbox">{/* Inbox */}</TabsContent> |
| 174 | <TabsContent value="roadmap">{/* Roadmap */}</TabsContent> |
| 175 | </Tabs> |
| 176 | <FilterMenu |
| 177 | aria-label="Filter by status" |
| 178 | value={status} |
| 179 | onValueChange={setStatus} |
| 180 | options={[{ value: "all", label: "All statuses" }, { value: "planned", label: "Planned" }]} |
| 181 | /> |
| 182 | ``` |
| 183 |
| 184 | `FilterMenu` composes the exact Coline `DropdownMenu` radio group, surface, and |
| 185 | sliding highlight. Use `DropdownMenu` directly for action menus. `PageToolbar` |
| 186 | is borderless. `RecordTable` uses separated, rounded selection/hover rows. |
| 187 | Dialogs and menus include their animation CSS; the provider respects reduced |
| 188 | motion, including portals. Buttons default to `type="button"`; use |
| 189 | `type="submit"` for a form's submit action. |
| 190 |
| 191 | Use component defaults rather than copying their CSS into the app. Custom CSS |
| 192 | variables scoped to `AppPage` do not reach portalled dialogs/menus. Keep decorative |
| 193 | app variables at `:root` when they must cross portals, and retain host theme tokens. |
| 194 | App bundles include their dependencies: upgrade, rebuild and push to adopt a UI |
| 195 | release. Updating npm does not rewrite already-published app bundles. |
| 196 |
| 197 | The stylesheet includes the Latin Geist variable font and its SIL Open Font |
| 198 | License in `dist/fonts`. The CLI embeds the font in the app bundle, so sandbox |
| 199 | text uses Coline typography without remote font requests. Other scripts use the |
| 200 | system fallback. Keep font assets and their license in release tarballs. |
| 201 |
| 202 | ## Tokens and components |
| 203 |
| 204 | Rebuilt in 0.6 on host tokens with one motion vocabulary (`transitions`, |
| 205 | `staggerDelay`; `motion` and `AnimatePresence` are re-exported) and |
| 206 | reduced-motion support. New components: `DataGrid`, `KanbanBoard`, charts |
| 207 | (`LineChart`, `AreaChart`, `BarChart`, `DonutChart`, `Sparkline`), `Stat`, |
| 208 | `StatGrid`, `AnimatedNumber`, `PropertyList`, `Timeline`, `Steps`, |
| 209 | `Pagination`, `Breadcrumbs`, `Calendar`, `DatePicker`, `CommandList`, |
| 210 | `Combobox`, `SegmentedControl`, `RadioGroup`, `SearchInput`, `Accordion`, |
| 211 | `Sheet`, `Banner`, `Presence`, `Avatar`, `AvatarGroup`, `Spinner`, `Kbd`, |
| 212 | `FilePreview`, `FileDropzone`, `SaveAsButton`, `ConnectButton`, |
| 213 | `ConfirmButton`. Hooks: `useColineMutation`, `useJob`, `useConnection`, |
| 214 | `useDebouncedValue`, `useToast`. Page patterns now use tokens and animation; |
| 215 | `patterns.css` is gone. Status colors are `positive`, `attention`, `risk`, |
| 216 | `action`, and `chart-1`…`chart-5`. |
| 217 |
| 218 | ## Development |
| 219 |
| 220 | ```sh |
| 221 | git clone https://git.coline.app/coline/ui.git |
| 222 | cd ui |
| 223 | npm install |
| 224 | npm run typecheck |
| 225 | npm run build |
| 226 | ``` |
| 227 |
| 228 | The stylesheet is generated; published installs already include it. In |
| 229 | Coline's monorepo, run `pnpm --filter @colineapp/ui build` before source-based |
| 230 | AX fixtures; there the build also checks that the dropdown menu and its shared |
| 231 | style helpers match Coline's own. `typescript` is TypeScript 6 because tsup's |
| 232 | declaration build needs TypeScript's JavaScript API, which TypeScript 7 doesn't |
| 233 | ship yet; `tsrs` is the TypeScript 7 type checker. |
| 234 |
| 235 | ## Source |
| 236 |
| 237 | The repository is [coline/ui](https://upstream.codes/coline/ui) on |
| 238 | upstream.codes. The package is developed inside Coline's monorepo, at |
| 239 | `packages/coline-ui`, next to the app whose components it shares, and this |
| 240 | repository is published from there. Issues and change requests are welcome |
| 241 | here and get ported back. In the monorepo, `scripts/sync-package-repos.mjs ui` |
| 242 | republishes it: it splits `packages/coline-ui` out of `origin/main` the way |
| 243 | `git subtree split` does, which gives the same commits every time, and pushes |
| 244 | the result here as `main`, so every sync is a fast-forward. The monorepo links |
| 245 | `@colineapp/sdk` and `@colineapp/app-runtime` from its own folders; here |
| 246 | `package.json` names the versions those were, as `pnpm publish` writes them. |
| 247 |
| 248 | ## License |
| 249 |
| 250 | MIT © Coline |
| 251 |