Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(quill): consumer guides, alert dialog, button loading, menu fixes (#63190)

Adam Leith655c1822447a
diff --git a/.github/scripts/verify-storybook-new-stories.sh b/.github/scripts/verify-storybook-new-stories.sh
index 6802c6e7d363..dfa5ef0e4492 100755
--- a/.github/scripts/verify-storybook-new-stories.sh
+++ b/.github/scripts/verify-storybook-new-stories.sh
@@ -33,14 +33,24 @@ if [ -z "$changed_story_files" ]; then
exit 0
fi
-# Filter to files that still exist (skip deleted).
+# Filter to files that still exist (skip deleted) and that the main storybook app
+# actually serves — must mirror the `stories` globs in common/storybook/.storybook/main.ts.
+# Stories from other storybook apps (e.g. packages/quill/apps/storybook) aren't in the
+# test runner's testMatch, so including them makes Jest exit 1 with "No tests found".
declare -a stories_to_verify=()
while IFS= read -r story_file; do
if [ ! -f "$story_file" ]; then
echo "Skipping $story_file (deleted)"
continue
fi
- stories_to_verify+=("$story_file")
+ case "$story_file" in
+ frontend/src/* | products/*/frontend/* | products/*/mcp/* | packages/quill/packages/charts/src/*)
+ stories_to_verify+=("$story_file")
+ ;;
+ *)
+ echo "Skipping $story_file (not served by the main storybook app)"
+ ;;
+ esac
done <<< "$changed_story_files"
if [ ${#stories_to_verify[@]} -eq 0 ]; then
diff --git a/AGENTS.md b/AGENTS.md
index 4ed55a8e2f1c..be10dabc736a 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -121,6 +121,8 @@ See [.agents/security.md](.agents/security.md) for SQL, HogQL, and semgrep secur
- Python imports: keep imports at module level — not inside functions, methods, or conditionals. Inline imports hide dependencies from static analysis, slow hot paths with repeated lookups, and mask circular-import problems instead of fixing them; ruff's `PLC0415` enforces this. Defer an import only to (1) break a true unavoidable circular import (fix the structure first if you can), (2) reference types under `TYPE_CHECKING`, or (3) keep a heavy/optional dependency off the import path so it loads only when its code runs. For (3), add a justified `# noqa: PLC0415` on the import line (e.g. `# noqa: PLC0415 — keeps the heavy dep off the import path`) — never blanket-suppress the rule
- Frontend: TypeScript required, explicit return types
- Frontend: If there is a kea logic file, write all business logic there, avoid React hooks at all costs.
+- Frontend (quill design system): before writing UI that imports `@posthog/quill` / `lib/ui/quill`, read [packages/quill/packages/primitives/AGENTS.md](packages/quill/packages/primitives/AGENTS.md) — component choice (dropdown vs select vs combobox, accordion vs collapsible, etc.), composition, and spacing rules. Charts: [packages/quill/packages/charts/AGENTS.md](packages/quill/packages/charts/AGENTS.md); DataTable/DateTimePicker: [packages/quill/packages/components/AGENTS.md](packages/quill/packages/components/AGENTS.md)
+- Frontend (quill vs LemonUI): LemonUI is the default in the main app. Use quill for menus, comboboxes, and autocompletes (`DropdownMenu`, `Combobox`, `Autocomplete` from `@posthog/quill`), with the trigger styled to match the surrounding scene's existing UI (LemonButton / ButtonPrimitive). Don't add new `LemonMenu` or `lib/ui/DropdownMenu` (Radix) menus — those are legacy. Don't mix quill and Lemon components within one component's internals. Quill uses Base UI's `render` prop, not Radix's `asChild` — don't carry `asChild` over when converting
- Frontend: Any button or form submit that triggers a network request must guard against double-submission — disable the button and show a loading state (`loading` / `disabledReason` on `LemonButton`, or equivalent) while the request is in flight. Never leave a submit button clickable during an active mutation; reset the state in both success and error paths. This applies to `<form onSubmit>` handlers, `onClick` handlers that call `api.*`, and any kea `listener` that issues a request — wire the in-flight state (loader `*Loading` selectors, local `useState`, or a reducer) into the trigger's disabled/loading props.
- Imports: Use oxfmt import sorting (automatically runs on format), avoid direct dayjs imports (use lib/dayjs)
- CSS: Use tailwind utility classes instead of inline styles
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index 63c67b4ae829..8eb167b9fb27 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -2113,9 +2113,9 @@ snapshots:
filters-taxonomic-filter--three-groups-default-layout--light:
hash: v1.k794b7964.7d03de4d736f21437d1009fc19719734175f0c0822cd2ccdbc380ffa8f5e627c.lGDn7Z4UhsMOqLuuLQ9_TO9FuIbd45s3RKUs7A69z7s
filters-taxonomic-filter-menu-rebuild--data-warehouse-config--dark:
- hash: v1.k794b7964.c09183f21589b0f11a3013a6e359d23c8d5b17b1e6ed61476ba45da75bcdc73f.tzexSMIoGf0LgGmzdG3-O0g7vd9Isx6MRQ_TWltg4Fo
+ hash: v1.k794b7964.61be2aec314f24a2a2c0a7a4faa1bd26e03544fbb57c33e5442a2f8abac5f4b2.YmOETQ3Yvu-wJftFxEn54OYXueKU6Ppo9pHnx2itpKk
filters-taxonomic-filter-menu-rebuild--data-warehouse-config--light:
- hash: v1.k794b7964.36ea70583a6f09a4c2c1e8df79a1e5a4670dffa2bd3e83ff3c5cc7d7bfc8460a.VKeT4L01rkXtfdtBZxGy0swHFqxkuDO_LXzh04f1YGs
+ hash: v1.k794b7964.865f2c1d5b304c7267d14c1c0b36f283d8f1d004c5c577505bdd83874ddbbdc5.l3aN8SkWTC3GdoKxQ9tsSv-ozOv9ejOK-R-pEzvXahY
filters-taxonomic-filter-menu-rebuild--events-and-actions--dark:
hash: v1.k794b7964.658adcb2dd4233e9fbfe4a8c62759a6e8fe9619fe22141e691b8ab7e421ebce8.JXXooKz-3MXbjt8D2MNdWnb9xYSJD_ZglAdj1gZbZc4
filters-taxonomic-filter-menu-rebuild--events-and-actions--light:
diff --git a/package.json b/package.json
index 1ce26ac6e20e..310e4c53c432 100644
--- a/package.json
+++ b/package.json
@@ -83,6 +83,7 @@
"lint-staged": {
".claude/settings.json": "sh -c 'printf \"\\n\\033[31mDo not commit .claude/settings.json — personal permissions belong in .claude/settings.local.json (gitignored).\\nUnstage with: git restore --staged .claude/settings.json\\033[0m\\n\\n\" >&2 && exit 1'",
".claude/hooks/**": "sh -c 'printf \"\\n\\033[33mWarning: hooks in .claude/ are reserved for env bootstrapping (SessionStart only).\\nPrefer skills, AGENTS.md instructions, or lint-staged rules. See Agent automation in AGENTS.md.\\033[0m\\n\\n\"'",
+ "packages/quill/packages/*/src/**/*.{ts,tsx,css}": "sh -c 'git diff --cached --name-only | grep -q \"^packages/quill/.*AGENTS\\\\.md$\" || printf \"\\n\\033[33mWarning: quill component sources changed without an AGENTS.md update.\\nIf variants, composition, or spacing changed, update the consumer guide (packages/quill/packages/<pkg>/AGENTS.md) in the same PR.\\033[0m\\n\\n\"'",
"products/**/manifest.tsx": [
"bin/hogli format:js",
"sh -c 'pnpm build:products && git add frontend/src/products.tsx frontend/src/products.json'"
diff --git a/packages/quill/AGENTS.md b/packages/quill/AGENTS.md
index 472afec8c5d5..fb2ff3a9d5a2 100644
--- a/packages/quill/AGENTS.md
+++ b/packages/quill/AGENTS.md
@@ -53,7 +53,7 @@ const buttonVariants = cva('inline-flex items-center ...', {
variant: {
default: 'bg-secondary ...',
outline: 'border-foreground/10 ...',
- ghost: 'hover:bg-accent/40 ...',
+ destructive: 'bg-destructive ...',
},
size: {
default: 'h-7 px-2 text-xs',
@@ -97,7 +97,7 @@ Components that need `forwardRef`:
```text
Button
├── Chip (default size=sm, variant=outline)
-├── ChipClose (variant=ghost, size=icon-xs)
+├── ChipClose (size=icon-xs)
├── InputGroupButton
├── TabsTrigger (render prop)
├── CollapsibleTrigger (render prop)
@@ -110,7 +110,7 @@ Input
InputGroup
├── ComboboxInput (with anchor context)
-└── CommandInput
+└── AutocompleteInput (with anchor context)
Chip + ChipClose
└── ComboboxChip (via render prop)
@@ -129,11 +129,13 @@ ButtonGroup
4. Define variants with CVA if the component has visual variants
5. Accept `className` prop and merge with `cn()`
6. Export from the component file (barrel export is in `index.ts`)
+7. Update the consumer guide in the same PR — `packages/primitives/AGENTS.md` (catalog row, "Choosing a component" cluster, composition pattern). Same rule applies to `packages/components/AGENTS.md` and `packages/charts/AGENTS.md` for their packages. A lint-staged warning fires if quill sources change without an AGENTS.md update
### Styling rules
- Use Tailwind utility classes exclusively — no inline styles, no CSS modules
- Use semantic color tokens: `bg-primary`, `text-foreground`, `border-input` — never raw colors
+- Components that accept icon children own their icon sizing — `flex-shrink: 0` plus a `svg:not([class*='size-'])` size rule in the component's `.css` file (see `button.css`), so consumers drop in bare lucide icons without `size-*` classes; the `:not` guard keeps explicit `size-*` as a deliberate escape hatch
- Use `group/name` for scoped parent selectors (e.g., `group/tabs`, `group/input-group`)
- Use `data-[variant=...]` selectors for variant-aware child styling
- Focus states: `focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30`
@@ -195,10 +197,7 @@ function Parent({ children }) {
| `class-variance-authority` | Type-safe variant class maps |
| `clsx` + `tailwind-merge` | Class merging without conflicts |
| `lucide-react` | Icons |
-| `vaul` | Drawer primitive |
| `react-resizable-panels` | Resizable panel layout |
-| `cmdk` | Command palette |
-| `sonner` | Toast notifications |
## Token system
diff --git a/packages/quill/apps/storybook/.storybook/preview.tsx b/packages/quill/apps/storybook/.storybook/preview.tsx
index a7b349b79284..120adcb284d0 100644
--- a/packages/quill/apps/storybook/.storybook/preview.tsx
+++ b/packages/quill/apps/storybook/.storybook/preview.tsx
@@ -48,6 +48,15 @@ const preview: Preview = {
docs: {
container: ThemedDocsContainer,
},
+ options: {
+ // Deterministic sidebar: without this, order is file-discovery
+ // order, and the dev server appends newly created story files to
+ // the end of the live index until a restart.
+ storySort: {
+ order: ['Tokens', 'Examples', 'Primitives', 'Components'],
+ method: 'alphabetical',
+ },
+ },
},
decorators: [
// Hooks must run at the decorator's top level — Storybook's preview
diff --git a/packages/quill/packages/blocks/AGENTS.md b/packages/quill/packages/blocks/AGENTS.md
index e69de29bb2d1..18aa6614d51c 100644
--- a/packages/quill/packages/blocks/AGENTS.md
+++ b/packages/quill/packages/blocks/AGENTS.md
@@ -0,0 +1,7 @@
+# Blocks — Agent Reference
+
+`@posthog/quill-blocks` is the product-level patterns layer of quill (tokens > primitives > components > blocks). It is currently an empty placeholder — `src/index.ts` exports nothing so downstream `export *` re-exports keep working while the layer is unimplemented.
+
+Do not add components here without checking the layering: reusable UI built only on Base UI belongs in `primitives`; compositions of primitives with logic (data wiring, state machines) belong in `components`; blocks are reserved for opinionated, product-shaped patterns (page headers, settings panels, command palettes).
+
+When the first block lands, replace this file with a consumer guide following the structure of `../primitives/AGENTS.md`.
diff --git a/packages/quill/packages/charts/AGENTS.md b/packages/quill/packages/charts/AGENTS.md
new file mode 100644
index 000000000000..32cc29ca1c3d
--- /dev/null
+++ b/packages/quill/packages/charts/AGENTS.md
@@ -0,0 +1,73 @@
+# Charts — Agent Reference
+
+Quick-reference for AI agents using `@posthog/quill-charts`. Canvas-rendered charts, themed via quill design tokens. Ships no CSS — colors come from CSS variables at runtime.
+
+## Choosing a chart
+
+| Chart | Use when |
+| ------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
+| LineChart | Categorical x-axis trends; area fills, fill-between (confidence ribbons) |
+| BarChart | Categorical comparisons — `barLayout: 'stacked' \| 'grouped' \| 'percent'`, `axisOrientation: 'horizontal'` for horizontal bars |
+| TimeSeriesLineChart | Time-indexed labels (ISO strings) with timezone/interval-aware x-axis |
+| TimeSeriesBarChart | Same x-axis handling, bar rendering; supports per-series `yAxisId` axes |
+| PieChart | Part-of-whole, one value per series; `innerRadiusRatio` for donut + `centerLabel` |
+| BoxPlot | Distribution summaries — `{ min, p25, median, mean, p75, max }` per label |
+| Sparkline | Tiny inline trend from a flat `number[]` — no axes, no series structure |
+| MetricCard | Headline number + sparkline + change pill (dashboard stat tiles) |
+
+## Theme wiring
+
+```tsx
+import { useChartTheme } from '@posthog/quill-charts'
+
+const theme = useChartTheme() // reads CSS vars, tracks light/dark switches
+<LineChart series={series} labels={labels} theme={theme} />
+```
+
+- Series colors come from `--data-color-1..15` (ordered categorical palette from `@posthog/quill-tokens`); chrome from `--color-graph-axis-label` / `--color-graph-axis-line` / `--color-graph-crosshair`.
+- `themeFromCssVars()` is the one-shot non-hook version; `DEFAULT_CHART_COLORS` is the no-DOM fallback (kept in sync with tokens by a CI-enforced test).
+- Omit `color` on a series to get palette assignment by index — preferred. Explicit `color` accepts hex or `var(--...)`.
+
+## Series shape (all multi-series charts)
+
+```tsx
+const series: Series[] = [
+ { key: 'visits', label: 'Visits', data: [20, 35, 28] }, // data.length === labels.length
+ { key: 'goal', label: 'Goal', data: [30, 30, 30], overlay: true }, // excluded from stacking
+]
+```
+
+- `key` (React key + stacking identity), `label` (legend/tooltip), `data` are required.
+- Line-only options: `points`, `stroke.pattern` (dashes/projections), `fill.opacity` / `fill.gradient` (area), `fill.lowerData` (ribbon).
+- `yAxisId` scales a series against a second axis; `meta` carries arbitrary data into tooltips.
+
+## Sizing
+
+Charts fill their container and need a parent with real dimensions — a `0`-height flex child renders nothing. Give the wrapper an explicit height (`h-64`, `flex-1` in a sized column). Sparkline alone takes `height`/`width` props.
+
+## Composition
+
+```tsx
+<TimeSeriesLineChart
+ series={series}
+ labels={isoLabels}
+ theme={theme}
+ config={{
+ xAxis: { timezone: 'UTC', interval: 'day' },
+ yAxis: { format: 'currency', currency: 'USD' },
+ }}
+>
+ <ReferenceLine value={100} orientation="horizontal" variant="goal" label="Target" />
+ <ValueLabels mode="stack-total" offset={8} />
+</TimeSeriesLineChart>
+```
+
+- Overlays (`ReferenceLine`/`ReferenceLines`, `ValueLabels`, `AxisTitles`) compose as children.
+- `ReferenceLine` variants: `goal` (dashed grey), `alert` (dashed red), `marker` (solid thin).
+- `ValueLabels` formatter gets `(value, seriesIndex, dataIndex, context)`; in percent layouts `value` is a 0–1 fraction — use `context.rawValue` for the original.
+- `Legend` is presentational: pass `items`, `onItemClick`, `hiddenKeys` — filtering series is the caller's state.
+- y-axis `format`: `numeric | short | percentage | percentage_scaled | currency | duration | duration-ms`, plus `prefix`/`suffix`.
+
+## Maintenance
+
+When adding or changing a chart, overlay, or config option, update this guide in the same PR and add a story next to the component.
diff --git a/packages/quill/packages/charts/CLAUDE.md b/packages/quill/packages/charts/CLAUDE.md
new file mode 120000
index 000000000000..47dc3e3d863c
--- /dev/null
+++ b/packages/quill/packages/charts/CLAUDE.md
@@ -0,0 +1 @@
+AGENTS.md
\ No newline at end of file
diff --git a/packages/quill/packages/components/AGENTS.md b/packages/quill/packages/components/AGENTS.md
new file mode 100644
index 000000000000..0edea5fcb3a0
--- /dev/null
+++ b/packages/quill/packages/components/AGENTS.md
@@ -0,0 +1,71 @@
+# Components — Agent Reference
+
+Quick-reference for AI agents using `@posthog/quill-components` — composed components built on quill primitives. For primitive-level guidance (choosing a component, spacing, the `render` prop), read `../primitives/AGENTS.md` first.
+
+## Exports
+
+- `DataTable` — TanStack Table wired onto quill `Table` + `Pagination`
+- `DateTimePicker` — calendar range picker with quick-range presets (`quickRanges`, `CUSTOM_RANGE`)
+- `useCalendar` — headless calendar grid hook (`Day`, `Month` enums)
+
+## DataTable
+
+```tsx
+import { type ColumnDef } from '@tanstack/react-table'
+import { DataTable } from '@posthog/quill-components'
+
+const columns: ColumnDef<Person>[] = [
+ { accessorKey: 'name', header: 'Name', meta: { expand: true } },
+ { accessorKey: 'status', header: 'Status', meta: { align: 'center' } },
+ { accessorKey: 'amount', header: 'Amount', meta: { align: 'right' }, enableSorting: false },
+]
+
+<DataTable
+ columns={columns}
+ data={data}
+ pageSize={10} // omit for an unpaginated table
+ pageSizeOptions={[10, 25, 50]} // renders the per-page selector
+ stickyHeader // or "page" to stick to document scroll
+ fullWidth
+/>
+```
+
+Rules:
+
+- Column defs are standard TanStack `ColumnDef`s; quill-specific options go in `meta`: `align: 'left' | 'center' | 'right'` (header + cells) and `expand: true` (absorb leftover width).
+- `fullWidth` needs exactly one column with `meta: { expand: true }` to decide which column stretches.
+- Sorting is client-side and on by default — click header toggles asc → desc → off. Opt out per column with `enableSorting: false`.
+- Pagination is opt-in via `pageSize`; the component owns page state and resets to page 0 when `pageSize` changes.
+- Custom empty state via the `empty` prop (ReactNode); default is a minimal "No results".
+- Don't rebuild tables from `Table` primitives when the data is row/column shaped and needs sorting or pagination — that's what DataTable is for. Drop to the `Table` primitive only for fully custom layouts.
+
+## DateTimePicker
+
+```tsx
+import { CUSTOM_RANGE, DateTimePicker, quickRanges } from '@posthog/quill-components'
+;<DateTimePicker
+ value={{ start, end, range: CUSTOM_RANGE }}
+ onApply={(value) => setRange(value)}
+ onCancel={() => close()}
+ minDate={minDate}
+ maxDate={new Date()}
+ dateFormat="MDY" // or 'DMY' | 'YMD'
+ compact // single calendar + horizontal quick ranges
+/>
+```
+
+Rules:
+
+- `value.range` is one of `quickRanges` (15 presets, "Last 5 minutes" → "Last 1 year") or `CUSTOM_RANGE` for manual selection.
+- Changes are staged until `onApply` fires — don't treat intermediate calendar clicks as committed.
+- Dual-calendar layout appears at the `lg` breakpoint unless `compact` forces a single calendar.
+- `minDate`/`maxDate` are day-granular; time inputs are independent of those bounds.
+- `weekStartsOn` affects the calendar grid only, not quick-range math.
+
+## useCalendar
+
+Headless month-grid state for building custom calendar UIs: returns `calendar` (months > weeks > days), view navigation (`viewNextMonth`, `viewToday`, ...), and selection helpers (`select`, `selectRange`, `isSelected`, `toggle`). Selected dates are normalized to midnight. Reach for this only when DateTimePicker doesn't fit.
+
+## Maintenance
+
+When adding or changing a component here, update this guide in the same PR and add a story next to the component.
diff --git a/packages/quill/packages/components/CLAUDE.md b/packages/quill/packages/components/CLAUDE.md
new file mode 120000
index 000000000000..47dc3e3d863c
--- /dev/null
+++ b/packages/quill/packages/components/CLAUDE.md
@@ -0,0 +1 @@
+AGENTS.md
\ No newline at end of file
diff --git a/packages/quill/packages/primitives/AGENTS.md b/packages/quill/packages/primitives/AGENTS.md
index 0805cd300a74..9054ee86c5b6 100644
--- a/packages/quill/packages/primitives/AGENTS.md
+++ b/packages/quill/packages/primitives/AGENTS.md
@@ -5,19 +5,23 @@ Quick-reference for AI agents using `@posthog/quill-primitives`. Show compositio
## Setup
```tsx
-import { ThemeProvider, TooltipProvider } from '@posthog/quill-primitives'
+import { ThemeProvider, ToastProvider, TooltipProvider } from '@posthog/quill-primitives'
function App() {
return (
<ThemeProvider defaultTheme="system">
- <TooltipProvider>
- <YourApp />
- </TooltipProvider>
+ <ToastProvider>
+ <TooltipProvider>
+ <YourApp />
+ </TooltipProvider>
+ </ToastProvider>
</ThemeProvider>
)
}
```
+For RTL apps, wrap with `DirectionProvider` (re-exported from Base UI) — directional pieces (Collapsible chevrons, menu alignment) read it via `useDirection`.
+
---
## The `render` prop
@@ -43,20 +47,101 @@ Base UI automatically merges event handlers, aria attributes, and `data-*` state
---
+## Choosing a component
+
+Pick by intent, not appearance. Each cluster below lists the discriminating question first.
+
+### Menus and pickers
+
+**Is the user performing an action, or choosing a value?** Actions → menu family. Values → picker family.
+
+| Component | Use when | Not for |
+| ------------ | --------------------------------------------------------------------------------------------------------- | ------------------------------------------- |
+| DropdownMenu | Click-triggered list of actions (edit, duplicate, delete, export). Checkbox/radio items for view options. | Choosing a form value — use Select/Combobox |
+| ContextMenu | Same as DropdownMenu but right-click triggered, no visible trigger | Primary navigation (undiscoverable) |
+| Menubar | Persistent horizontal bar of dropdown menus (scene menu bars, File/Edit/View) | A single one-off menu — use DropdownMenu |
+| Select | Pick one value from a short, static list (< ~15 options), no search needed | Long or async lists — use Combobox |
+| Combobox | Pick one or many values from a long/dynamic list, with search. Multi-select renders chips | Action menus |
+| Autocomplete | Search-first text input with suggestions where the typed text itself is the value | Constrained choices — use Select/Combobox |
+
+For a custom menu-like list inside a Popover (when DropdownMenu's open/close semantics don't fit), use `Item variant="menuItem"` with `ItemMenuItem`/`ItemCheckbox`/`ItemRadio` — don't restyle Buttons into menu rows. `MenuLabel` is the shared section-label primitive the menu families render internally (DropdownMenuLabel, ComboboxLabel); it's exported for these custom menu-like lists.
+
+### Disclosure
+
+**One section or a coordinated set? Hiding content or switching between views?**
+
+| Component | Use when |
+| ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| Accordion | A coordinated set of sections (`type="single" collapsible` or `type="multiple"`) — FAQs, grouped settings |
+| Collapsible | One standalone disclosure — "show more", advanced options, tree nodes (`variant="folder"`). For rows where only the chevron should toggle (label is a link, trailing count/actions), use `CollapsibleHeader` + `<CollapsibleTrigger iconOnly>` |
+| Tabs | Exactly one of N views visible at all times; content never fully hidden — `variant="line"` for page-level sections |
+
+### Overlays
+
+**Does it block the page? Does it contain interactive content? Is it anchored to a trigger?**
+
+| Component | Use when |
+| ----------- | --------------------------------------------------------------------------------------------------------------------------------------- |
+| Dialog | Modal, blocking flow — focused forms, multi-step content. `size="wide"`/`"full"` for big content |
+| AlertDialog | Confirmation that must be resolved — destructive/irreversible actions. Backdrop clicks never dismiss, no X button, `role="alertdialog"` |
+| Drawer | Mobile-first slide-up sheet; touch contexts |
+| Popover | Non-modal panel anchored to a trigger, with interactive content (filters, pickers) |
+| Tooltip | Hover-only text hint; never interactive content, never essential information |
+| Toast | Async outcome notification (`toast.success({ title })`) — fire and forget |
+
+### Status and labels
+
+| Component | Use when |
+| --------- | --------------------------------------------------------------------- |
+| Badge | Semantic status text — variants info/warning/success/destructive |
+| Chip | Removable token (selected tags, active filters) — pair with ChipClose |
+| Dot | Tiny presence/status indicator next to text; `pulse` for live state |
+| Kbd | Keyboard shortcut display, with KbdGroup for combos |
+
+### Form controls
+
+| Component | Use when |
+| ----------- | --------------------------------------------------------------------------------- |
+| Checkbox | Independent on/off choices submitted with a form |
+| Switch | Setting that takes effect immediately (no submit) |
+| RadioGroup | One-of-few where all options should be visible (≤ ~5) |
+| Select | One-of-many where options can hide behind a trigger |
+| Toggle | Pressed/unpressed tool state (e.g. bold); ToggleGroup for exclusive or multi sets |
+| NumberField | Numeric input with increment/decrement; Slider when the range matters visually |
+| Textarea | Multi-line free text — a styled `<textarea>`, same conventions as Input |
+
+Always wrap form controls in `Field` (see Composition Patterns below).
+
+### Text
+
+| Component | Use when |
+| --------- | ------------------------------------------------------------------------------------------------------- |
+| Heading | Section/page titles — sizes 2xl/xl/lg/base/sm, semantic level via `render={<h1 />}` decoupled from size |
+| Text | Body copy — sizes lg/base/sm/xs/xxs, variants default/muted/destructive, weights normal/medium/semibold |
+| Label | `<label>` bound to a control; inside forms prefer FieldLabel |
+
+Don't hand-roll `<p className="text-xs text-muted-foreground">` when `<Text size="xs" variant="muted">` exists.
+
+### Lists and containers
+
+**Card vs Item** — see the dedicated section below. Third option: **Table** when data is columnar and comparable across rows (sorting, sticky columns); **ItemGroup** when rows are entities with a title/description/actions shape; **Card** when each entry is a rich standalone tile.
+
+---
+
## Component Catalog
-| Component | Variants | Sizes | Notes |
-| ------------ | ------------------------------------------------------ | ---------------------------------------------------- | -------------------------------- |
-| Button | default, outline, ghost, destructive, link, link-muted | default, xs, sm, lg, icon, icon-xs, icon-sm, icon-lg | |
-| Badge | default, info, destructive, warning, success | — | Semantic status |
-| Toggle | default, outline | default, sm, lg, icon | |
-| Chip | outline | sm | Use with ChipClose |
-| Separator | — | — | orientation: horizontal/vertical |
-| Spinner | — | — | SVG, accepts svg props |
-| Skeleton | — | — | Pulsing placeholder div |
-| SkeletonText | — | — | lines, minWidth, maxWidth |
-| Progress | — | — | value: 0-100 |
-| Slider | — | — | value, min, max |
+| Component | Variants | Sizes | Notes |
+| ------------ | -------------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------------------------------------- |
+| Button | default, primary, outline, destructive, link, link-muted | default, xs, sm, lg, icon, icon-xs, icon-sm, icon-lg | `loading` overlays a centered spinner and disables the button (width stays stable) |
+| Badge | default, info, destructive, warning, success | — | Semantic status |
+| Toggle | default, outline | default, sm, lg, icon | |
+| Chip | outline | sm | Use with ChipClose |
+| Separator | — | — | orientation: horizontal/vertical |
+| Spinner | — | — | SVG, accepts svg props |
+| Skeleton | — | — | Pulsing placeholder div |
+| SkeletonText | — | — | lines, minWidth, maxWidth |
+| Progress | — | — | value: 0-100 |
+| Slider | — | — | value, min, max |
---
@@ -284,6 +369,28 @@ Multi-select with chips:
</Combobox>
```
+### Autocomplete (search-first input)
+
+The typed text is the value; items are suggestions. Pass `items` to the root and render via function-as-children so Base UI owns the filter pipeline. For a sticky-footer "Create new" action, use Combobox (`ComboboxListFooter`) instead.
+
+```tsx
+<Autocomplete items={FRAMEWORKS} value={value} onValueChange={setValue}>
+ <AutocompleteInput placeholder="Search…" />
+ <AutocompleteContent>
+ <AutocompleteEmpty>No matches</AutocompleteEmpty>
+ <AutocompleteList>
+ {(item: string) => (
+ <AutocompleteItem key={item} value={item}>
+ {item}
+ </AutocompleteItem>
+ )}
+ </AutocompleteList>
+ </AutocompleteContent>
+</Autocomplete>
+```
+
+Grouped items: pass `items={[{ label, items }]}` shapes, render `AutocompleteGroup items={group.items}` > `AutocompleteLabel` + `AutocompleteCollection` inside `AutocompleteList`. To anchor the popup to an external trigger, pass `anchor={triggerRef}` to `AutocompleteContent`.
+
### Dialog
```tsx
@@ -305,6 +412,26 @@ Multi-select with chips:
Hide close button: `<DialogContent showCloseButton={false}>`
+### Alert Dialog (must-resolve confirmation)
+
+Same shell as Dialog (shared `quill-dialog__*` styles) but `role="alertdialog"`, always modal, backdrop clicks never dismiss, and no X button — the user must pick an action (or Esc). Use for destructive/irreversible confirmations; put Cancel first so it takes initial focus.
+
+```tsx
+<AlertDialog>
+ <AlertDialogTrigger render={<Button variant="destructive" />}>Delete project</AlertDialogTrigger>
+ <AlertDialogContent>
+ <AlertDialogHeader>
+ <AlertDialogTitle>Delete this project?</AlertDialogTitle>
+ <AlertDialogDescription>This action cannot be undone.</AlertDialogDescription>
+ </AlertDialogHeader>
+ <AlertDialogFooter>
+ <AlertDialogClose render={<Button variant="outline" />}>Cancel</AlertDialogClose>
+ <AlertDialogClose render={<Button variant="destructive" />}>Delete</AlertDialogClose>
+ </AlertDialogFooter>
+ </AlertDialogContent>
+</AlertDialog>
+```
+
### Drawer (mobile-friendly)
```tsx
@@ -349,6 +476,8 @@ Hide close button: `<DialogContent showCloseButton={false}>`
</DropdownMenu>
```
+Destructive items (`variant="destructive"` on DropdownMenuItem/ContextMenuItem/MenubarItem) render red text on a transparent background, with a red-tinted background only on hover/highlight — they are styled by the menu item itself, not by Button's filled `destructive` variant. Don't pass a Button variant through `render` to restyle a menu item.
+
Checkbox/radio items:
```tsx
@@ -418,6 +547,25 @@ Vertical: `<Tabs orientation="vertical">`
</Collapsible>
```
+Icon-only trigger — only the chevron toggles, so the label can be its own button/link and the row can carry trailing content; composes with `variant="folder"` for sidebar trees. Inside `CollapsibleHeader` the trigger overlays the row's start, so give the full-width label button `ps-6` to clear it — hovering anywhere then highlights the whole row while the chevron stays its own click target. An optional `icon` shows at rest and swaps to the chevron when the row is hovered or the trigger focused. The chevron mirrors in RTL; use `ms-auto` (not `ml-auto`) for trailing content. Trigger children become the screen-reader label:
+
+```tsx
+<Collapsible variant="folder">
+ <CollapsibleHeader>
+ <CollapsibleTrigger iconOnly icon={<DatabaseZapIcon />}>
+ Toggle sources
+ </CollapsibleTrigger>
+ <Button variant="default" size="sm" left className="w-full ps-6">
+ Sources
+ <Text size="xs" variant="muted" render={<span />} className="ms-auto">
+ 2
+ </Text>
+ </Button>
+ </CollapsibleHeader>
+ <CollapsibleContent className="ps-4">{/* rows */}</CollapsibleContent>
+</Collapsible>
+```
+
### Popover
```tsx
@@ -438,39 +586,6 @@ Vertical: `<Tabs orientation="vertical">`
</Tooltip>
```
-### Command Palette
-
-```tsx
-<Command>
- <CommandInput placeholder="Search commands..." />
- <CommandList>
- <CommandEmpty>No results found.</CommandEmpty>
- <CommandGroup heading="Actions">
- <CommandItem>
- New file
- <CommandShortcut>Cmd+N</CommandShortcut>
- </CommandItem>
- <CommandItem>Search</CommandItem>
- </CommandGroup>
- <CommandSeparator />
- <CommandGroup heading="Settings">
- <CommandItem>Preferences</CommandItem>
- </CommandGroup>
- </CommandList>
-</Command>
-```
-
-As a dialog:
-
-```tsx
-<CommandDialog open={open} onOpenChange={setOpen}>
- <CommandInput placeholder="Type a command..." />
- <CommandList>
- <CommandItem>...</CommandItem>
- </CommandList>
-</CommandDialog>
-```
-
### Radio Group
```tsx
@@ -528,7 +643,7 @@ Vertical: `<ButtonGroup orientation="vertical">`
<ItemDescription>[email protected]</ItemDescription>
</ItemContent>
<ItemActions>
- <Button variant="ghost" size="icon-xs">
+ <Button variant="outline" size="icon-xs">
<MoreIcon />
</Button>
</ItemActions>
@@ -639,21 +754,26 @@ Compose `Table > TableHeader/TableBody/TableFooter > TableRow > TableHead/TableC
</Menubar>
```
-### Toast (Sonner)
+MenubarItem wraps DropdownMenuItem, so the same item API applies — including `variant="destructive"` (red text, red-tinted highlight, transparent at rest).
+
+### Toast
-Add `<Toaster />` once at app root, then use sonner's `toast()`:
+Add `<ToastProvider />` once at app root (see Setup), then call `toast` with an options object — not a string:
```tsx
-import { Toaster } from '@posthog/quill-primitives'
-import { toast } from 'sonner'
+import { toast } from '@posthog/quill-primitives'
-// In app root:
-;<Toaster />
+toast({ title: 'Hello world' })
+toast.success({ title: 'Saved successfully' })
+toast.error({ title: 'Something went wrong', description: 'Try again later' })
-// Anywhere:
-toast.success('Saved successfully')
-toast.error('Something went wrong')
-toast('Hello world')
+// Loading → resolve by id
+const id = toast.loading({ title: 'Processing...' })
+toast.update(id, { type: 'success', title: 'Done' })
+toast.dismiss(id)
+
+// With an action button
+toast({ title: 'Item archived', action: { label: 'Undo', onClick: () => restore() } })
```
### Theme Toggle
@@ -675,13 +795,80 @@ Note: pressing `d` also toggles theme (skipped when focus is in input fields).
---
+## Spacing and layout
+
+Quill spacing uses a 4px base (`gap-1` = 4px, `gap-2` = 8px, `gap-4` = 16px). These rules are the conventions the stories actually follow:
+
+### Between siblings — use gap, never margins
+
+- `gap-2` — the default between related sibling controls, in rows and stacks: button rows, checkbox + label, icon + text. When unsure, use `gap-2`.
+- `gap-1` — tight pairs only: a label and its inline meta/hint.
+- `gap-4` — between sections: stacked form fields (FieldGroup's built-in default), dialog body sections, page regions.
+- `gap-px` — packed menu-like lists on a `bg-muted` surface (1px visual seams).
+- `gap-0` / `<ItemGroup combined>` / `<CardGroup>` — merged lists and stacked cards with shared borders.
+
+Don't space siblings with `mt-*`/`mb-*` — put `flex flex-col gap-*` (or `flex gap-*`) on the parent.
+
+### Don't re-pad primitive internals
+
+Primitives carry their own padding and heights. Adding `p-*`/`h-*` via `className` on top of them fights the system:
+
+| Primitive | Built-in |
+| ---------------------------------- | ------------------------------------------------------------------------------------- |
+| Button | h-7 px-2 (default), h-6 (sm), h-5 (xs), h-8 (lg); gap-2 icon spacing |
+| Input | h-8, px-2 |
+| Card / CardHeader / CardContent | 1rem block + inline padding, gap-4 between sections (0.75rem / gap-3 for `size="sm"`) |
+| Menu popups (Dropdown/Context/...) | p-1 scroller; items pad themselves |
+| Item | py-2.5 px-3 (default/sm), py-2 px-2.5 (xs) |
+| Field / FieldGroup | gap-y-1 within a field, gap-4 between fields |
+
+Sanctioned escape hatches (the only padding overrides the stories use):
+
+- `p-0` on `DialogContent` when an inner component (e.g. a Combobox list) should consume the full dialog.
+- `p-0` on `Item size="xs"` in dense nested contexts (inside table cells, combobox rows).
+- `ml-auto` to push an element to the end of a flex row (alignment, not spacing).
+
+### Width and containers
+
+- Constrain single-column forms and lists: `w-full max-w-sm` is the standard.
+- Fixed sidebars/navs: explicit width (`w-[200px]`-ish), content area `flex-1`.
+- `flex flex-col` is the default layout; reach for `grid` only for genuinely two-dimensional layouts.
+- Tailwind utilities only — no inline styles; semantic tokens (`bg-muted`, `text-muted-foreground`) — never raw colors.
+
+---
+
+## Icons
+
+Primitives size and lay out their own icons — drop a bare lucide icon in as a child and it just works:
+
+```tsx
+<Button>
+ <Copy />
+ Copy
+</Button>
+```
+
+Each container's CSS handles `flex-shrink: 0` and the per-context size via `svg:not([class*='size-'])` selectors (or the `[&_svg:not([class*="size-"])]:size-*` Tailwind equivalent):
+
+| Context | Icon size |
+| ------------------------------------- | ------------------- |
+| Button | 1rem (size-4) |
+| Menu items (Dropdown/Context/Menubar) | 0.875rem (size-3.5) |
+| TabsTrigger | 0.75rem (size-3) |
+
+**Don't add `size-*` classes to icons inside primitives.** The `:not([class*='size-'])` guard means an explicit `size-*` class is treated as a deliberate override and the component's sizing steps aside — so reserve it for the rare case where you genuinely need a different size. Color also inherits (`currentColor`), so don't set icon colors either; variants tint their icons themselves.
+
+---
+
## Rules
1. **Use Field for forms** — don't compose raw Label + Input, use Field > FieldLabel + Input + FieldDescription/FieldError
-2. **Wrap app with providers** — ThemeProvider at root, TooltipProvider if using tooltips, Toaster if using toasts
+2. **Wrap app with providers** — ThemeProvider at root, TooltipProvider if using tooltips, ToastProvider if using toasts
3. **Badge variants are semantic** — info (blue), warning (yellow), success (green), destructive (red), default (neutral)
4. **Use `render` on triggers** — DialogTrigger, PopoverTrigger, TooltipTrigger, DrawerTrigger accept `render` to render as the child element
-5. **DropdownMenuItem has variants** — use `variant="destructive"` for dangerous actions, default is `"ghost"`
+5. **DropdownMenuItem has variants** — use `variant="destructive"` for dangerous actions; default is `"default"`
6. **Prefer composition over props** — use CardHeader > CardTitle instead of `<Card title="...">`
7. **Use `cn()` for class overrides** — import from `@posthog/quill-primitives` to merge Tailwind classes safely
-8. **Quill spacing uses 4px base** — spacing-1 = 4px, spacing-2 = 8px, spacing-3 = 12px, spacing-4 = 16px
+8. **Follow the spacing conventions** — see Spacing and layout above; `gap-2` between related siblings, `gap-4` between sections, never re-pad primitive internals
+9. **Use `loading` on submit buttons** — any Button that triggers a network request must pass `loading` while the request is in flight; it blocks activation (guarding double-submission) and overlays a spinner without changing the button's width, while staying focusable for screen readers (`aria-disabled` + `aria-busy`, not the native `disabled` attribute)
+10. **Don't size or color icons inside primitives** — see Icons above; component CSS sizes bare svg children per context, and `currentColor` handles tinting
diff --git a/packages/quill/packages/primitives/src/alert-dialog.stories.tsx b/packages/quill/packages/primitives/src/alert-dialog.stories.tsx
new file mode 100644
index 000000000000..1e8a86002a1a
--- /dev/null
+++ b/packages/quill/packages/primitives/src/alert-dialog.stories.tsx
@@ -0,0 +1,65 @@
+import type { Meta, StoryObj } from '@storybook/react'
+
+import {
+ AlertDialog,
+ AlertDialogClose,
+ AlertDialogContent,
+ AlertDialogDescription,
+ AlertDialogFooter,
+ AlertDialogHeader,
+ AlertDialogTitle,
+ AlertDialogTrigger,
+} from './alert-dialog'
+import { Button } from './button'
+
+const meta = {
+ title: 'Primitives/AlertDialog',
+ component: AlertDialog,
+ tags: ['autodocs'],
+} satisfies Meta<typeof AlertDialog>
+
+export default meta
+type Story = StoryObj<typeof meta>
+
+export const Default: Story = {
+ render: () => (
+ <AlertDialog>
+ <AlertDialogTrigger render={<Button variant="destructive" size="sm" />}>Delete project</AlertDialogTrigger>
+ <AlertDialogContent>
+ <AlertDialogHeader>
+ <AlertDialogTitle>Delete this project?</AlertDialogTitle>
+ <AlertDialogDescription>
+ This permanently deletes the project and all of its data. This action cannot be undone.
+ </AlertDialogDescription>
+ </AlertDialogHeader>
+ <AlertDialogFooter>
+ <AlertDialogClose render={<Button variant="outline" />}>Cancel</AlertDialogClose>
+ <AlertDialogClose render={<Button variant="destructive" />}>Delete project</AlertDialogClose>
+ </AlertDialogFooter>
+ </AlertDialogContent>
+ </AlertDialog>
+ ),
+} satisfies Story
+
+/* Backdrop clicks don't dismiss (disablePointerDismissal) — resolve with an
+ action or Esc. */
+export const NoPointerDismissal: Story = {
+ render: () => (
+ <AlertDialog defaultOpen>
+ <AlertDialogTrigger render={<Button variant="destructive" size="sm" />}>Revoke API key</AlertDialogTrigger>
+ <AlertDialogContent>
+ <AlertDialogHeader>
+ <AlertDialogTitle>Revoke this API key?</AlertDialogTitle>
+ <AlertDialogDescription>
+ Applications using this key will stop working immediately. Try clicking the backdrop — the
+ dialog stays open until you choose.
+ </AlertDialogDescription>
+ </AlertDialogHeader>
+ <AlertDialogFooter>
+ <AlertDialogClose render={<Button variant="outline" />}>Cancel</AlertDialogClose>
+ <AlertDialogClose render={<Button variant="destructive" />}>Revoke key</AlertDialogClose>
+ </AlertDialogFooter>
+ </AlertDialogContent>
+ </AlertDialog>
+ ),
+} satisfies Story
diff --git a/packages/quill/packages/primitives/src/alert-dialog.tsx b/packages/quill/packages/primitives/src/alert-dialog.tsx
new file mode 100644
index 000000000000..baad0fc071ba
--- /dev/null
+++ b/packages/quill/packages/primitives/src/alert-dialog.tsx
@@ -0,0 +1,118 @@
+import './dialog.css'
+
+import { AlertDialog as AlertDialogPrimitive } from '@base-ui/react/alert-dialog'
+import * as React from 'react'
+
+import { cn } from './lib/utils'
+
+/*
+ * Standalone on purpose, not a Dialog variant: Base UI's AlertDialogRoot
+ * hard-codes `role="alertdialog"`, `modal: true`, and
+ * `disablePointerDismissal: true` in its store — the user must make an
+ * explicit choice; clicking the backdrop never closes it. Exposing those as
+ * Dialog props would let consumers break the a11y contract. The visual layer
+ * is fully shared: every part reuses the `quill-dialog__*` styles from
+ * dialog.css.
+ */
+function AlertDialog({ ...props }: AlertDialogPrimitive.Root.Props): React.ReactElement {
+ return <AlertDialogPrimitive.Root data-slot="alert-dialog" {...props} />
+}
+
+function AlertDialogTrigger({ ...props }: AlertDialogPrimitive.Trigger.Props): React.ReactElement {
+ return <AlertDialogPrimitive.Trigger data-slot="alert-dialog-trigger" {...props} />
+}
+
+function AlertDialogPortal({ ...props }: AlertDialogPrimitive.Portal.Props): React.ReactElement {
+ return <AlertDialogPrimitive.Portal data-slot="alert-dialog-portal" {...props} />
+}
+
+function AlertDialogClose({ ...props }: AlertDialogPrimitive.Close.Props): React.ReactElement {
+ return <AlertDialogPrimitive.Close data-slot="alert-dialog-close" {...props} />
+}
+
+function AlertDialogOverlay({ className, ...props }: AlertDialogPrimitive.Backdrop.Props): React.ReactElement {
+ return (
+ <AlertDialogPrimitive.Backdrop
+ data-quill
+ data-quill-portal="modal-overlay"
+ data-slot="alert-dialog-overlay"
+ className={cn('quill-dialog__overlay', className)}
+ {...props}
+ />
+ )
+}
+
+/*
+ * Unlike DialogContent there is deliberately no `showCloseButton` — an alert
+ * dialog must be resolved through one of its actions (or Esc), so an X would
+ * just be an ambiguous third option.
+ */
+function AlertDialogContent({ className, children, ...props }: AlertDialogPrimitive.Popup.Props): React.ReactElement {
+ return (
+ <AlertDialogPortal>
+ <AlertDialogOverlay />
+ <AlertDialogPrimitive.Popup
+ data-quill
+ data-quill-portal="modal-content"
+ data-slot="alert-dialog-content"
+ className={cn('quill-dialog__content grid gap-4', className)}
+ {...props}
+ >
+ {children}
+ </AlertDialogPrimitive.Popup>
+ </AlertDialogPortal>
+ )
+}
+
+function AlertDialogTitle({ className, ...props }: AlertDialogPrimitive.Title.Props): React.ReactElement {
+ return (
+ <AlertDialogPrimitive.Title
+ data-slot="alert-dialog-title"
+ className={cn('quill-dialog__title', className)}
+ {...props}
+ />
+ )
+}
+
+function AlertDialogDescription({ className, ...props }: AlertDialogPrimitive.Description.Props): React.ReactElement {
+ return (
+ <AlertDialogPrimitive.Description
+ data-slot="alert-dialog-description"
+ className={cn('quill-dialog__description', className)}
+ {...props}
+ />
+ )
+}
+
+function AlertDialogHeader({ className, ...props }: React.ComponentProps<'div'>): React.ReactElement {
+ return (
+ <div
+ data-slot="alert-dialog-header"
+ className={cn('quill-dialog__header flex flex-col gap-1', className)}
+ {...props}
+ />
+ )
+}
+
+function AlertDialogFooter({ className, ...props }: React.ComponentProps<'div'>): React.ReactElement {
+ return (
+ <div
+ data-slot="alert-dialog-footer"
+ className={cn('quill-dialog__footer flex flex-col-reverse gap-2 sm:flex-row sm:justify-end', className)}
+ {...props}
+ />
+ )
+}
+
+export {
+ AlertDialog,
+ AlertDialogClose,
+ AlertDialogContent,
+ AlertDialogDescription,
+ AlertDialogFooter,
+ AlertDialogHeader,
+ AlertDialogOverlay,
+ AlertDialogPortal,
+ AlertDialogTitle,
+ AlertDialogTrigger,
+}
diff --git a/packages/quill/packages/primitives/src/button.css b/packages/quill/packages/primitives/src/button.css
index 6cd2d97bf258..a8137f7d8a99 100644
--- a/packages/quill/packages/primitives/src/button.css
+++ b/packages/quill/packages/primitives/src/button.css
@@ -164,7 +164,7 @@
background-color: color-mix(in oklab, var(--muted) 50%, transparent);
}
- :is(.dark, [theme='dark']) .quill-button--variant-outline:hover {
+ :is(.dark, [theme='dark']) .quill-button--variant-outline:not(:disabled):hover {
color: var(--foreground);
}
@@ -368,4 +368,79 @@
.quill-button--inert:not(:disabled):active {
translate: 0 0;
}
+
+ /* =========================================================================
+ Loading
+ ========================================================================= */
+
+ /* The label stays in the DOM at full width — text fades to transparent and
+ element children (icons, kbd) fade out — so the button never resizes.
+ The spinner overlays the center. */
+ .quill-button[data-loading] {
+ position: relative;
+ color: transparent;
+
+ /* No hover/active reactions while busy — variant hover rules would
+ otherwise repaint the label color over the spinner. */
+ pointer-events: none;
+ transition: color 150ms ease;
+ }
+
+ /* Loading is busy, not unavailable: the button is focusable-while-disabled
+ (aria-disabled, no native disabled attribute), so the dimmed :disabled
+ look never applies — full-strength visuals under the spinner. */
+ .quill-button[data-loading] > :not(.quill-spinner) {
+ opacity: 0;
+ transition: opacity 150ms ease;
+ }
+
+ .quill-button[data-loading] > .quill-spinner {
+ position: absolute;
+ inset: 0;
+ margin: auto;
+ color: var(--foreground);
+ animation:
+ var(--animate-spin, spin 1s linear infinite),
+ quill-button__spinner-in 150ms cubic-bezier(0.215, 0.61, 0.355, 1);
+ }
+
+ .quill-button--variant-primary[data-loading] > .quill-spinner {
+ color: var(--primary-foreground);
+ }
+
+ .quill-button--variant-destructive[data-loading] > .quill-spinner {
+ color: var(--destructive-foreground);
+ }
+
+ .quill-button--variant-link[data-loading] > .quill-spinner {
+ color: var(--primary);
+ }
+
+ .quill-button--variant-link-muted[data-loading] > .quill-spinner {
+ color: var(--muted-foreground);
+ }
+
+ @keyframes quill-button__spinner-in {
+ from {
+ opacity: 0;
+ scale: 0.9;
+ }
+
+ to {
+ opacity: 1;
+ scale: 1;
+ }
+ }
+
+ @media (prefers-reduced-motion: reduce) {
+ .quill-button[data-loading],
+ .quill-button[data-loading] > :not(.quill-spinner) {
+ transition: none;
+ }
+
+ /* Keep the rotation — it is the status indicator — but drop the entrance. */
+ .quill-button[data-loading] > .quill-spinner {
+ animation: var(--animate-spin, spin 1s linear infinite);
+ }
+ }
}
diff --git a/packages/quill/packages/primitives/src/button.stories.tsx b/packages/quill/packages/primitives/src/button.stories.tsx
index 8bcde3f7a71c..cdce2162f1d7 100644
--- a/packages/quill/packages/primitives/src/button.stories.tsx
+++ b/packages/quill/packages/primitives/src/button.stories.tsx
@@ -1,5 +1,6 @@
import type { Meta, StoryObj } from '@storybook/react'
import { TrashIcon } from 'lucide-react'
+import { useState } from 'react'
import { Button } from './button'
import { Kbd } from './kbd'
@@ -18,6 +19,7 @@ const meta = {
options: ['default', 'xs', 'sm', 'lg', 'icon', 'icon-xs', 'icon-sm', 'icon-lg'],
},
disabled: { control: 'boolean' },
+ loading: { control: 'boolean' },
},
} satisfies Meta<typeof Button>
@@ -186,6 +188,41 @@ export const Disabled = {
),
} satisfies Story
+export const Loading = {
+ render: () => {
+ const [saving, setSaving] = useState(false)
+ const simulateSave = (): void => {
+ setSaving(true)
+ setTimeout(() => setSaving(false), 2000)
+ }
+ return (
+ <div className="flex flex-col gap-4">
+ <div className="flex flex-wrap items-center gap-2">
+ <Button loading>Default</Button>
+ <Button variant="primary" loading>
+ Primary
+ </Button>
+ <Button variant="outline" loading>
+ Outline
+ </Button>
+ <Button variant="destructive" loading>
+ Destructive
+ </Button>
+ <Button size="icon" loading aria-label="Delete">
+ <TrashIcon />
+ </Button>
+ </div>
+ {/* Click to see the rest → loading transition; resolves after 2s. */}
+ <div className="flex flex-wrap gap-2">
+ <Button variant="primary" loading={saving} onClick={simulateSave}>
+ Save changes
+ </Button>
+ </div>
+ </div>
+ )
+ },
+} satisfies Story
+
export const Misc = {
render: () => (
<div className="max-w-sm">
diff --git a/packages/quill/packages/primitives/src/button.tsx b/packages/quill/packages/primitives/src/button.tsx
index 7231e7947d4d..661d7c5a2d89 100644
--- a/packages/quill/packages/primitives/src/button.tsx
+++ b/packages/quill/packages/primitives/src/button.tsx
@@ -1,9 +1,11 @@
+import './button.css'
+
import { Button as ButtonPrimitive } from '@base-ui/react/button'
import { cva, type VariantProps } from 'class-variance-authority'
import * as React from 'react'
-import './button.css'
import { cn } from './lib/utils'
+import { Spinner } from './spinner'
const buttonVariants = cva(
'quill-button group/button inline-flex shrink-0 items-center justify-center whitespace-nowrap',
@@ -47,11 +49,25 @@ const buttonVariants = cva(
}
)
-export type ButtonProps = ButtonPrimitive.Props & VariantProps<typeof buttonVariants>
+export type ButtonProps = ButtonPrimitive.Props &
+ VariantProps<typeof buttonVariants> & {
+ /** Hides the label under a centered spinner and disables the button. Width stays stable. */
+ loading?: boolean
+ }
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
(
- { className, variant = 'default', size = 'default', focusableWhenDisabled = true, left = false, ...props },
+ {
+ className,
+ variant = 'default',
+ size = 'default',
+ focusableWhenDisabled = true,
+ left = false,
+ loading = false,
+ disabled,
+ children,
+ ...props
+ },
ref
) => {
return (
@@ -60,9 +76,21 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
data-quill
data-slot="button"
data-size={size}
+ data-loading={loading || undefined}
+ aria-busy={loading || undefined}
+ disabled={disabled || loading}
+ // While loading, stay focusable: Base UI then renders aria-disabled instead of
+ // the native disabled attribute, keeping the button in the tab order so screen
+ // readers can reach it and announce busy. Activation stays blocked.
+
+ focusableWhenDisabled={loading ? true : focusableWhenDisabled}
+
className={cn(buttonVariants({ variant, size, className, focusableWhenDisabled, left }))}
{...props}
- />
+ >
+ {children}
+ {loading && <Spinner className="quill-button__spinner" />}
+ </ButtonPrimitive>
)
}
)
diff --git a/packages/quill/packages/primitives/src/collapsible.css b/packages/quill/packages/primitives/src/collapsible.css
index a01c0bbc1bee..131df5168ce7 100644
--- a/packages/quill/packages/primitives/src/collapsible.css
+++ b/packages/quill/packages/primitives/src/collapsible.css
@@ -9,14 +9,18 @@
background-color: var(--muted);
}
- /* Trigger shared base */
+ /* Trigger shared base. Full-row sizing is scoped away from the icon-only
+ trigger, whose square dimensions come from the Button icon size. */
.quill-collapsible__trigger {
- width: 100%;
- padding-inline: 0.5rem;
font-size: var(--text-xs, 0.75rem);
line-height: 1.625;
}
+ .quill-collapsible__trigger:not(.quill-collapsible__trigger--icon) {
+ width: 100%;
+ padding-inline: 0.5rem;
+ }
+
.quill-collapsible__trigger[aria-expanded='true'] {
background-color: var(--fill-selected);
}
@@ -42,6 +46,60 @@
display: inline;
}
+ /* Inside a header the trigger overlays the row's start, so a full-width
+ sibling button can own the entire row's hover surface (give it
+ padding-inline-start to clear the chevron). Centered via auto margins,
+ not translate — the Button :active translate would displace it. */
+ .quill-collapsible__header {
+ position: relative;
+ }
+
+ .quill-collapsible__header > .quill-collapsible__trigger--icon {
+ position: absolute;
+ inset-block: 0;
+ inset-inline-start: 0;
+ z-index: 1;
+ margin-block: auto;
+ }
+
+ /* The row, not the tiny button, communicates open state. */
+ .quill-collapsible__trigger--icon[aria-expanded='true'] {
+ background-color: transparent;
+ }
+
+ /* Single chevron rotates instead of swapping: closed points into reading
+ direction (mirrored in RTL), open points down in both directions. */
+ .quill-collapsible__trigger--icon svg[data-chevron='right'] {
+ transition: rotate 150ms ease;
+ }
+
+ [dir='rtl'] .quill-collapsible__trigger--icon svg[data-chevron='right'] {
+ rotate: 180deg;
+ }
+
+ .quill-collapsible__trigger--icon[data-panel-open] svg[data-chevron='right'],
+ [dir='rtl'] .quill-collapsible__trigger--icon[data-panel-open] svg[data-chevron='right'] {
+ rotate: 90deg;
+ }
+
+ /* Rest-icon swap (`icon` prop): the category icon shows at rest; hovering
+ the header row or focusing the trigger reveals the chevron. */
+ .quill-collapsible__trigger--swap svg[data-chevron='right'],
+ .quill-collapsible__header:hover .quill-collapsible__trigger--swap [data-slot='collapsible-trigger-rest-icon'],
+ .quill-collapsible__trigger--swap:focus-visible [data-slot='collapsible-trigger-rest-icon'] {
+ display: none;
+ }
+
+ .quill-collapsible__header:hover .quill-collapsible__trigger--swap svg[data-chevron='right'],
+ .quill-collapsible__trigger--swap:focus-visible svg[data-chevron='right'] {
+ display: inline;
+ }
+
+ .quill-collapsible__trigger--swap [data-slot='collapsible-trigger-rest-icon'] {
+ display: inline-flex;
+ color: var(--muted-foreground);
+ }
+
.quill-collapsible__panel {
position: relative;
z-index: 1;
@@ -62,6 +120,7 @@
}
.quill-collapsible__panel-content--variant-folder {
+ padding-inline: 1.2rem;
padding-inline-end: 0;
}
@@ -77,4 +136,10 @@
.quill-collapsible__panel-content p:not(:last-child) {
margin-bottom: 1rem;
}
+
+ @media (prefers-reduced-motion: reduce) {
+ .quill-collapsible__trigger--icon svg[data-chevron='right'] {
+ transition: none;
+ }
+ }
}
diff --git a/packages/quill/packages/primitives/src/collapsible.stories.tsx b/packages/quill/packages/primitives/src/collapsible.stories.tsx
index 39f3431df75a..68f9e1fc3227 100644
--- a/packages/quill/packages/primitives/src/collapsible.stories.tsx
+++ b/packages/quill/packages/primitives/src/collapsible.stories.tsx
@@ -1,6 +1,9 @@
import type { Meta, StoryObj } from '@storybook/react'
+import { DatabaseZapIcon, FolderOpenIcon, GlobeIcon, PaperclipIcon } from 'lucide-react'
-import { Collapsible, CollapsibleContent, CollapsibleTrigger } from './collapsible'
+import { Button } from './button'
+import { Collapsible, CollapsibleContent, CollapsibleHeader, CollapsibleTrigger } from './collapsible'
+import { Text } from './text'
const meta = {
title: 'Primitives/Collapsible',
@@ -24,6 +27,50 @@ export const Default: Story = {
),
} satisfies Story
+/* Icon-only trigger: only the chevron toggles; the label is its own link and
+ the trailing count stays independently rendered. `ms-auto` keeps the count
+ end-aligned in RTL, and the chevron mirrors direction automatically. */
+export const IconTrigger: Story = {
+ render: () => (
+ <Collapsible className="max-w-60" variant="folder" defaultOpen>
+ <CollapsibleHeader>
+ {/* Rest icon swaps to the chevron when the row is hovered. */}
+ <CollapsibleTrigger iconOnly icon={<DatabaseZapIcon />}>
+ Toggle sources
+ </CollapsibleTrigger>
+ {/* Full-row surface under the overlaid chevron — ps-6 clears it,
+ so hovering anywhere highlights the whole row. */}
+ <Button variant="default" size="sm" left className="w-full ps-8">
+ Sources
+ <Text size="xs" variant="muted" render={<span />} className="ms-auto">
+ 2
+ </Text>
+ </Button>
+ </CollapsibleHeader>
+ {/* ps-4 lines the child icons up under the header label text. */}
+ <CollapsibleContent className="ps-6">
+ <ul className="flex flex-col gap-px">
+ {[
+ { icon: <GlobeIcon />, label: 'APIs', count: 1 },
+ { icon: <PaperclipIcon />, label: 'MCPs', count: 1 },
+ { icon: <FolderOpenIcon />, label: 'Local Folders', count: 0 },
+ ].map(({ icon, label, count }) => (
+ <li key={label} className="flex w-full items-center">
+ <Button variant="default" size="sm" left className="w-full">
+ {icon}
+ {label}
+ <Text size="xs" variant="muted" render={<span />} className="ms-auto">
+ {count}
+ </Text>
+ </Button>
+ </li>
+ ))}
+ </ul>
+ </CollapsibleContent>
+ </Collapsible>
+ ),
+} satisfies Story
+
export const Folder: Story = {
render: () => (
<Collapsible className="max-w-sm" variant="folder">
@@ -31,15 +78,17 @@ export const Folder: Story = {
<p>Collapsible Trigger</p>
</CollapsibleTrigger>
<CollapsibleContent>
- <Collapsible variant="folder">
- <CollapsibleTrigger>
- <p>Collapsible Trigger</p>
- </CollapsibleTrigger>
- <CollapsibleContent>
- <p>Collapsible Content</p>
- </CollapsibleContent>
- </Collapsible>
+ <Button left size="sm" className="w-full">A button here</Button>
+ <Collapsible variant="folder">
+ <CollapsibleTrigger>
+ <p>Collapsible Trigger</p>
+ </CollapsibleTrigger>
+ <CollapsibleContent>
+ <Button left size="sm" className="w-full">A button here</Button>
+ </CollapsibleContent>
+ </Collapsible>
+ <Button left size="sm" className="w-full">A button here</Button>
</CollapsibleContent>
</Collapsible>
),
-} satisfies Story
\ No newline at end of file
+} satisfies Story
diff --git a/packages/quill/packages/primitives/src/collapsible.tsx b/packages/quill/packages/primitives/src/collapsible.tsx
index 1f87b5f7555a..fb02ea76814f 100644
--- a/packages/quill/packages/primitives/src/collapsible.tsx
+++ b/packages/quill/packages/primitives/src/collapsible.tsx
@@ -1,9 +1,10 @@
+import './collapsible.css'
+
import { Collapsible as CollapsiblePrimitive } from '@base-ui/react/collapsible'
-import { ChevronDownIcon, ChevronUpIcon } from 'lucide-react'
+import { ChevronDownIcon, ChevronRightIcon, ChevronUpIcon } from 'lucide-react'
import * as React from 'react'
import { Button } from './button'
-import './collapsible.css'
import { cn } from './lib/utils'
type CollapsibleVariant = 'default' | 'folder'
@@ -32,12 +33,75 @@ function Collapsible({ variant = 'default', className, ...props }: CollapsiblePr
)
}
+/**
+ * Row container for the icon-only trigger pattern: the trigger toggles, while
+ * siblings (a link, trailing count, actions) stay independently interactive.
+ * Use `ms-auto` on trailing content so it stays end-aligned in RTL.
+ */
+function CollapsibleHeader({ className, ...props }: React.ComponentProps<'div'>): React.ReactElement {
+ return (
+ <div
+ data-slot="collapsible-header"
+ className={cn('quill-collapsible__header flex w-full items-center gap-1.5', className)}
+ {...props}
+ />
+ )
+}
+
function CollapsibleTrigger({
children,
className,
+ iconOnly = false,
+ icon,
...props
-}: CollapsiblePrimitive.Trigger.Props): React.ReactElement {
+}: CollapsiblePrimitive.Trigger.Props & {
+ /**
+ * Renders the trigger as a compact icon button (just the chevron) instead
+ * of a full-width row — pair with `CollapsibleHeader` so the rest of the
+ * row can hold independently clickable content. `children` become the
+ * trigger's screen-reader-only label.
+ */
+ iconOnly?: boolean
+ /**
+ * Optional rest icon for `iconOnly` mode: shown instead of the chevron
+ * until the surrounding `CollapsibleHeader` row is hovered or the trigger
+ * is focused, then swaps to the chevron (Finder/VS Code tree pattern).
+ */
+ icon?: React.ReactNode
+}): React.ReactElement {
const variant = React.useContext(CollapsibleVariantContext)
+ if (iconOnly) {
+ return (
+ <CollapsiblePrimitive.Trigger
+ data-slot="collapsible-trigger"
+ data-variant={variant}
+ className={cn(
+ 'quill-collapsible__trigger quill-collapsible__trigger--icon group/collapsible-trigger',
+ icon != null && 'quill-collapsible__trigger--swap',
+ className
+ )}
+ render={<Button size="icon-sm" />}
+ {...props}
+ >
+ {/* Rest-icon display is owned by collapsible.css (hover/focus
+ swap) — a Tailwind display utility here would win the layer
+ war and break the hide-on-hover. */}
+ {icon != null && (
+ <span data-slot="collapsible-trigger-rest-icon" className="pointer-events-none shrink-0">
+ {icon}
+ </span>
+ )}
+ {/* Single chevron rotated via CSS: points into reading direction
+ when closed (mirrored in RTL), down when open. */}
+ <ChevronRightIcon
+ data-slot="collapsible-trigger-icon"
+ data-chevron="right"
+ className="pointer-events-none shrink-0"
+ />
+ {children != null && <span className="sr-only">{children}</span>}
+ </CollapsiblePrimitive.Trigger>
+ )
+ }
const chevrons = (
<>
<ChevronDownIcon
@@ -75,11 +139,7 @@ function CollapsibleContent({ children, className, ...props }: CollapsiblePrimit
const variant = React.useContext(CollapsibleVariantContext)
return (
- <CollapsiblePrimitive.Panel
- data-slot="collapsible-content"
- className="quill-collapsible__panel"
- {...props}
- >
+ <CollapsiblePrimitive.Panel data-slot="collapsible-content" className="quill-collapsible__panel" {...props}>
<div
className={cn(
'quill-collapsible__panel-content',
@@ -93,4 +153,4 @@ function CollapsibleContent({ children, className, ...props }: CollapsiblePrimit
)
}
-export { Collapsible, CollapsibleTrigger, CollapsibleContent }
+export { Collapsible, CollapsibleHeader, CollapsibleTrigger, CollapsibleContent }
diff --git a/packages/quill/packages/primitives/src/combobox.css b/packages/quill/packages/primitives/src/combobox.css
index eddf934edeac..e3cdf8c70d7e 100644
--- a/packages/quill/packages/primitives/src/combobox.css
+++ b/packages/quill/packages/primitives/src/combobox.css
@@ -116,6 +116,9 @@
}
.quill-combobox__item {
+ /* The check indicator is absolutely positioned (end-2) and must anchor
+ to the item, not the scrolling popup. */
+ position: relative;
width: 100%;
font-weight: 400;
}
diff --git a/packages/quill/packages/primitives/src/context-menu.tsx b/packages/quill/packages/primitives/src/context-menu.tsx
index a8bcc6a5f59c..f9d28e2522ce 100644
--- a/packages/quill/packages/primitives/src/context-menu.tsx
+++ b/packages/quill/packages/primitives/src/context-menu.tsx
@@ -1,11 +1,13 @@
+import './menu.css'
+
import { ContextMenu as ContextMenuPrimitive } from '@base-ui/react/context-menu'
import { ChevronRightIcon } from 'lucide-react'
import * as React from 'react'
import { Button } from './button'
import { Checkbox } from './checkbox'
+import { Kbd } from './kbd'
import { cn } from './lib/utils'
-import './menu.css'
import { RadioIndicator } from './radio-group'
function ContextMenu({ ...props }: ContextMenuPrimitive.Root.Props): React.ReactElement {
@@ -17,7 +19,13 @@ function ContextMenuPortal({ ...props }: ContextMenuPrimitive.Portal.Props): Rea
}
function ContextMenuTrigger({ className, ...props }: ContextMenuPrimitive.Trigger.Props): React.ReactElement {
- return <ContextMenuPrimitive.Trigger data-slot="context-menu-trigger" className={cn('select-none', className)} {...props} />
+ return (
+ <ContextMenuPrimitive.Trigger
+ data-slot="context-menu-trigger"
+ className={cn('select-none', className)}
+ {...props}
+ />
+ )
}
function ContextMenuContent({
@@ -90,11 +98,16 @@ function ContextMenuItem({
data-inset={inset}
data-variant={variant}
className={cn(
- "group/context-menu-item relative flex cursor-default items-center outline-hidden select-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5",
+ "group/context-menu-item relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5",
+ // Same destructive treatment as DropdownMenuItem: red text at rest, red tint on
+ // hover/highlight — never Button's filled `destructive` variant inside a menu.
+ // Disabled destructive mirrors the disabled destructive Button: 50%-mix red fill
+ // under the item-level opacity-50.
+ 'data-[variant=destructive]:text-destructive-foreground data-[variant=destructive]:hover:text-destructive-foreground data-[variant=destructive]:[&_svg]:text-destructive-foreground data-[variant=destructive]:hover:bg-destructive/10 data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:data-highlighted:bg-destructive/10 dark:data-[variant=destructive]:hover:bg-destructive/20 dark:data-[variant=destructive]:focus:bg-destructive/20 dark:data-[variant=destructive]:data-highlighted:bg-destructive/20 data-[variant=destructive]:data-disabled:bg-destructive/50',
inset && 'quill-menu-item--inset',
className
)}
- render={<Button variant={variant} className="w-full font-normal" left />}
+ render={<Button variant="default" className="w-full font-normal" left />}
{...props}
>
{children}
@@ -220,11 +233,17 @@ function ContextMenuRadioItem({
}
function ContextMenuSeparator({ className, ...props }: ContextMenuPrimitive.Separator.Props): React.ReactElement {
- return <ContextMenuPrimitive.Separator data-slot="context-menu-separator" className={cn('quill-menu__separator', className)} {...props} />
+ return (
+ <ContextMenuPrimitive.Separator
+ data-slot="context-menu-separator"
+ className={cn('quill-menu__separator', className)}
+ {...props}
+ />
+ )
}
-function ContextMenuShortcut({ className, ...props }: React.ComponentProps<'span'>): React.ReactElement {
- return <span data-slot="context-menu-shortcut" className={cn('quill-menu__shortcut', className)} {...props} />
+function ContextMenuShortcut({ className, ...props }: React.ComponentProps<typeof Kbd>): React.ReactElement {
+ return <Kbd data-slot="context-menu-shortcut" className={cn('quill-menu__shortcut', className)} {...props} />
}
export {
diff --git a/packages/quill/packages/primitives/src/dropdown-menu.stories.tsx b/packages/quill/packages/primitives/src/dropdown-menu.stories.tsx
index 95bf58e7705f..06b5029928e5 100644
--- a/packages/quill/packages/primitives/src/dropdown-menu.stories.tsx
+++ b/packages/quill/packages/primitives/src/dropdown-menu.stories.tsx
@@ -145,9 +145,9 @@ export const Checkboxes: Story = {
<DropdownMenuCheckboxItem disabled>Checkbox Item 2</DropdownMenuCheckboxItem>
<DropdownMenuSeparator />
<DropdownMenuItem>
- <ExpandIcon />
- Expand
- </DropdownMenuItem>
+ <ExpandIcon />
+ Expand
+ </DropdownMenuItem>
</DropdownMenuGroup>
</DropdownMenuContent>
</DropdownMenu>
@@ -191,9 +191,7 @@ export const SelectAll: Story = {
const [selected, setSelected] = useState<string[]>([])
const toggle = (value: string, checked: boolean): void => {
- setSelected((prev) =>
- checked ? [...prev, value] : prev.filter((v) => v !== value)
- )
+ setSelected((prev) => (checked ? [...prev, value] : prev.filter((v) => v !== value)))
}
return (
@@ -232,9 +230,7 @@ export const SelectAllWithRenderProp: Story = {
const [selected, setSelected] = useState<string[]>([FRAMEWORKS[0]])
const toggle = (value: string, checked: boolean): void => {
- setSelected((prev) =>
- checked ? [...prev, value] : prev.filter((v) => v !== value)
- )
+ setSelected((prev) => (checked ? [...prev, value] : prev.filter((v) => v !== value)))
}
return (
@@ -252,8 +248,7 @@ export const SelectAllWithRenderProp: Story = {
{({ state, toggle: toggleAll }) => (
<DropdownMenuItem closeOnClick={false} onClick={toggleAll}>
{state === 'all' && 'Clear selection'}
- {state === 'some' &&
- `Select remaining (${FRAMEWORKS.length - selected.length})`}
+ {state === 'some' && `Select remaining (${FRAMEWORKS.length - selected.length})`}
{state === 'none' && 'Select all'}
</DropdownMenuItem>
)}
@@ -280,23 +275,17 @@ export const SelectAllWithHook: Story = {
render: () => {
const [open, setOpen] = useState(true)
const [selected, setSelected] = useState<string[]>([])
- const { state, toggle: toggleAll } = useDropdownMenuSelectAll(
- FRAMEWORKS,
- selected,
- (next) => setSelected([...next])
+ const { state, toggle: toggleAll } = useDropdownMenuSelectAll(FRAMEWORKS, selected, (next) =>
+ setSelected([...next])
)
const toggle = (value: string, checked: boolean): void => {
- setSelected((prev) =>
- checked ? [...prev, value] : prev.filter((v) => v !== value)
- )
+ setSelected((prev) => (checked ? [...prev, value] : prev.filter((v) => v !== value)))
}
return (
<DropdownMenu open={open} onOpenChange={setOpen}>
- <DropdownMenuTrigger render={<Button variant="outline" size="sm" />}>
- Frameworks
- </DropdownMenuTrigger>
+ <DropdownMenuTrigger render={<Button variant="outline" size="sm" />}>Frameworks</DropdownMenuTrigger>
<DropdownMenuContent className="w-auto min-w-56">
<DropdownMenuGroup>
<DropdownMenuLabel>
@@ -324,31 +313,61 @@ export const SelectAllWithHook: Story = {
} satisfies Story
const TIMEZONES = [
- 'Pacific/Midway', 'Pacific/Honolulu', 'America/Anchorage', 'America/Los_Angeles',
- 'America/Denver', 'America/Phoenix', 'America/Chicago', 'America/Mexico_City',
- 'America/New_York', 'America/Toronto', 'America/Halifax', 'America/Sao_Paulo',
- 'Atlantic/Azores', 'Europe/London', 'Europe/Dublin', 'Europe/Lisbon',
- 'Europe/Paris', 'Europe/Berlin', 'Europe/Madrid', 'Europe/Rome',
- 'Europe/Athens', 'Europe/Helsinki', 'Africa/Cairo', 'Europe/Moscow',
- 'Asia/Dubai', 'Asia/Karachi', 'Asia/Kolkata', 'Asia/Bangkok',
- 'Asia/Singapore', 'Asia/Hong_Kong', 'Asia/Shanghai', 'Asia/Tokyo',
- 'Asia/Seoul', 'Australia/Perth', 'Australia/Sydney', 'Pacific/Auckland',
+ 'Pacific/Midway',
+ 'Pacific/Honolulu',
+ 'America/Anchorage',
+ 'America/Los_Angeles',
+ 'America/Denver',
+ 'America/Phoenix',
+ 'America/Chicago',
+ 'America/Mexico_City',
+ 'America/New_York',
+ 'America/Toronto',
+ 'America/Halifax',
+ 'America/Sao_Paulo',
+ 'Atlantic/Azores',
+ 'Europe/London',
+ 'Europe/Dublin',
+ 'Europe/Lisbon',
+ 'Europe/Paris',
+ 'Europe/Berlin',
+ 'Europe/Madrid',
+ 'Europe/Rome',
+ 'Europe/Athens',
+ 'Europe/Helsinki',
+ 'Africa/Cairo',
+ 'Europe/Moscow',
+ 'Asia/Dubai',
+ 'Asia/Karachi',
+ 'Asia/Kolkata',
+ 'Asia/Bangkok',
+ 'Asia/Singapore',
+ 'Asia/Hong_Kong',
+ 'Asia/Shanghai',
+ 'Asia/Tokyo',
+ 'Asia/Seoul',
+ 'Australia/Perth',
+ 'Australia/Sydney',
+ 'Pacific/Auckland',
] as const
export const Overflow: Story = {
render: () => {
const [open, setOpen] = useState(true)
+ const [timezone, setTimezone] = useState<string | undefined>(undefined)
return (
<DropdownMenu open={open} onOpenChange={setOpen}>
<DropdownMenuTrigger render={<Button variant="outline" size="sm" />}>
- Pick a timezone
+ {timezone ?? 'Pick a timezone'}
</DropdownMenuTrigger>
<DropdownMenuContent className="w-auto min-w-56">
- <DropdownMenuGroup>
+ <DropdownMenuRadioGroup value={timezone} onValueChange={setTimezone}>
{TIMEZONES.map((tz) => (
- <DropdownMenuItem key={tz}>{tz}</DropdownMenuItem>
+ <DropdownMenuRadioItem key={tz} value={tz}>
+ {tz}
+ </DropdownMenuRadioItem>
))}
- </DropdownMenuGroup>
+ </DropdownMenuRadioGroup>
</DropdownMenuContent>
</DropdownMenu>
)
diff --git a/packages/quill/packages/primitives/src/dropdown-menu.tsx b/packages/quill/packages/primitives/src/dropdown-menu.tsx
index 577028e4049b..15493201f1b2 100644
--- a/packages/quill/packages/primitives/src/dropdown-menu.tsx
+++ b/packages/quill/packages/primitives/src/dropdown-menu.tsx
@@ -1,11 +1,13 @@
+import './menu.css'
+
import { Menu as MenuPrimitive } from '@base-ui/react/menu'
import { ChevronRightIcon } from 'lucide-react'
import * as React from 'react'
import { Button } from './button'
import { Checkbox } from './checkbox'
+import { Kbd } from './kbd'
import { cn } from './lib/utils'
-import './menu.css'
import { MenuLabel } from './menu-label'
import { RadioIndicator } from './radio-group'
@@ -31,7 +33,10 @@ function DropdownMenuContent({
children,
...props
}: MenuPrimitive.Popup.Props &
- Pick<MenuPrimitive.Positioner.Props, 'align' | 'alignOffset' | 'side' | 'sideOffset' | 'anchor'>): React.ReactElement {
+ Pick<
+ MenuPrimitive.Positioner.Props,
+ 'align' | 'alignOffset' | 'side' | 'sideOffset' | 'anchor'
+ >): React.ReactElement {
return (
<MenuPrimitive.Portal>
<MenuPrimitive.Positioner
@@ -46,15 +51,10 @@ function DropdownMenuContent({
>
<MenuPrimitive.Popup
data-slot="dropdown-menu-content"
- className={cn(
- 'quill-menu__content w-(--anchor-width)',
- className
- )}
+ className={cn('quill-menu__content w-(--anchor-width)', className)}
{...props}
>
- <div className="quill-menu__scroller scroll-mask-y-4 scroll-py-4">
- {children}
- </div>
+ <div className="quill-menu__scroller scroll-mask-y-4 scroll-py-4">{children}</div>
</MenuPrimitive.Popup>
</MenuPrimitive.Positioner>
</MenuPrimitive.Portal>
@@ -98,11 +98,17 @@ function DropdownMenuItem({
data-inset={inset}
data-variant={variant}
className={cn(
- "group/dropdown-menu-item relative flex cursor-default items-center text-xs/relaxed outline-hidden select-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5",
+ "group/dropdown-menu-item relative flex cursor-default items-center text-xs/relaxed outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5",
+ // Destructive menu items are transparent at rest (red text only) and get a red
+ // tint on hover/highlight — Button's standalone `destructive` variant (filled at
+ // rest) is wrong inside a menu, so the inner Button always stays `default`.
+ // Disabled destructive mirrors the disabled destructive Button: 50%-mix red fill
+ // under the item-level opacity-50.
+ 'data-[variant=destructive]:text-destructive-foreground data-[variant=destructive]:hover:text-destructive-foreground data-[variant=destructive]:[&_svg]:text-destructive-foreground data-[variant=destructive]:hover:bg-destructive/10 data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:data-highlighted:bg-destructive/10 dark:data-[variant=destructive]:hover:bg-destructive/20 dark:data-[variant=destructive]:focus:bg-destructive/20 dark:data-[variant=destructive]:data-highlighted:bg-destructive/20 data-[variant=destructive]:data-disabled:bg-destructive/50',
inset && 'quill-menu-item--inset',
className
)}
- render={<Button variant={variant} className="w-full font-normal [&_kbd]:ml-auto" left />}
+ render={<Button variant="default" className="w-full font-normal [&_kbd]:ml-auto" left />}
{...props}
/>
)
@@ -149,10 +155,7 @@ function DropdownMenuSubContent({
return (
<DropdownMenuContent
data-slot="dropdown-menu-sub-content"
- className={cn(
- 'quill-menu__sub-content w-auto',
- className
- )}
+ className={cn('quill-menu__sub-content w-auto', className)}
align={align}
alignOffset={alignOffset}
side={side}
@@ -235,7 +238,13 @@ function DropdownMenuRadioItem({
}
function DropdownMenuSeparator({ className, ...props }: MenuPrimitive.Separator.Props): React.ReactElement {
- return <MenuPrimitive.Separator data-slot="dropdown-menu-separator" className={cn('quill-menu__separator', className)} {...props} />
+ return (
+ <MenuPrimitive.Separator
+ data-slot="dropdown-menu-separator"
+ className={cn('quill-menu__separator', className)}
+ {...props}
+ />
+ )
}
/**
@@ -289,8 +298,7 @@ function useDropdownMenuSelectAll<T>(
return count + (selectedKeys.has(key) ? 1 : 0)
}, 0)
- const state: SelectAllState =
- matched === 0 ? 'none' : matched >= values.length ? 'all' : 'some'
+ const state: SelectAllState = matched === 0 ? 'none' : matched >= values.length ? 'all' : 'some'
const isAllSelected = state === 'all'
const toggle = React.useCallback(() => {
@@ -361,8 +369,8 @@ function DropdownMenuSelectAll<T>({
)
}
-function DropdownMenuShortcut({ className, ...props }: React.ComponentProps<'span'>): React.ReactElement {
- return <span data-slot="dropdown-menu-shortcut" className={cn('quill-menu__shortcut', className)} {...props} />
+function DropdownMenuShortcut({ className, ...props }: React.ComponentProps<typeof Kbd>): React.ReactElement {
+ return <Kbd data-slot="dropdown-menu-shortcut" className={cn('quill-menu__shortcut', className)} {...props} />
}
export {
diff --git a/packages/quill/packages/primitives/src/index.ts b/packages/quill/packages/primitives/src/index.ts
index 5f4ecd01fa96..b593ea35a5e1 100644
--- a/packages/quill/packages/primitives/src/index.ts
+++ b/packages/quill/packages/primitives/src/index.ts
@@ -1,6 +1,18 @@
import './styles/layers.css'
export { Accordion, AccordionItem, AccordionTrigger, AccordionContent } from './accordion'
+export {
+ AlertDialog,
+ AlertDialogClose,
+ AlertDialogContent,
+ AlertDialogDescription,
+ AlertDialogFooter,
+ AlertDialogHeader,
+ AlertDialogOverlay,
+ AlertDialogPortal,
+ AlertDialogTitle,
+ AlertDialogTrigger,
+} from './alert-dialog'
export {
Autocomplete,
AutocompleteClear,
@@ -25,7 +37,7 @@ export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent }
export { CardGroup } from './card-group'
export { Checkbox, CheckboxIndicator } from './checkbox'
export { Chip, ChipClose, ChipGroup } from './chip'
-export { Collapsible, CollapsibleTrigger, CollapsibleContent } from './collapsible'
+export { Collapsible, CollapsibleHeader, CollapsibleTrigger, CollapsibleContent } from './collapsible'
export { MenuLabel } from './menu-label'
export {
Combobox,
diff --git a/packages/quill/packages/primitives/src/menubar.stories.tsx b/packages/quill/packages/primitives/src/menubar.stories.tsx
index cdeb45472bde..16a3a58c9ad8 100644
--- a/packages/quill/packages/primitives/src/menubar.stories.tsx
+++ b/packages/quill/packages/primitives/src/menubar.stories.tsx
@@ -7,6 +7,7 @@ import {
Menubar,
MenubarCheckboxItem,
MenubarContent,
+ MenubarGroup,
MenubarItem,
MenubarLabel,
MenubarMenu,
@@ -78,17 +79,21 @@ export const WithCheckboxAndRadio: Story = {
<MenubarMenu>
<MenubarTrigger>Format</MenubarTrigger>
<MenubarContent>
- <MenubarLabel>Style</MenubarLabel>
- <MenubarCheckboxItem checked={bold} onCheckedChange={setBold}>
- Bold
- </MenubarCheckboxItem>
+ <MenubarGroup>
+ <MenubarLabel>Style</MenubarLabel>
+ <MenubarCheckboxItem checked={bold} onCheckedChange={setBold}>
+ Bold
+ </MenubarCheckboxItem>
+ </MenubarGroup>
<MenubarSeparator />
- <MenubarLabel>Size</MenubarLabel>
- <MenubarRadioGroup value={size} onValueChange={setSize}>
- <MenubarRadioItem value="small">Small</MenubarRadioItem>
- <MenubarRadioItem value="medium">Medium</MenubarRadioItem>
- <MenubarRadioItem value="large">Large</MenubarRadioItem>
- </MenubarRadioGroup>
+ <MenubarGroup>
+ <MenubarLabel>Size</MenubarLabel>
+ <MenubarRadioGroup value={size} onValueChange={setSize}>
+ <MenubarRadioItem value="small">Small</MenubarRadioItem>
+ <MenubarRadioItem value="medium">Medium</MenubarRadioItem>
+ <MenubarRadioItem value="large">Large</MenubarRadioItem>
+ </MenubarRadioGroup>
+ </MenubarGroup>
</MenubarContent>
</MenubarMenu>
</Menubar>
@@ -97,15 +102,42 @@ export const WithCheckboxAndRadio: Story = {
} satisfies Story
const TIMEZONES = [
- 'Pacific/Midway', 'Pacific/Honolulu', 'America/Anchorage', 'America/Los_Angeles',
- 'America/Denver', 'America/Phoenix', 'America/Chicago', 'America/Mexico_City',
- 'America/New_York', 'America/Toronto', 'America/Halifax', 'America/Sao_Paulo',
- 'Atlantic/Azores', 'Europe/London', 'Europe/Dublin', 'Europe/Lisbon',
- 'Europe/Paris', 'Europe/Berlin', 'Europe/Madrid', 'Europe/Rome',
- 'Europe/Athens', 'Europe/Helsinki', 'Africa/Cairo', 'Europe/Moscow',
- 'Asia/Dubai', 'Asia/Karachi', 'Asia/Kolkata', 'Asia/Bangkok',
- 'Asia/Singapore', 'Asia/Hong_Kong', 'Asia/Shanghai', 'Asia/Tokyo',
- 'Asia/Seoul', 'Australia/Perth', 'Australia/Sydney', 'Pacific/Auckland',
+ 'Pacific/Midway',
+ 'Pacific/Honolulu',
+ 'America/Anchorage',
+ 'America/Los_Angeles',
+ 'America/Denver',
+ 'America/Phoenix',
+ 'America/Chicago',
+ 'America/Mexico_City',
+ 'America/New_York',
+ 'America/Toronto',
+ 'America/Halifax',
+ 'America/Sao_Paulo',
+ 'Atlantic/Azores',
+ 'Europe/London',
+ 'Europe/Dublin',
+ 'Europe/Lisbon',
+ 'Europe/Paris',
+ 'Europe/Berlin',
+ 'Europe/Madrid',
+ 'Europe/Rome',
+ 'Europe/Athens',
+ 'Europe/Helsinki',
+ 'Africa/Cairo',
+ 'Europe/Moscow',
+ 'Asia/Dubai',
+ 'Asia/Karachi',
+ 'Asia/Kolkata',
+ 'Asia/Bangkok',
+ 'Asia/Singapore',
+ 'Asia/Hong_Kong',
+ 'Asia/Shanghai',
+ 'Asia/Tokyo',
+ 'Asia/Seoul',
+ 'Australia/Perth',
+ 'Australia/Sydney',
+ 'Pacific/Auckland',
] as const
export const Overflow: Story = {
diff --git a/packages/quill/packages/primitives/src/menubar.tsx b/packages/quill/packages/primitives/src/menubar.tsx
index 09e67e4dedbf..ac9495723611 100644
--- a/packages/quill/packages/primitives/src/menubar.tsx
+++ b/packages/quill/packages/primitives/src/menubar.tsx
@@ -1,3 +1,5 @@
+import './menu.css'
+
import { Menu as MenuPrimitive } from '@base-ui/react/menu'
import { Menubar as MenubarPrimitive } from '@base-ui/react/menubar'
import * as React from 'react'
@@ -19,7 +21,6 @@ import {
DropdownMenuTrigger,
} from './dropdown-menu'
import { cn } from './lib/utils'
-import './menu.css'
import { RadioIndicator } from './radio-group'
function Menubar({ className, ...props }: MenubarPrimitive.Props): React.ReactElement {
@@ -84,11 +85,10 @@ function MenubarItem({
<DropdownMenuItem
data-slot="menubar-item"
data-inset={inset}
- // Forward variant so the inner <Button render> (which colours bg/text via Quill button variants)
- // receives `destructive` instead of falling back to `default`.
+ // DropdownMenuItem owns destructive styling (red text at rest, red-tinted highlight).
variant={variant}
className={cn(
- "group/menubar-item min-h-7 gap-2 rounded-sm px-2 py-1 text-xs/relaxed focus:bg-fill-hover data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:opacity-50 [&_svg:not([class*='size-'])]:size-3.5 data-[variant=destructive]:*:[svg]:text-destructive!",
+ 'group/menubar-item min-h-7 gap-2 rounded-sm px-2 py-1 text-xs/relaxed focus:bg-fill-hover data-disabled:opacity-50',
className
)}
{...props}
@@ -183,14 +183,26 @@ function MenubarSeparator({
className,
...props
}: React.ComponentProps<typeof DropdownMenuSeparator>): React.ReactElement {
- return <DropdownMenuSeparator data-slot="menubar-separator" className={cn('quill-menu__separator', className)} {...props} />
+ return (
+ <DropdownMenuSeparator
+ data-slot="menubar-separator"
+ className={cn('quill-menu__separator', className)}
+ {...props}
+ />
+ )
}
function MenubarShortcut({
className,
...props
}: React.ComponentProps<typeof DropdownMenuShortcut>): React.ReactElement {
- return <DropdownMenuShortcut data-slot="menubar-shortcut" className={cn('quill-menu__shortcut', className)} {...props} />
+ return (
+ <DropdownMenuShortcut
+ data-slot="menubar-shortcut"
+ className={cn('quill-menu__shortcut', className)}
+ {...props}
+ />
+ )
}
function MenubarSub({ ...props }: React.ComponentProps<typeof DropdownMenuSub>): React.ReactElement {
diff --git a/packages/quill/packages/primitives/src/select.css b/packages/quill/packages/primitives/src/select.css
index a9b89ddca6bd..d893fb406078 100644
--- a/packages/quill/packages/primitives/src/select.css
+++ b/packages/quill/packages/primitives/src/select.css
@@ -60,7 +60,6 @@
.quill-select__content {
position: relative;
z-index: var(--quill-z-popover, 50);
- width: var(--anchor-width);
min-width: 8rem;
max-height: var(--available-height);
overflow: hidden auto;
@@ -76,6 +75,22 @@
transform-origin: var(--transform-origin);
}
+ /* Aligned mode: Base UI shifts the popup left so the selected item's TEXT
+ overlays the trigger's value text (it measures the inset difference —
+ ~4px here from the list padding). The popup must be allowed to outgrow
+ the trigger: pinning width to --anchor-width leaves a sliver of trigger
+ exposed on the right after the shift. The +0.5rem absorbs the shift on
+ the left and overhangs the same amount on the right. */
+
+ /* Also skips the open/close animation — the popup should appear locked to
+ the selected item's position, not bounce around. */
+ .quill-select__content[data-align-trigger='true'] {
+ width: max-content;
+ min-width: max(8rem, calc(var(--anchor-width) + 0.5rem));
+ max-width: var(--available-width);
+ transition: none;
+ }
+
/* When items aren't locked to the trigger, the popup is a normal
dropdown — size it to its widest option (capped at the viewport)
instead of the (often narrow) trigger, so long labels don't clip.
@@ -92,12 +107,6 @@
transform: scale(0.97);
}
- /* Skip anim when item is aligned with trigger — the popup should appear
- locked to the selected item's position, not bounce around. */
- .quill-select__content[data-align-trigger='true'] {
- transition: none;
- }
-
.quill-select__content[data-align-trigger='true'][data-starting-style],
.quill-select__content[data-align-trigger='true'][data-ending-style] {
opacity: 1;
diff --git a/packages/quill/packages/primitives/src/tabs.css b/packages/quill/packages/primitives/src/tabs.css
index 7cf464ec9033..1918dc86f71f 100644
--- a/packages/quill/packages/primitives/src/tabs.css
+++ b/packages/quill/packages/primitives/src/tabs.css
@@ -18,6 +18,7 @@
.quill-tabs__list--variant-default {
background-color: var(--card);
+ border: 1px solid var(--border);
}
.quill-tabs__list--variant-line {
@@ -48,7 +49,6 @@
background-color: var(--background);
border: 1px solid var(--border);
border-radius: var(--radius-sm);
- box-shadow: var(--shadow-sm);
}
.quill-tabs__indicator--variant-line {
@@ -57,18 +57,18 @@
}
.group\/tabs[data-orientation='horizontal'] .quill-tabs__indicator--variant-default {
- top: calc(50% - 1px);
- left: 0;
- width: var(--active-tab-width);
- height: calc(var(--active-tab-height) - -2px);
+ top: 50%;
+ left: -1px;
+ width: calc(var(--active-tab-width) + 2px);
+ height: calc(var(--active-tab-height) + 2px);
transform: translateX(var(--active-tab-left)) translateY(-50%);
}
.group\/tabs[data-orientation='vertical'] .quill-tabs__indicator--variant-default {
top: -1px;
left: 50%;
- width: calc(100% - 6px);
- height: var(--active-tab-height);
+ width: calc(100% - 3px);
+ height: calc(var(--active-tab-height) + 2px);
transform: translateX(-50%) translateY(var(--active-tab-top));
}
@@ -132,7 +132,6 @@
.quill-tabs__trigger:focus-visible {
border-color: var(--ring);
outline: 1px solid var(--ring);
- box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 50%, transparent);
}
.quill-tabs__trigger:disabled,
@@ -146,9 +145,12 @@
pointer-events: none;
}
- .quill-tabs__trigger svg:not([class*='size-']) {
- width: 0.875rem;
- height: 0.875rem;
+ /* Doubled class beats .quill-button's 1rem svg sizing — the trigger renders
+ a Button, so both rules match at otherwise equal specificity and bundle
+ order would decide. */
+ .quill-tabs__trigger.quill-tabs__trigger svg:not([class*='size-']) {
+ width: 0.75rem;
+ height: 0.75rem;
}
.group\/tabs[data-orientation='vertical'] .quill-tabs__trigger {
diff --git a/packages/quill/packages/primitives/src/tabs.stories.tsx b/packages/quill/packages/primitives/src/tabs.stories.tsx
index 6e90841cc623..a33a2e09eb12 100644
--- a/packages/quill/packages/primitives/src/tabs.stories.tsx
+++ b/packages/quill/packages/primitives/src/tabs.stories.tsx
@@ -2,6 +2,8 @@ import type { Meta, StoryObj } from '@storybook/react'
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from './card'
import { Tabs, TabsContent, TabsList, TabsTrigger } from './tabs'
+import { Info } from 'lucide-react'
+
const meta = {
title: 'Primitives/Tabs',
component: Tabs,
@@ -102,7 +104,7 @@ export const Line: Story = {
return (
<Tabs defaultValue="overview" className="w-[400px]">
<TabsList variant="line">
- <TabsTrigger value="overview">Overview</TabsTrigger>
+ <TabsTrigger value="overview">Overview<Info /></TabsTrigger>
<TabsTrigger value="analytics">Analytics</TabsTrigger>
<TabsTrigger value="reports">Reports</TabsTrigger>
<TabsTrigger value="settings">Settings</TabsTrigger>
diff --git a/packages/quill/packages/primitives/src/tabs.tsx b/packages/quill/packages/primitives/src/tabs.tsx
index a992bb9aea07..f429593de63d 100644
--- a/packages/quill/packages/primitives/src/tabs.tsx
+++ b/packages/quill/packages/primitives/src/tabs.tsx
@@ -1,10 +1,11 @@
+import './tabs.css'
+
import { Tabs as TabsPrimitive } from '@base-ui/react/tabs'
import { cva, type VariantProps } from 'class-variance-authority'
import * as React from 'react'
import { Button } from './button'
import { cn } from './lib/utils'
-import './tabs.css'
function Tabs({ className, orientation = 'horizontal', ...props }: TabsPrimitive.Root.Props): React.ReactElement {
return (
@@ -17,17 +18,20 @@ function Tabs({ className, orientation = 'horizontal', ...props }: TabsPrimitive
)
}
-const tabsListVariants = cva('quill-tabs__list group/tabs-list inline-flex w-fit items-center justify-center relative', {
- variants: {
- variant: {
- default: 'quill-tabs__list--variant-default',
- line: 'quill-tabs__list--variant-line',
+const tabsListVariants = cva(
+ 'quill-tabs__list group/tabs-list inline-flex w-fit items-center justify-center relative',
+ {
+ variants: {
+ variant: {
+ default: 'quill-tabs__list--variant-default',
+ line: 'quill-tabs__list--variant-line',
+ },
},
- },
- defaultVariants: {
- variant: 'default',
- },
-})
+ defaultVariants: {
+ variant: 'default',
+ },
+ }
+)
const tabsIndicatorVariants = cva('quill-tabs__indicator', {
variants: {
@@ -75,9 +79,7 @@ function TabsTrigger({ className, ...props }: TabsPrimitive.Tab.Props): React.Re
}
function TabsContent({ className, ...props }: TabsPrimitive.Panel.Props): React.ReactElement {
- return (
- <TabsPrimitive.Panel data-slot="tabs-content" className={cn('quill-tabs__panel', className)} {...props} />
- )
+ return <TabsPrimitive.Panel data-slot="tabs-content" className={cn('quill-tabs__panel', className)} {...props} />
}
export { Tabs, TabsList, TabsTrigger, TabsContent, tabsListVariants }
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index edcb7cfb6d0c..9a8e69465951 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -7,8 +7,8 @@ settings:
catalogs:
default:
'@base-ui/react':
- specifier: 1.4.0
- version: 1.4.0
+ specifier: 1.5.0
+ version: 1.5.0
'@parcel/packager-ts':
specifier: 2.16.4
version: 2.16.4
@@ -537,7 +537,7 @@ importers:
dependencies:
'@base-ui/react':
specifier: 'catalog:'
'@dagrejs/dagre':
specifier: ^1.1.5
version: 1.1.5
@@ -2035,7 +2035,7 @@ importers:
dependencies:
'@base-ui/react':
specifier: 'catalog:'
'@posthog/quill-tokens':
specifier: workspace:^
version: link:../tokens
@@ -2112,7 +2112,7 @@ importers:
devDependencies:
'@base-ui/react':
specifier: 'catalog:'
'@posthog/quill-blocks':
specifier: workspace:*
version: link:../blocks
@@ -5322,8 +5322,8 @@ packages:
resolution: {integrity: sha512-LwdZHpScM4Qz8Xw2iKSzS+cfglZzJGvofQICy7W7v4caru4EaAmyUuO6BGrbyQ2mYV11W0U8j5mBhd14dd3B0A==}
engines: {node: '>=6.9.0'}
- '@base-ui/[email protected]':
- resolution: {integrity: sha512-QcqdVbr/+ba2/RAKJIV1PV6S02Q5+r6a4Eym8ndBw+ZbBILkkmQAyRxXCg/pArrHnkrGeU8goe26aw0h6eE8pg==}
+ '@base-ui/[email protected]':
+ resolution: {integrity: sha512-z1gSAlced1yY+iM+mHDEtIkD8UI3Ebs52MuBPxvV6f5hRutk+xvCH/wuB7hDqDzK9JG5FoMz5nhrqtSs1wjt1A==}
engines: {node: '>=14.0.0'}
peerDependencies:
'@date-fns/tz': ^1.2.0
@@ -5332,11 +5332,15 @@ packages:
react: 18.3.1
react-dom: 18.3.1
peerDependenciesMeta:
+ '@date-fns/tz':
+ optional: true
'@types/react':
optional: true
+ date-fns:
+ optional: true
- '@base-ui/[email protected]':
- resolution: {integrity: sha512-nXYKhiL/0JafyJE8PfcflipGftOftlIwKd72rU15iZ1M5yqgg5J9P8NHU71GReDuXco5MJA/eVQqUT5WRqX9sA==}
+ '@base-ui/[email protected]':
+ resolution: {integrity: sha512-x/PDDCYzoqPpjrdyb3VcyylTI2IjUXEtYDGi5foh7KsnmNJIIaVwA2GLgDH1dps1GgXiJbA60hM+AyuTfQzIvw==}
peerDependencies:
'@types/react': 18.3.27
react: 18.3.1
@@ -25903,21 +25907,21 @@ snapshots:
'@babel/helper-string-parser': 7.27.1
'@babel/helper-validator-identifier': 7.28.5
dependencies:
'@babel/runtime': 7.29.2
- '@date-fns/tz': 1.4.1
'@floating-ui/react-dom': 2.1.8([email protected]([email protected]))([email protected])
'@floating-ui/utils': 0.2.11
- date-fns: 4.1.0
react: 18.3.1
react-dom: 18.3.1([email protected])
use-sync-external-store: 1.6.0([email protected])
optionalDependencies:
+ '@date-fns/tz': 1.4.1
'@types/react': 18.3.27
+ date-fns: 4.1.0
dependencies:
'@babel/runtime': 7.29.2
'@floating-ui/utils': 0.2.11
@@ -26331,7 +26335,8 @@ snapshots:
pprof-format: 2.2.1
source-map: 0.7.6
- '@date-fns/[email protected]': {}
+ '@date-fns/[email protected]':
+ optional: true
'@derhuerst/[email protected]':
dependencies:
diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml
index c54ecf600552..9363317c2fe4 100644
--- a/pnpm-workspace.yaml
+++ b/pnpm-workspace.yaml
@@ -59,7 +59,7 @@ catalog:
# React types
'@types/react': ^18.3.27
'@types/react-dom': ^18.3.7
- '@base-ui/react': 1.4.0
+ '@base-ui/react': 1.5.0
# Other shared
husky: ^7.0.4
lint-staged: ~15.4.3