A quick tutorial to get you up and running with Radix Primitives.
In this quick tutorial, we will install and style the Popover component.
Install Radix Primitives from your command line.
Import and structure the parts.
Add styles where desired.
Here's a complete demo.
import * as React from "react";import { Popover } from "radix-ui";import "./styles.css";const PopoverDemo = () => (<Popover.Root><Popover.Trigger className="PopoverTrigger">More info</Popover.Trigger><Popover.Portal><Popover.Content className="PopoverContent" sideOffset={5}>Some more info…<Popover.Arrow className="PopoverArrow" /></Popover.Content></Popover.Portal></Popover.Root>);export default PopoverDemo;
The steps above outline briefly what's involved in using a Radix Primitive in your application.
These components are low-level enough to give you control over how you want to wrap them. You're free to introduce your own high-level API to better suit the needs of your team and product.
In a few simple steps, we've implemented a fully accessible Popover component, without having to worry about many of its complexities.