Skip to content

feat(ui): build @vllnt/ui on ui-sdk and drop Radix, cmdk and vaul - #720

Open
bntvllnt wants to merge 45 commits into
mainfrom
feat/ui-sdk-foundation
Open

bntvllnt wants to merge 45 commits into
mainfrom
feat/ui-sdk-foundation

Conversation

@bntvllnt

@bntvllnt bntvllnt commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #719

What

@vllnt/ui drops every Radix package, cmdk and vaul. Its components are now built on Vercel's ui-sdk (@ui-sdk/react + @ui-sdk/core, pinned 0.1.0-beta.7, the newest release that passes the 7-day minimumReleaseAge). Exports, props, class strings and the Radix-facing DOM stay the same.

  • On ui-sdk (31 components): Accordion, AlertDialog, Avatar, Checkbox, Collapsible, Command, ContextMenu, Dialog, Drawer, DropdownMenu, Field, HoverCard, Label, ListBox, Menubar, Meter, NavigationMenu, Popover, ProgressBar, RadioGroup, Rating, ScrollArea, SegmentedControl, Select, Sheet, Slider, Switch, Tabs, Toggle, ToggleGroup and Tooltip, plus everything built from them.
  • The kit's own Slot now handles asChild on Button, Link, Banner, Form and the other non-primitive parts.
  • Compatibility kept for consumers (PaaS console, Maia web):
    • data-state with Radix's values;
    • --radix-* CSS variables, aliased to ui-sdk's;
    • data-radix-scroll-area-viewport;
    • asChild, onOpenAutoFocus/onCloseAutoFocus (with preventDefault()), onEscapeKeyDown, onPointerDownOutside/onFocusOutside/onInteractOutside (with detail.originalEvent), forceMount, delayDuration;
    • *Portal exports, which now render their children in place.
  • Shared helpers live in src/lib and are exported, because registry shims may only import public names:
    • ui-sdk.tsx: Slot, asChildProps, withDataAttributes, focus adapters;
    • ui-sdk-dismiss.tsx: Radix dismissal callbacks on ui-sdk;
    • ui-sdk-menu.tsx: one implementation behind DropdownMenu, ContextMenu and Menubar, which takes each file from about 600 lines to about 100;
    • command-score.ts: cmdk 1.1.1's commandScore, MIT notice kept, identical on 60,000 random cases.
  • pnpm-lock.yaml: 62 packages removed, 2 added.

Left as they are, with a reason

Component(s) Why it stays
Separator Stays a server component
Toolbar, TreeView ui-sdk's keyboard model and markup differ from our tested contract
PasswordInput ui-sdk disables the toggle on a disabled field and hides the value on submit
NumberInput, InputOTP, FileUpload, TagsInput, DateField, TimeField, ColorPicker Different element, role or value contract
Combobox, DatePicker Already on ui-sdk through Popover and Command
Resizable, Carousel, Calendar, Toast Their public types are react-resizable-panels, embla, react-day-picker and sonner
Timeline Would add a tab stop
Pagination Server component
Button, Input, Textarea Server components
CompletionDialog A ui-sdk dialog always covers the viewport, and this one covers its container, so it is rebuilt in place on the kit's focus, Escape and scroll-lock hooks

Evidence

