-
Notifications
You must be signed in to change notification settings - Fork 50
Migrate UI component library from React Aria to ShadCN 2.0 with BaseUI (breaking change) #836
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
tjementum
wants to merge
55
commits into
main
Choose a base branch
from
migrate-to-shadcn-2.0-and-base-ui
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…Theme with next-themes
… scrollable content
…e dropdown below the trigger instead of overlaying
…for accessibility
…dd icons to destructive dialogs
3a34953 to
f025236
Compare
…ld plugin and proper import conventions
… using CSS variables
f025236 to
57d739a
Compare
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.



Summary & Motivation
Replace the React Aria Components-based UI library with ShadCN 2.0 built on BaseUI primitives.
Why ShadCN:
@base-ui/react) as its headless primitive layer, making this the right time to adopt the new foundationThis migration also delivers better accessibility through Apple HIG-compliant 44px touch targets, a macOS-inspired dark mode theme using OKLCH color space, and consistent focus ring styling across all interactive elements.
tailwind-variantswithclass-variance-authority(cva) and removereact-aria-componentsandtailwindcss-react-aria-componentsdependenciesinput-otplibrary and custom Calendar/DatePicker withreact-day-picker--control-height: 44px,--control-height-sm: 36px,--control-height-xs: 28px) for Apple HIG touch target complianceoutline-ring focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2instead of ShadCN's default ring utilities@rsbuild/plugin-source-buildwith propersourcefield exports for shared-webapp monorepo packagessize-Nutility and replace deprecated social media iconsDownstream projects
This is a breaking change. The entire UI component library has been replaced, affecting every component import and prop API across self-contained systems. This is a significant migration effort.
Recommended migration approach:
The recommended approach is to use Claude Code with the
/ralph-loopcommand for each component migration step. The loop will iteratively fix compile errors, update tests, and verify E2E tests pass until the system is fully working with the new component.Key breaking changes (listed in commit order):
Each component migration commit changes the shared component API. For each one, fix all compile errors and E2E test failures in the downstream self-contained system before moving to the next commit.
"Migrate Button component from React Aria to ShadCN 2.0" (commit 4):
onPressbecomesonClickthroughout downstream code.Each component commit (commits 4-29): As each component is migrated, its React Aria props change to standard HTML/ShadCN equivalents --
isDisabledbecomesdisabled,isRequiredbecomesrequired, etc. Fix usages of that specific component in the downstream self-contained system before moving to the next commit."Migrate Dialog and Modal components from React Aria to ShadCN 2.0" (commit 13): Replace
DirtyModalwithDirtyDialog(from@repo/ui/components/DirtyDialog). Dialog now uses<DialogBody>between header and footer, and<DialogClose render={<Button type="reset" />}>for cancel buttons."Migrate Toast component from React Aria to Sonner and replace custom Theme with next-themes" (commit 19): This commit requires three changes:
Update
your-self-contained-system/WebApp/bootstrap.tsx:Replace
useToast/toast.add(...)with Sonner'stoast.success(...)/toast.error(...)throughout the self-contained system.Add dark mode flash-prevention script to
your-self-contained-system/WebApp/public/index.htmlafter the existing nonce script:"Migrate Heading and Text components from React Aria to native HTML elements" (commit 24): Replace
<Heading>and<Text>with native<h1>-<h4>and<p>elements."Remove remaining React Aria Component dependencies and complete ShadCN 2.0 migration" (commit 31): Update
your-self-contained-system/WebApp/routes/__root.tsx-- remove the<ReactAriaRouterProvider>wrapper from the component tree (keep the children as-is):-import { ReactAriaRouterProvider } from "@repo/infrastructure/router/ReactAriaRouterProvider";"Remove custom Image component in favor of native img with localized alt text" (commit 43): Replace
<Image>with native<img>with localizedalttext."Enable hot reload for shared-webapp monorepo packages with source build plugin and proper import conventions" (commit 47): Update
your-self-contained-system/WebApp/rsbuild.config.tsto add the source build plugin:+import { pluginSourceBuild } from "@rsbuild/plugin-source-build";Add to rspack config:
watchOptions: { - ignored: ["**/tests/**", "**/playwright-report/**"] + ignored: ["**/tests/**", "**/playwright-report/**"], + followSymlinks: true + }, + snapshot: { + managedPaths: [] }Add the plugin:
Custom components: Any custom components built on React Aria primitives need to be rebuilt using ShadCN 2.0 patterns. This includes replacing
react-aria-componentsimports with BaseUI/ShadCN equivalents, replacingtailwind-variants(tv()) withclass-variance-authority(cva()), and replacingfocusRingutility withoutline-ring focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2. Look at the migrated components in shared-webapp/ui/components as reference for the new patterns.Look at the changes in Back Office as a reference for what needs to change in downstream self-contained systems.
Checklist