kitchen-ui
The shared UI of the neuro-kitchen apps, for desktop apps built on GPUI through gpui-kit:
- Design tokens:
- spacing on an 8 px grid;
- a type scale on a 15 px base;
- radii by size and gaps between panes;
- plain grey neutrals for light and dark themes, plus status colours.
- Accents:
- each app supplies a default palette (
Palette::LIMEfor dsp-kitchen,Palette::TEALfor lucem,Palette::PAPRIKA,Palette::AMBER,Palette::COBALT, or its own); - the user can pick any colour instead.
Palette::from_rgbkeeps its hue and changes only its lightness until text, fills and marks pass WCAG contrast in both themes (in the dark theme it also makes the colour less saturated).
- each app supplies a default palette (
- Widgets: accent picker, titled section, labelled row (the control drops under its label when the panel is narrow), slider, dropdown, stepper, dragged number, colour swatch, empty state, icon button.
- Text views:
CodeView: code in gpui-kit's editor (line numbers, Rust, Python and JSON highlighting, current line, selection and copy), read-only or editable, errors marked on their lines;DiffView: a git-style diff of two texts (old and new line numbers, hunks, unchanged runs folded), or of two JSON documents compared by key with long arrays as one summary line; optional Accept / Reject per hunk for reviewing a proposed change (diffholds the model);TextView: wrapped, selectable light markdown (headings,code, lists, fenced code).
- Chat pane (
chat::ChatPane): an agent conversation (user, agent and tool-call rows, agent text streaming in) and a prompt box with context chips. It holds no agent: it emitsSendandStop, the app pushes messages in, and the conversation is plain serializable data. - Table (
table::TableView): plain columns in (numbers or text; a kitchen-table table through thekitchen-tablefeature), a header that sorts and resizes, a column summary that folds down, virtual rows. Options, each off by default (TableOptions,TableStyle):- row marks (a colour per row, a dot before the first column);
- a toolbar line: a filter menu on one text column ("All labels ▾"), the row and selection counts;
- row selection, single or multiple (click, shift, ctrl or cmd), reported as an event;
- bar cells: a number column drawn as an in-cell bar over its range, in the row's colour or the accent;
- compact (no header, few columns: a side list);
- the summary open, folded or off;
- theming: density, stripes or grid lines, header style, mono or proportional numbers and text, selection and hover colours, bar colour; the default follows the app's theme.
- Parameter editor: edits any op that serialises to a JSON object. Numbers become inputs, choices become menus and switches become checkboxes.
- Icons:
AppAssetsships gpui-kit's icons plus the ones an app adds;assert_icons_bundledis a test helper that scans an app's sources for every icon name it uses (aliases included) and fails if any of them is not shipped.
Usage
use ;
use ;
application.with_assets.run;
// In a view's render:
new.child;
Gallery
cargo run -p kitchen-ui --example gallery (in the repository) opens a window showing every
widget and token, on five pages:
- Widgets: the labelled rows in a wide pane and a narrow one; a boxed section and icon buttons; the parameter editor on a demo band filter; an empty state; every colour token with its hex value, the type scale and the spacing scale;
- Code and diffs: a Rust snippet with an error mark, an editable Python script, markdown
notes, a
session.jsondiff to accept or reject hunk by hunk, a text diff; - Chat: a short conversation with a tool call, and buttons standing in for an agent;
- Timeline: a morning's work summarised into episodes;
- Table: a sorting's 279 units (row marks in each unit's colour, a filter on the label, selection, amplitude as a bar, the summary folded) and a compact "Similar units" list for the unit selected, the similarity as a bar.
Its header switches the page, dark and light, the app palette, the accent (suggested swatches or any colour) and the text size. A headless test draws the gallery in every look, reviews a diff, sends a prompt and selects units in the table.
Licence
MIT OR Apache-2.0, at your option: LICENSE-MIT, LICENSE-APACHE.