Visual parity. Every Storybook story (890) was screenshotted in light and dark, against a baseline built from main (46d81bb) with Playwright maxDiffPixels: 0 at 1024×720. Open, hover, focus and mobile states were added for the 43 component directories this PR touches: 1,780 tests in total.

  • 1,653 tests pass pixel-identical.
  • 120 failures are animated or random stories (unicode spinners, particles, sparkles, meteors, scramble text, animated text, 3D globe, animated route map). None of them changed or use a migrated part.
    • Comparing main against its own baseline fails 107 of 172 shots in those directories.
    • A second run of this branch fails 106 of 150, a different random subset each time.
  • 1 failure is ProfileSection. Its image loads from an external placeholder host, and the shot passed on rerun. It uses no migrated part.
  • The other 6 were rechecked one at a time with a scripted capture that drives both builds the same way:
    • ToggleGroup hover, ×2: identical (0 px).
      • Cause: the harness hovers the first [tabindex="0"] or button. Radix gave the group root tabindex="0", so on main the harness hovered the group centre (item "I"), and on this branch it hovers "B".
      • Proof: hovering the same item (B, I or U) on both builds gives pixel-identical shots in light and dark, 6 of 6.
    • ModelSelector, ×2: identical (0 px).
      • Cause: the story renders the dialog already open (open: true). Radix portalled it outside #storybook-root, so main had no "open" baseline.
      • Proof: comparing raw screenshots of both builds gives 0 differing pixels for the open dialog, after Tab and at 390 px, in light and dark.
    • NavigationMenu open, ×2: text antialiasing only.
      • What differs: main draws the panel text with subpixel (LCD) antialiasing, 5,410 coloured fringe pixels, and this branch draws it in greyscale. Layout, glyph positions and colours are the same.
      • Root cause, measured: ui-sdk shows the viewport in the browser top layer (popover), and Chrome draws top-layer text in greyscale.
      • Taking the same element out of the top layer reproduces main's exact 5,410 subpixel pixels. Pixel-aligning it does not.
      • ui-sdk has no inline option, so removing this means replacing ui-sdk's NavigationMenu viewport with a hand-built one. Left for the owner to decide (see below).
  • Rerun at 268015f, after the fixes below: a fresh Storybook build against the same main baseline gives the same 1,653 pass / 127 fail. The failing set differs from the first run only in animated stories (a different random subset of spinners, meteors and animated text) and in 4 dark Calendar and RangeCalendar shots, where the only changed pixels are the "today" marker moving from the 24th to the 25th: the date changed between baseline and rerun. Calendar is not migrated.
  • Fixed during review:
    • CompletionDialog was covering the viewport instead of its container;
    • Drawer's bottom border showed in one row, because vaul's backfill ::after was missing;
    • ScrollArea let the x axis scroll;
    • CopyButton's tooltip stayed open after a copy: ui-sdk closes a tooltip on the trigger's click (Radix used pointer down), and CopyButton's trigger dropped that handler;
    • CommandEmpty sat in the listbox as a status live region, which axe rejects (Command and ModelSelector stories). Inside CommandList it is presentational again, as cmdk rendered it;
    • a closed Accordion panel became reachable by Tab once its close animation ended, because ui-sdk clears inert at the end of the transition. The panel now gets inert back.

Gates run locally at HEAD (exit codes):

  • tsc (tsconfig.build.json) 0
  • eslint: @vllnt/ui 0, registry 0
  • check:atomic 0, check:circular 0, check:use-client 0
  • vitest: ui 0 (350 files, 2,850 passed, 7 expected fail); registry 0 (46 files, 483 passed)
  • tsup build 0, size 0, check:dist-imports 0, pack:check 0
  • registry: inline 0, registry:check 0, registry:integrity 0, i18n 0, verify-mdx 0, verify-previews 0 (890 stories)
  • verify-stories 0, privacy denylist 0, commit emails 0
  • Playwright CT, all 239 visual files (451 tests), --update-snapshots=none: 89 pass, 356 have no baseline (CI creates them with --update-snapshots), 5 animated stories drift (BorderBeam, Marquee, UnicodeSpinner, Watchlist, ProgressTracker). main gives the same 356 + 5 locally. The one functional failure, the Accordion keyboard test, is fixed: 15 of 15 runs pass, 13 of 15 fail without the fix, and main passes 20 of 20.
  • CI on 268015f (before the main merge), all passed: Core and Web Quality Gates, E2E (registry next build and Playwright), Build Storybook, Verify Stories, Visual Regression and Storybook Tests (axe on 890 stories, light, dark, glass and solid).
  • Merged main at ced4d3e to pick up fix(native): align expo to ~57.0.34 with exact owner-approved age exceptions #721 (Expo ~57.0.34), which fixes the Native Package Gates failure that main also had. The merge changes no TypeScript and no packages/ui files; the lockfile still has no @radix-ui. Locally on ced4d3e: eslint, tsc (tsconfig.build.json) and vitest (2,850 pass) are green. CI on ced4d3e: all 19 checks pass, including Native Package Gates, required, Web Quality Gates, E2E, Visual Regression and Storybook Tests; GitHub reports the PR as mergeable and CLEAN.

