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 | ## On a Coline Site |
| 47 |
| 48 | Sites are public websites with no Coline host around them. Use |
| 49 | `ColineSiteProvider` instead of `ColineAppProvider`: it follows the visitor's |
| 50 | light or dark preference. Give the site's Tailwind the same token names with |
| 51 | `theme.css`. |
| 52 |
| 53 | ```tsx |
| 54 | // site/main.tsx |
| 55 | import { Button, Card, ColineSiteProvider } from "@colineapp/ui"; |
| 56 | import "@colineapp/ui/styles.css"; |
| 57 | import "./app.css"; // @import "tailwindcss"; @import "@colineapp/ui/theme.css"; |
| 58 |
| 59 | createRoot(root).render( |
| 60 | <ColineSiteProvider> |
| 61 | <App /> |
| 62 | </ColineSiteProvider>, |
| 63 | ); |
| 64 | ``` |
| 65 |
| 66 | Every component works on a site except the ones that need a workspace: |
| 67 | `FilePreview`, `FileDropzone`, `SaveAsButton`, `useFilePicker`, |
| 68 | `ConnectButton`, `useColine`, `useColineContext`, `useColineQuery`, |
| 69 | `useColorScheme` and `useToast`. Read data with the site hooks from |
| 70 | `@colineapp/sdk/site/react` instead. |
| 71 |
| 72 | ## What's inside |
| 73 |
| 74 | - Components: Button, Card, Dialog, Sheet, Input, Textarea, Select, Combobox, |
| 75 | Checkbox, Switch, Tabs, SegmentedControl, Table, DataGrid, Badge, Avatar, |
| 76 | Tooltip, DropdownMenu, Popover, Calendar, DatePicker, charts, Kanban, |
| 77 | Timeline, Steps, EmptyState and more — Radix-based, accessible, |
| 78 | keyboard-friendly. |
| 79 | - `ColineAppProvider` — connects the sandbox bridge and provides context. |
| 80 | - `ColineSiteProvider` — light and dark for a Coline Site. |
| 81 | - Hooks: `useColine` (the capability API), `useColineContext` (workspace / |
| 82 | surface / file context), `useColineQuery` (data fetching with |
| 83 | loading/error state), `useColorScheme`. |
| 84 | - `styles.css` — the compiled stylesheet; theme tokens are overridden at |
| 85 | runtime by the host, so one CSS file serves every workspace theme. |
| 86 |
| 87 | Used inside a Coline App's react-tier surface (`{ tier: "react", entry: |
| 88 | "main.tsx" }` in the manifest). Scaffold a working app with |
| 89 | `npx create-coline-app my-app`. |
| 90 |
| 91 | ## Docs |
| 92 |
| 93 | Full guides at [docs.coline.app](https://docs.coline.app): [UI](https://docs.coline.app/sdk/ui), |
| 94 | [Sites](https://docs.coline.app/sites). |
| 95 |
| 96 | MIT © Coline |
| 97 |
| 98 | ## SDK 0.4 / CLI 2.5 workflow |
| 99 |
| 100 | Run `coline-app check` before pushing: it checks types, the manifest, hosted logic, |
| 101 | and the React bundle without uploading. `dev --internal` updates one development |
| 102 | version; install it in the workspace and reload after changes. The CLI bundles |
| 103 | from the app's installed dependencies and preserves imported CSS and inline assets. |
| 104 | App-specific Tailwind v4 utilities compile automatically with CLI 2.5. Import |
| 105 | `@colineapp/ui/styles.css` and then `./app.css`; use complete class names. |
| 106 |
| 107 | The starter includes a React home and editor, tree mobile fallback, and a tool. |
| 108 | Use `coline.tools.invoke` or `actions.invokeTool` to run the same declared tool |
| 109 | from UI that Kairo runs. Save with `expectedVersion` to detect concurrent edits. |
| 110 | Homes/editors can write within grants; previews and server render handlers cannot. |
| 111 | `createTestWorkspace(app).client()` tests the interactive contract and |
| 112 | `grantedPermissions` simulates revoked consent. |
| 113 |
| 114 | New `tasks`, `calendar`, `messages`, and `references` capabilities require their |
| 115 | explicit manifest permissions and retain the invoking user's workspace access. |
| 116 | Use `files.list({ scope: "workspace" })` for shared files; document writes stay |
| 117 | with the owning app. Collections are install-private. A native mobile React runtime is separate |
| 118 | work; Coline Code builds and publishes apps (see `docs/sdk/full-stack.md`). |
| 119 |
| 120 | ### Live data |
| 121 |
| 122 | `useLiveCollection<RecordType>("collection", { where, orderBy, limit })` returns |
| 123 | `records`, `pending`, `status`, `error`, `nextCursor`, `insert`, `update`, `delete`, |
| 124 | `setAccess`, and `refresh`. Inline query objects are supported. Mutations update |
| 125 | local UI immediately and reject on conflicts or permission failures; catch their |
| 126 | promises to present the error. The hook owns subscription cleanup and reconnect |
| 127 | recovery. Use filtered/paged views (at most 200 records), not an entire workspace |
| 128 | in one hook. Structured-record sync does not imply CRDT text editing or offline |
| 129 | write persistence. |
| 130 |
| 131 | ## Screen patterns |
| 132 |
| 133 | Use `AppPage` and `PageToolbar` for consistent hierarchy, `RecordTable` with |
| 134 | `SplitView`/`DetailPanel` for queues, `Board`/`BoardColumn`/`BoardCard` for stages, |
| 135 | and `SettingsSection` for configuration. `EmptyState`, `AppErrorState`, |
| 136 | `AppLoadingState`, and `StatusBadge` cover common states. Their CSS ships in |
| 137 | `@colineapp/ui/styles.css`; they require no app-side utility generation. |
| 138 |
| 139 | Patterns compose around your domain and capabilities. They do not supply data, |
| 140 | routing, drag-and-drop, or persistence. `RecordTable` provides a first-cell button |
| 141 | when `onOpen` is set (don't nest a second control there); secondary columns hide |
| 142 | at narrow widths. Split details stack on mobile; the app owns focus management. |
| 143 | See the scaffold's `examples/` for complete interactive references. |
| 144 |
| 145 | ## Shared controls and motion (0.4.1) |
| 146 |
| 147 | `Tabs` uses the same raised selection as Coline and Upstream. Selection springs |
| 148 | and content transitions are automatic; no indicator or animation wrapper is |
| 149 | required. Each tabs group owns its indicator so multiple groups never collide. |
| 150 | `TabsIndicator` remains available for existing custom compositions. |
| 151 |
| 152 | ```tsx |
| 153 | <Tabs defaultValue="inbox"> |
| 154 | <TabsList aria-label="Views"> |
| 155 | <TabsTrigger value="inbox">Inbox</TabsTrigger> |
| 156 | <TabsTrigger value="roadmap">Roadmap</TabsTrigger> |
| 157 | </TabsList> |
| 158 | <TabsContent value="inbox">{/* Inbox */}</TabsContent> |
| 159 | <TabsContent value="roadmap">{/* Roadmap */}</TabsContent> |
| 160 | </Tabs> |
| 161 | <FilterMenu |
| 162 | aria-label="Filter by status" |
| 163 | value={status} |
| 164 | onValueChange={setStatus} |
| 165 | options={[{ value: "all", label: "All statuses" }, { value: "planned", label: "Planned" }]} |
| 166 | /> |
| 167 | ``` |
| 168 |
| 169 | `FilterMenu` composes the exact Coline `DropdownMenu` radio group, surface, and |
| 170 | sliding highlight. Use `DropdownMenu` directly for action menus. `PageToolbar` |
| 171 | is borderless. `RecordTable` uses separated, rounded selection/hover rows. |
| 172 | Dialogs and menus include their animation CSS; the provider respects reduced |
| 173 | motion, including portals. Buttons default to `type="button"`; use |
| 174 | `type="submit"` for a form's submit action. |
| 175 |
| 176 | Use component defaults rather than copying their CSS into the app. Custom CSS |
| 177 | variables scoped to `AppPage` do not reach portalled dialogs/menus. Keep decorative |
| 178 | app variables at `:root` when they must cross portals, and retain host theme tokens. |
| 179 | App bundles include their dependencies: upgrade, rebuild and push to adopt a UI |
| 180 | release. Updating npm does not rewrite already-published app bundles. |
| 181 |
| 182 | Maintainers: run `pnpm --filter @colineapp/ui build` before source-based AX |
| 183 | fixtures. The stylesheet is generated; published installs already include it. |
| 184 | The build checks the canonical dropdown and its shared style helpers for parity. |
| 185 |
| 186 | The stylesheet includes the Latin Geist variable font and its SIL Open Font |
| 187 | License in `dist/fonts`. The CLI embeds the font in the app bundle, so sandbox |
| 188 | text uses Coline typography without remote font requests. Other scripts use the |
| 189 | system fallback. Keep font assets and their license in release tarballs. |
| 190 |
| 191 | ## UI 0.6 |
| 192 |
| 193 | Rebuilt on host tokens with one motion vocabulary (`transitions`, |
| 194 | `staggerDelay`; `motion` and `AnimatePresence` are re-exported) and |
| 195 | reduced-motion support. New components: `DataGrid`, `KanbanBoard`, charts |
| 196 | (`LineChart`, `AreaChart`, `BarChart`, `DonutChart`, `Sparkline`), `Stat`, |
| 197 | `StatGrid`, `AnimatedNumber`, `PropertyList`, `Timeline`, `Steps`, |
| 198 | `Pagination`, `Breadcrumbs`, `Calendar`, `DatePicker`, `CommandList`, |
| 199 | `Combobox`, `SegmentedControl`, `RadioGroup`, `SearchInput`, `Accordion`, |
| 200 | `Sheet`, `Banner`, `Presence`, `Avatar`, `AvatarGroup`, `Spinner`, `Kbd`, |
| 201 | `FilePreview`, `FileDropzone`, `SaveAsButton`, `ConnectButton`, |
| 202 | `ConfirmButton`. Hooks: `useColineMutation`, `useJob`, `useConnection`, |
| 203 | `useDebouncedValue`, `useToast`. Page patterns now use tokens and animation; |
| 204 | `patterns.css` is gone. Status colors are `positive`, `attention`, `risk`, |
| 205 | `action`, and `chart-1`…`chart-5`. |
| 206 |