Skip to content

The agent that grows with you

feat(ui): shared Reel, Masonry and Button chip variant for catalog surfaces

brooklyn!8cc66a792316
diff --git a/apps/desktop/DESIGN.md b/apps/desktop/DESIGN.md
index d1b3a6c09d3..775fc9e5303 100644
--- a/apps/desktop/DESIGN.md
+++ b/apps/desktop/DESIGN.md
@@ -235,6 +235,19 @@ Notes:
`warn`, `destructive`, `outline`, `solid` (primary fill — icon-corner counts).
Sizes: `default`, `xs`, `overlay` (titlebar glyph counts).
+Badges are inert. A metadata chip that does something (filter by category or
+tag, search a platform or tool) is a `Button` `size="xs"`: `chip` for facet
+values (soft fill + a 0.5px inset shadow ring on hover, so no reflow), `ghost`
+for quieter search values. Don't style a Badge to look clickable or add a
+separate chip component.
+
+## Reel
+
+`src/components/ui/reel.tsx`: one horizontal, snap-scrolling row (catalog
+category shelves, screenshot strips). Children keep their width and snap to
+the start; set it once from the parent (`className="*:w-68"`). Use it instead of
+hand-rolling `flex overflow-x-auto snap-x`.
+
## Context-sensitive dialogs
Sudo password dialogs keep the backdrop unblurred (`DialogContent`'s
@@ -243,17 +256,25 @@ password field. Long commands wrap and scroll; missing backend context is
explicit, never inferred from another tool row. Other dialogs retain the shared
blurred backdrop.
+A dialog opened from inside another (an image lightbox over a catalog detail)
+stacks above it automatically, so its backdrop dims the parent too. Media
+viewers use a heavier scrim through `overlayClassName`. Controls that belong to
+the dialog but mustn't scroll with its body (prev/next pagers) go in `chrome`,
+which may sit past the dialog's edges.
+
## Form controls
- **`controlVariants`** (`src/components/ui/control.ts`) is the shared shape for
`Input` / `Textarea` / `SelectTrigger`. New text-entry controls compose it.
- **`SearchField`** — borderless, underline-on-focus, auto-width. The only
search input. Don't build boxed search bars; don't wrap it in a bordered tile.
+ `variant="box"` is the one bordered form: a full-width rounded field for
+ pages where search is the primary affordance (the Skills/Plugins catalogs).
Empty lists hide their search field.
- **`SegmentedControl`** — the choice control for small mutually-exclusive sets
(color mode, tool-call display, usage period). Replaces radio piles and
- pill rows. `iconOnly` retains localized tooltips and accessible names for
- compact layout switches; options without an icon keep their visible label.
+ pill rows. A two-state view switch (list/cards, list/tree) is not a segmented
+ control: it's one ghost `icon-xs` `Button` showing the mode it switches to.
- **`Switch`** (`size="xs"`) — bare, with `aria-label`. No bordered text wrapper.
- **`FanMenu`** (`src/components/ui/fan-menu.tsx`) — one hub control that
fans sibling toggles out on hover: `direction` `vertical` | `horizontal`
@@ -269,6 +290,13 @@ blurred backdrop.
- **Master/detail overlays:** `OverlaySplitLayout` + `OverlaySidebar` /
`OverlayMain`. Cron, profiles, etc. ride this — don't rebuild a titlebar
shell.
+- **Filter rails** reuse the same pieces: `SidebarPanelLabel` (its `meta` slot
+ carries the result count), `SidebarDateDivider` group headings, and `nested`
+ `OverlayNavItem` rows. Facets are multi-select: each row is `pressed`, with a
+ `CheckboxMark` in `leading` (the row is the control; a real `Checkbox` would
+ nest a button), and an "All" row clears the group. No radio glyphs. A text
+ "Clear" sits on the label row while anything is filtered. Cap long facets
+ (tags) to the top values plus the selection; search covers the tail.
- **Settings subpages:** `OverlayNav` keeps navigation and disclosure separate:
labels navigate; the shared `DisclosureCaret` button opens a branch without
changing the page. Active paths reveal automatically, inactive paths stay
@@ -461,6 +489,14 @@ so glass and message-bubble transparency do not reveal scrolling text.
## Direct manipulation & performance
+`Masonry` (`components/ui/masonry.tsx`) packs natural-height cards into responsive
+lanes, using CSS `display: grid-lanes` where supported. Older Electron versions
+use one ResizeObserver and frame-batched placement; child DOM/source order stays
+intact through resizing, media loading, and disclosure. It owns the shared gap;
+`--masonry-min-width` optionally changes the minimum lane width. It knows nothing
+about what it holds: catalog results and discovery shelves opt into their hover
+treatment (sibling dimming, the pointer-following glow) from the catalog's own CSS.
+
The app should feel instant under real load — long transcripts, several panes,
live streams. Design toward that:
diff --git a/apps/desktop/src/components/chat/zoomable-image.tsx b/apps/desktop/src/components/chat/zoomable-image.tsx
index 335aad61fef..75270683cc7 100644
--- a/apps/desktop/src/components/chat/zoomable-image.tsx
+++ b/apps/desktop/src/components/chat/zoomable-image.tsx
@@ -89,6 +89,7 @@ export function ImageLightbox({
<DialogContent
bodyClassName="block overflow-visible p-0"
className="w-auto max-h-[calc(100vh-12rem)] max-w-[calc(100vw-12rem)] border-0 bg-transparent shadow-none"
+ overlayClassName="bg-black/60"
showCloseButton={false}
>
<div className="group/lightbox relative inline-block">
diff --git a/apps/desktop/src/components/ui/button.tsx b/apps/desktop/src/components/ui/button.tsx
index 97fe05a7403..c786df58be6 100644
--- a/apps/desktop/src/components/ui/button.tsx
+++ b/apps/desktop/src/components/ui/button.tsx
@@ -25,6 +25,9 @@ const buttonVariants = cva(
// Soft-fill action (the default "non-primary button" look).
secondary:
'bg-(--ui-bg-quaternary) text-(--ui-text-primary) hover:bg-(--chrome-action-hover) hover:text-(--ui-text-primary)',
+ // Clickable tag/filter chip — the soft fill plus a hairline inset ring on
+ // hover (shadow, not border, so nothing reflows).
+ chip: 'bg-(--ui-bg-quaternary) text-(--ui-text-primary) hover:bg-(--chrome-action-hover) hover:shadow-[inset_0_0_0_0.5px_var(--ui-stroke-secondary)]',
ghost: 'text-(--ui-text-secondary) hover:bg-(--chrome-action-hover) hover:text-(--ui-text-primary)',
grip: 'bg-transparent text-(--ui-text-tertiary) transition-colors hover:text-(--ui-text-secondary) focus-visible:text-(--ui-text-primary)',
// A control floating free of any surface (fan-menu discs, detached
diff --git a/apps/desktop/src/components/ui/checkbox.tsx b/apps/desktop/src/components/ui/checkbox.tsx
index 31c8e356586..19666fcde5b 100644
--- a/apps/desktop/src/components/ui/checkbox.tsx
+++ b/apps/desktop/src/components/ui/checkbox.tsx
@@ -4,11 +4,15 @@ import * as React from 'react'
import { Codicon } from '@/components/ui/codicon'
import { cn } from '@/lib/utils'
+const BOX =
+ 'group peer size-4 shrink-0 rounded-sm border border-input shadow-xs outline-none transition-shadow data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[state=indeterminate]:border-primary data-[state=indeterminate]:bg-primary data-[state=indeterminate]:text-primary-foreground'
+
function Checkbox({ className, ...props }: React.ComponentProps<typeof CheckboxPrimitive.Root>) {
return (
<CheckboxPrimitive.Root
className={cn(
- 'group peer size-4 shrink-0 rounded-sm border border-input shadow-xs outline-none transition-shadow focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[state=indeterminate]:border-primary data-[state=indeterminate]:bg-primary data-[state=indeterminate]:text-primary-foreground aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40',
+ BOX,
+ 'focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40',
className
)}
data-slot="checkbox"
@@ -27,4 +31,19 @@ function Checkbox({ className, ...props }: React.ComponentProps<typeof CheckboxP
)
}
-export { Checkbox }
+/** The Checkbox look without a control, for rows that are themselves the toggle
+ * (a real Checkbox is a button and can't nest inside one). */
+function CheckboxMark({ checked, className }: { checked: boolean; className?: string }) {
+ return (
+ <span
+ aria-hidden
+ className={cn(BOX, 'grid place-items-center', className)}
+ data-slot="checkbox-mark"
+ data-state={checked ? 'checked' : 'unchecked'}
+ >
+ {checked && <Codicon name="check" size="0.875rem" />}
+ </span>
+ )
+}
+
+export { Checkbox, CheckboxMark }
diff --git a/apps/desktop/src/components/ui/dialog.tsx b/apps/desktop/src/components/ui/dialog.tsx
index 1acd8d62b05..9f538131d10 100644
--- a/apps/desktop/src/components/ui/dialog.tsx
+++ b/apps/desktop/src/components/ui/dialog.tsx
@@ -78,10 +78,17 @@ function DialogContent({
blurBackdrop = true,
banner,
bannerTone = 'error',
+ chrome,
+ overlayClassName,
onOpenAutoFocus,
...props
}: React.ComponentProps<typeof DialogPrimitive.Content> & {
showCloseButton?: boolean
+ // Backdrop skin, e.g. a heavier scrim for media viewers.
+ overlayClassName?: string
+ // Controls pinned to the shell rather than the scrolling body (e.g. prev/next
+ // pagers). The shell doesn't clip, so these may sit past its edges.
+ chrome?: React.ReactNode
// Keep the underlying task readable for context-sensitive prompts.
blurBackdrop?: boolean
// Size the dialog to its content (capped at the viewport) instead of the
@@ -111,6 +118,17 @@ function DialogContent({
// the node mounts.
const [contentNode, setContentNode] = React.useState<HTMLElement | null>(null)
+ // Opened from inside another dialog (e.g. an image lightbox over a detail
+ // modal): both layers step above the parent so its scrim dims the parent too.
+ // Shared z tokens alone would slot this backdrop under the parent's content.
+ const nested = React.useContext(DialogPortalContainerContext) !== null
+
+ const overlay = (
+ <DialogOverlay blur={blurBackdrop} className={cn(nested && 'z-[calc(var(--z-modal)+1)]', overlayClassName)} />
+ )
+
+ const layerClass = nested && 'z-[calc(var(--z-modal)+2)]'
+
// No default here — Radix's normal autofocus (first focusable element, often
// an input) is what most dialogs want. Dialogs with no input should pass
// `onOpenAutoFocus={preventCloseButtonAutoFocus}` explicitly instead.
@@ -137,7 +155,7 @@ function DialogContent({
if (banner) {
return (
<DialogPortal>
- <DialogOverlay blur={blurBackdrop} />
+ {overlay}
<DialogPrimitive.Content
className={cn(
// The same split as the plain variant. The shell must not clip,
@@ -145,6 +163,7 @@ function DialogContent({
// below has its own `overflow-hidden`, which rounds its corners.
'fixed left-1/2 top-1/2 z-(--z-modal) pointer-events-auto flex max-h-[85vh] -translate-x-1/2 -translate-y-1/2 flex-col rounded-xl bg-(--ui-chat-bubble-background) text-[length:var(--conversation-text-font-size)] text-foreground shadow-nous duration-200 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95',
widthClass,
+ layerClass,
className,
// Callers often pass `gap-*` for the no-banner grid layout — suppress
// it here so the banner can tuck under the body's rounded bottom edge.
@@ -179,6 +198,7 @@ function DialogContent({
>
{banner}
</div>
+ {chrome}
{closeButton}
</DialogPortalContainerContext.Provider>
</DialogPrimitive.Content>
@@ -188,7 +208,7 @@ function DialogContent({
return (
<DialogPortal>
- <DialogOverlay blur={blurBackdrop} />
+ {overlay}
<DialogPrimitive.Content
className={cn(
// The SHELL: position, size, and skin. It has no overflow of its own,
@@ -199,6 +219,7 @@ function DialogContent({
// past the edge of that box.
'fixed left-1/2 top-1/2 z-(--z-modal) pointer-events-auto flex max-h-[85vh] -translate-x-1/2 -translate-y-1/2 flex-col rounded-xl border border-(--stroke-nous) bg-(--ui-chat-bubble-background) text-[length:var(--conversation-text-font-size)] text-foreground shadow-nous duration-200 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95',
widthClass,
+ layerClass,
className
)}
data-slot="dialog-content"
@@ -222,6 +243,7 @@ function DialogContent({
>
{children}
</div>
+ {chrome}
{closeButton}
</DialogPortalContainerContext.Provider>
</DialogPrimitive.Content>
diff --git a/apps/desktop/src/components/ui/masonry.css b/apps/desktop/src/components/ui/masonry.css
new file mode 100644
index 00000000000..085e6e952e1
--- /dev/null
+++ b/apps/desktop/src/components/ui/masonry.css
@@ -0,0 +1,21 @@
+.masonry {
+ position: relative;
+ display: grid;
+ grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--masonry-min-width, 17rem)), 1fr));
+ align-items: start;
+ gap: calc(var(--spacing) * 3);
+}
+
+.masonry > [data-slot='masonry-item'] {
+ min-width: 0;
+}
+
+.masonry[data-measured] > [data-slot='masonry-item'] {
+ position: absolute;
+}
+
+@supports (display: grid-lanes) {
+ .masonry {
+ display: grid-lanes;
+ }
+}
diff --git a/apps/desktop/src/components/ui/masonry.tsx b/apps/desktop/src/components/ui/masonry.tsx
new file mode 100644
index 00000000000..f630ec80322
--- /dev/null
+++ b/apps/desktop/src/components/ui/masonry.tsx
@@ -0,0 +1,100 @@
+import './masonry.css'
+
+import { Children, type ComponentProps, useLayoutEffect, useRef } from 'react'
+
+import { cn } from '@/lib/utils'
+
+/** Native grid lanes when available; measured lanes for older Electron releases.
+ * Children stay in source order and never move between React parents. */
+export function Masonry({ children, className, ...props }: ComponentProps<'div'>) {
+ const root = useRef<HTMLDivElement>(null)
+
+ useLayoutEffect(() => {
+ const node = root.current
+
+ if (!node || CSS.supports('display', 'grid-lanes')) {
+ return
+ }
+
+ const items = Array.from(node.children) as HTMLElement[]
+ let frame = 0
+ let disposed = false
+
+ const layout = () => {
+ frame = 0
+
+ if (disposed || !node.clientWidth) {
+ return
+ }
+ const style = getComputedStyle(node)
+ const tracks = style.gridTemplateColumns.split(' ').map(Number.parseFloat)
+
+ if (!tracks.length || tracks.some(width => !Number.isFinite(width))) {
+ return
+ }
+ const gap = Number.parseFloat(style.columnGap) || 0
+ const width = tracks[0]
+ const widthValue = `${width}px`
+
+ // Write widths together before measuring wrapping. No React state updates,
+ // window resize listeners, or per-item read/write alternation.
+ for (const item of items) {
+ if (item.style.width !== widthValue) {
+ item.style.width = widthValue
+ }
+ }
+
+ const heights = items.map(item => item.getBoundingClientRect().height)
+ const lanes = tracks.map(() => 0)
+
+ const placements = heights.map(height => {
+ const lane = lanes.indexOf(Math.min(...lanes))
+ const top = lanes[lane]
+ lanes[lane] += height + gap
+
+ return { top, left: lane * (width + gap) }
+ })
+
+ node.dataset.measured = ''
+ items.forEach((item, index) => {
+ item.style.insetInlineStart = `${placements[index].left}px`
+ item.style.insetBlockStart = `${placements[index].top}px`
+ })
+ const height = `${Math.max(0, ...lanes) - (items.length ? gap : 0)}px`
+
+ if (node.style.height !== height) {
+ node.style.height = height
+ }
+ }
+
+ const schedule = () => {
+ if (!frame) {
+ frame = requestAnimationFrame(layout)
+ }
+ }
+
+ const observer = new ResizeObserver(schedule)
+ observer.observe(node)
+ items.forEach(item => observer.observe(item))
+ layout()
+
+ return () => {
+ disposed = true
+ observer.disconnect()
+ cancelAnimationFrame(frame)
+ delete node.dataset.measured
+ node.style.removeProperty('height')
+ items.forEach(item => {
+ item.style.removeProperty('width')
+ item.style.removeProperty('inset-inline-start')
+ item.style.removeProperty('inset-block-start')
+ })
+ }
+ }, [children])
+
+ return (
+ <div {...props} className={cn('masonry', className)} data-slot="masonry" ref={root}>
+ {Children.map(children, child => child && <div data-slot="masonry-item">{child}</div>)}
+ </div>
+ )
+}
diff --git a/apps/desktop/src/components/ui/reel.tsx b/apps/desktop/src/components/ui/reel.tsx
new file mode 100644
index 00000000000..4cbe595045e
--- /dev/null
+++ b/apps/desktop/src/components/ui/reel.tsx
@@ -0,0 +1,18 @@
+import type { ComponentProps } from 'react'
+
+import { cn } from '@/lib/utils'
+
+/** One row that scrolls sideways, snapping each child to the start edge.
+ * Children keep their own width; set it from the caller (`*:w-68`). */
+export function Reel({ className, ...props }: ComponentProps<'div'>) {
+ return (
+ <div
+ {...props}
+ className={cn(
+ 'flex snap-x snap-mandatory gap-3 overflow-x-auto overscroll-x-contain pb-2 *:shrink-0 *:snap-start',
+ className
+ )}
+ data-slot="reel"
+ />
+ )
+}
diff --git a/apps/desktop/src/components/ui/search-field.tsx b/apps/desktop/src/components/ui/search-field.tsx
index a2c02d38a16..c7f6ea68f5a 100644
--- a/apps/desktop/src/components/ui/search-field.tsx
+++ b/apps/desktop/src/components/ui/search-field.tsx
@@ -23,6 +23,13 @@ interface SearchFieldProps {
onClear?: () => void
inputRef?: RefObject<HTMLInputElement | null>
trailingAction?: ReactNode
+ /**
+ * `underline` (default) recedes into chrome — sidebars, page headers.
+ * `box` is a standalone pill — visible stroke + quinary fill, the recipe
+ * the Appearance theme search uses — for when search IS the page's primary
+ * affordance, e.g. above a catalog grid.
+ */
+ variant?: 'underline' | 'box'
'aria-label'?: string
}
@@ -43,10 +50,12 @@ export function SearchField({
onClear,
inputRef,
trailingAction,
+ variant = 'underline',
'aria-label': ariaLabel
}: SearchFieldProps) {
const { t } = useI18n()
const clear = onClear ?? (() => onChange(''))
+ const boxed = variant === 'box'
// One hint per mount, picked at random — fresh nudge every visit, no
// mid-page carousel.
@@ -60,13 +69,18 @@ export function SearchField({
// min-w-0 is load-bearing: without it the content-sized input sets the
// container's flex min-width and the field bulldozes its siblings
// instead of shrinking to fit its context.
- 'inline-flex min-w-0 max-w-full items-center gap-1.5 border-b border-transparent px-0.5 transition-[color,border-color,opacity]',
- // Recede until the user reaches for it.
- !value && 'opacity-30 focus-within:opacity-100',
+ 'inline-flex min-w-0 max-w-full items-center gap-1.5 transition-[color,border-color,opacity]',
+ boxed
+ ? 'w-full gap-2 rounded-full border border-(--ui-stroke-tertiary) bg-(--ui-bg-quinary) px-3.5 py-2 hover:border-(--ui-stroke-secondary) focus-within:border-(--ui-stroke-secondary)'
+ : cn(
+ 'border-b border-transparent px-0.5',
+ // Recede until the user reaches for it.
+ !value && 'opacity-30 focus-within:opacity-100'
+ ),
containerClassName
)}
>
- <Search className="pointer-events-none size-3.5 shrink-0 text-muted-foreground/70" />
+ <Search className={cn('pointer-events-none shrink-0 text-muted-foreground/70', boxed ? 'size-4' : 'size-3.5')} />
<input
aria-label={ariaLabel ?? placeholder}
className={cn(
@@ -75,6 +89,9 @@ export function SearchField({
// context is narrower — long queries scroll inside the field.
// text-xs matches the form controls (Input/Select via controlVariants).
'h-7 min-w-0 max-w-full bg-transparent text-xs text-foreground [field-sizing:content] placeholder:text-muted-foreground focus:outline-none',
+ // Boxed: the wrapper owns the chrome, the input fills it (same as an
+ // adorned Input).
+ boxed && 'h-auto w-full flex-1 text-sm leading-5 [field-sizing:initial]',
inputClassName
)}
onChange={event => onChange(event.target.value)}