Regression tests added for behaviour I restored after the move:

  • Tabs and ListBox call onValueChange again when the selected item is pressed;
  • an indeterminate menu checkbox item is aria-checked="mixed";
  • dropdown and menubar content are named by their trigger;
  • outside-dismissal callbacks get detail.originalEvent;
  • Command keeps cmdk's ranking;
  • CompletionDialog stays inside its container;
  • CopyButton's tooltip is hidden after a copy while the pointer stays on the button;
  • CommandEmpty is presentational inside the list and a live region outside it;
  • a closed Accordion panel is still inert after its close transition ends.

Each of these tests fails without its fix.

Owner sign-off (2026-11-25)

The items as they were put to the owner:

  • Bundle size. ui-sdk's shared popup runtime is heavier than Radix. The budgets in scripts/size-budget.json move to the measured sizes, in commit chore(ui): size budgets for the ui-sdk runtime.

    Check Before After
    Dialog 67.7 KB (23.1 gz) 111.6 KB (40.8 gz)
    DataTable 186.6 KB 230.3 KB
    TutorialMDX 198.4 KB 251.5 KB
    Every export 2,135 KB (634 gz) 2,317 KB (708 gz)
    Button 25.2 KB 23.1 KB (budget tightened)

    ui-sdk's dialog always bundles its mobile-sheet presentation (about 25 KB). There is one copy of ui-sdk in the bundle.

  • Beta pin. 0.1.0-beta.7 is a pre-1.0 beta.

  • NavigationMenu text antialiasing. Text in an open panel renders in greyscale instead of with subpixel antialiasing, because ui-sdk shows the panel in the top layer (see Evidence). Keeping ui-sdk's NavigationMenu, as this PR does, accepts that. The alternative is a hand-built in-place viewport, which keeps pixel parity but takes this component off ui-sdk.

Known behaviour differences

These are listed in packages/ui/MIGRATION.md.

  • Popups render in the browser top layer, in place, instead of in a portal.
  • A modal sets overflow: hidden on <html> and makes the rest of the page inert.
  • Focus enters a press-opened popup one frame later.
  • A press outside dismisses on pointer up, not pointer down.
  • Tooltip: a press on the trigger closes it on click, not pointer down, so a custom TooltipTrigger asChild child must pass onClick on. A closed tooltip stays in the page, hidden.
  • ToggleGroup: a disabled item stays reachable with the arrow keys.
  • Slider: native range input, so no aria-valuenow.
  • Rating readOnly: radios use aria-disabled.
  • Meter is now a client component.
  • NavigationMenu: viewport text antialiases in greyscale.
  • Command: groups keep their written order, and clearing the search restores the written order.
  • Radix-only props with no ui-sdk counterpart are accepted and ignored: avoidCollisions, sticky, dir, skipDelayDuration, vaul options.

Follow-ups (not in this PR)

  • Native lane: add @ui-sdk/ to bannedImports in packages/ui-native check-boundaries, next to the Radix ban.
  • Resizable: direction="vertical" has no effect on react-resizable-panels v4, which uses orientation. This is an existing bug.
  • Upstream ui-sdk: a public inline Dialog option would let CompletionDialog sit on ui-sdk too.

… select, tooltip and hover-card onto ui-sdk

Replace the Radix primitives behind seven atoms with ui-sdk parts. The public
exports, props, refs and displayName values are unchanged. Radix-only props
(asChild, onEscapeKeyDown, onPointerDownOutside, onInteractOutside,
onOpenAutoFocus, onCloseAutoFocus, delayDuration, forceMount, loop, dir) are
still accepted and mapped to the closest ui-sdk behavior, and the Radix
data-state, data-highlighted, data-side, data-align and data-orientation
attributes and --radix-* CSS variables are still emitted.

Popups no longer inherit the browser [popover] defaults (background,
padding), collision padding defaults to 0 like Radix, and menu content
does not wrap with the arrow keys unless loop is set.
Dialog, Sheet, AlertDialog, CompletionDialog, Command and Drawer now build
on @ui-sdk/react instead of Radix, cmdk and vaul. Public exports and props
stay the same; Radix data-state attributes, asChild, onEscapeKeyDown,
onPointerDownOutside, onInteractOutside, onOpenAutoFocus and
onCloseAutoFocus are kept through compat wrappers. The command empty state
collapses its padding while items match.
…bar onto ui-sdk

