Advanced Radix UI
Build rich UI components — without doing any of the boring work.
Taught by
Sam Selikoff
Meet your instructor and learn about the course.
Radix UI has become one of the most popular component libraries in the React ecosystem. It has more than 20 low-level primitives packed with functionality that make building custom UI components an absolute delight.
In this course you'll learn how to work with Radix's primitives by building four components with completely custom designs, interactions, and animations. You'll see how Radix stays out of the way of your styling code so that your components can match the design of your application down to the pixel, while ensuring they still support keyboard navigation, work on any device, and follow expected accessibility patterns.
What people say about our Radix videos
Hey Sam, Radix author here!
I have to say, fantastic job showcasing some of the flexibility our APIs provide — in particular, that blink animation when selecting an item.
Fantastic work 👏
Perfect timing for this video as I'm playing with shadcn/ui components.
I learned more with this video than any I've watched in the past 6 months.
Great Radix content!
Thank you so much for producing such high quality content for free!
Lessons
Lesson 1: Animated Switch
Learn how to work with Radix's unstyled primitives by building a robust switch component.
Chapters
Anatomy of <Switch>
Install Radix's Switch component and learn what it means to render an unstyled component.
Basic styling
Use Tailwind to target Radix's data attributes to style both the active and inactive states.
Customizing the look and feel
Use Tailwind to give our switch a custom design.
Polishing up the details
Refine our design with some shadows and CSS transitions.
Focus state
Learn the difference between focus and focus-visible, and an easy way to design focus states with Tailwind's outline utilities.
Adding a label
Add a label to our switch that preserves expected interactions.
Controlled component
Use our switch to update some external React state.
Uncontrolled component
See how Radix lets us render our switch inside a form so the browser can serialize its values for us.
Lesson 2: Apple Selector Group
Build a dynamic selector group inspired by Apple.com's checkout flow.
Chapters
Refactoring to <RadioGroup>
Install Radix's Radio Group component and add it to an existing UI.
Focus state
Give the items an outlined visual treatment when they're focused with the keyboard.
Dynamic price diff
Update the label of each option based on the selected option's price using React state.
Formatting the diff
Use the browser's native NumberFormat API to format the price as currency.
Uncontrolled component
Ensure the selected value is submitted alongside a form using the name prop.
Lesson 3: iOS Slider
Learn how to add custom interactions to Radix components by recreating the slider from iOS.
Chapters
Anatomy of <Slider>
Install and style a standalone slider component from scratch.
Uncontrolled component
Expose a name prop that allows our component to be used in a form.
Matching the design from iOS
Use Tailwind and Heroicons to give our slider a completely custom look.
Grow interaction
Smoothly expand and scale the slider when hovered with a pointer.
Improving the interaction on mobile
Use touch-action and user-select to prevent unwanted behavior.
Focus state
Learn how to work with Tailwind's group-has-* modifier.
Fixing the focus treatment for pointer interactions
Use React State to avoid the browser's treatment of programmatic focus.
Controlling when the value changes
Intercept Radix's default behavior by turning our slider into a controlled component.
Calculating the pixel distance
Use event data to derive the change in pointer location during a drag.
Translating pixel distance into value units
Scale the pointer's raw movement data into our slider's value range.
Removing magic numbers
Use the slider's width and max/min props to make our interaction fully dynamic.
Clamping and stepping the value change
Update our custom interaction to respect the min/max/step props.
Fixing keyboard functionality on our controlled component
Use onValueCommit to bring back Radix's default keyboard behaviors.
Exposing a controlled interface
Allow callers to use our finished custom slider to update their own React state.
Lesson 4: Animated Toast
Delegate Radix's mounting logic to Framer Motion to animate a list of messages.
Chapters
Anatomy of <Toast>
Install and style a toast message that dismisses automatically.
Adding a close button
Add and style a pre-wired component to dismiss a toast on click.
Triggering a toast with a button
Conditionally render a toast message using React state.
Dynamic message text
Set the toast's description from the button's click handler.
Creating multiple toasts
Use an array to render a new message each time the button is pressed.
Adding initial and update animations
Learn how to compose Framer Motion with Radix using the asChild prop.
Adding exit animations
Use the forceMount prop to delegate unmounting to React and Framer Motion.
Focus state
Style the toast messages and viewport when focused with the keyboard.
Buy Advanced Radix UI
Build rich UI components — without doing any of the boring work.
Buy the course
$199one-time payment
Get everything in Advanced Radix UI.
- 2+ hours of video
- 4 lessons
- Private Discord
- Summaries with code
- Unlimited access to course materials
Lifetime membership
Get lifetime access to every Build UI course, including Advanced Radix UI, forever.
- Access to all five Build UI courses
- Full access to all future Build UI courses
- New videos added regularly
- Refactoring videos on React
- Private Discord
- Summaries with code
What's included
Stream or download every video
Watch every lesson directly on Build UI, or download them to watch offline at any time.
Live code demos
Access to a live demo of each lesson that runs directly in your browser.
Private Discord
Chat with Sam, Ryan and other Build UI members about the lessons – or anything else you're working on – in our private server.
Video summaries with code snippets
Quickly reference a lesson's material with text summaries and copyable code snippets.
Source code
Each lesson comes with a GitHub repo that includes a diff of the source code.
Invoices and receipts
Get reimbursed from your employer for becoming a better coder!