Accordion, Tabs, Rating, ListBox, Meter and ProgressBar render ui-sdk parts and
keep their exports, props, ARIA roles, Radix-style data attributes and class
strings. Separator, Toolbar and TreeView stay as they are.
Move what dropdown-menu, context-menu and menubar repeated into
lib/ui-sdk-menu (createMenuParts, each menu passes its class strings),
and the Radix dismissal callbacks (onEscapeKeyDown, onPointerDownOutside,
onInteractOutside, onFocusOutside to details.cancel()) into
lib/ui-sdk-dismiss, which select and navigation-menu reuse and the dialog
family can adopt. Public exports, props and DOM stay as they were.

Fix two Radix regressions on the way: an indeterminate CheckboxItem
exposes aria-checked="mixed", and the dropdown menu and menubar content
is aria-labelledby its trigger. The context menu stays unlabelled, as in
Radix.
ui-sdk's password input disables its toggle with a disabled field and hides
the value on form submit and page hide; the current component does neither.
Port cmdk 1.1.1 commandScore to src/lib/command-score.ts (MIT notice in the
file, full text in command-score.LICENSE) and make it the default match of
Command. ui-sdk accepts a custom score but never reorders composed items, so
CommandList moves the items inside their parent by score, as cmdk does.
Groups keep their place, ties keep the authored order and a cleared search
restores it. Export commandScore and createCommandRanker.
Dialog, Sheet, Drawer and AlertDialog drop their local copies of the dismissal
code for useDismissRoot, useRegisterDismissHandlers and DismissContext from
lib/ui-sdk-dismiss, and use AsChildProps and NarrowPartProps in place of the
local part prop type. Handlers now receive the DOM event itself, and
onFocusOutside is accepted on Dialog, Sheet and Drawer content.
The foundation test setup now supplies the Web Animations stand-in, so the
local stub in drawer.test.tsx goes.
ui-sdk's Dialog always renders in the browser top layer, so the dialog
covered the whole viewport instead of its positioned container. Render in
place again, without ui-sdk's Dialog or Radix, from the kit's own hooks:
useFocusContainment, useEscapeKey and useBodyScrollLock, plus local inert
siblings, outside-press dismissal and a relative body (Radix's scroll lock
did that too, which the parity baseline shows).
ui-sdk's shared popup runtime makes popup-heavy entries heavier than Radix:
Dialog 67.7 KB to 111.6 KB, DataTable 186.6 KB to 230.3 KB, TutorialMDX
198.4 KB to 251.5 KB, every export 2,135 KB to 2,317 KB (minified). Button
drops to 23.1 KB without the Radix Slot, so its budget tightens. TutorialMDX
leaves the per-module cap: the split build counts whole shared chunks, and its
named check budgets the real up-front size.
@vllnt-public-apps

vllnt-public-apps Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

The preview deployment for registry is ready. 🟢

Open Preview | Open Build Logs | Open Application Logs

Last updated at: 2026-11-25 21:35:32 CET

@vllnt-public-apps

vllnt-public-apps Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

The preview deployment for storybook is ready. 🟢

Open Preview | Open Build Logs | Open Application Logs

Last updated at: 2026-11-25 21:32:59 CET

ui-sdk closes a tooltip on the trigger's click, where Radix used pointer
down. CopyButton's trigger dropped the click handler the tooltip passed
in, so the tooltip stayed open after a copy. Forward it, and test the
tooltip's visibility, since ui-sdk keeps a closed tooltip in the page.
ui-sdk renders CommandEmpty as a status live region, which belongs
outside the list. The kit places it inside CommandList, as cmdk did,
and a listbox may hold only options and groups, so axe failed the
Command and ModelSelector stories. Inside the list it is presentational
again, as cmdk rendered it; outside the list it still announces.
ui-sdk's close animation sets inert on the panel and clears it when the
transition ends. React had already rendered inert for the closed panel
and did not write it again, so the closed panel's links became
reachable by Tab once the animation finished. Put inert back whenever
it goes missing from a closed panel, and test it after the transition.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(ui): build @vllnt/ui on ui-sdk and remove Radix

1 participant