Primitives

Previous

The shadcn-based building blocks in the registry, and how PEx customises them.

The primitives in registry/ui/ are the low-level building blocks every other component is composed from. They track shadcn/ui closely, so their props and behaviour match the upstream docs — what's PEx-specific is the styling.

The curated components documented elsewhere in this section (Forms, Collections, Charts, …) are built on top of these primitives.

How PEx customises primitives

Brand decisions — radius, cursor, colour — live as unlayered data-slot rules in the design system stylesheet (packages/ui-web/src/styles/globals.css), not in the component files. This keeps primitives reinstallable via shadcn add without losing the PEx look. Three semantic radii drive the shapes:

TokenApplied toShape
--radius-controlstandalone controls — Button, Input, Select, Badge, Togglepill
--radius-overlayfloating surfaces — Dropdown, Popover, Tooltip, Select contentrounded
--radius-groupconnected controls — ButtonGroup outer cornersslight

Primitives marked below carry PEx styling overrides; the rest are stock shadcn. To add or customise one, see Adding a Component.

Installing & importing

# pull the component source into your app via the registry
pnpm dlx shadcn@latest add @pex-ui/button
// …or import from the shared package once a component has been promoted
import { Button } from "@pex/ui-web";

See Setup for workspace configuration.

Form controls

PrimitiveDescription
ButtonClickable action with brand variants (primary, fancy, cta, …)
Button GroupConnected row of buttons sharing a single outline
InputSingle-line text field
Input GroupInput with leading/trailing addons
Input OTPOne-time-code entry
TextareaMulti-line text field
LabelAccessible field label
CheckboxBoolean toggle
Radio GroupSingle choice from a set
SwitchOn/off toggle
Toggle / Toggle GroupPressable state buttons
SelectDropdown choice
SliderRange selection
FormReact Hook Form + Zod wiring
Calendar / Date Range PickerDate selection

Layout & containers

PrimitiveDescription
CardBordered content surface
SeparatorDivider line
AccordionCollapsible stacked sections
CollapsibleSingle show/hide region
Aspect RatioConstrains child to a ratio
Scroll AreaStyled scroll container
ResizableDraggable split panels
SidebarApp navigation shell

Overlays & menus

PrimitiveDescription
DialogModal window
Alert DialogConfirmation modal
SheetEdge-anchored panel
DrawerMobile bottom sheet
PopoverFloating content on a trigger
Hover CardPreview on hover
TooltipHint on hover/focus
Dropdown MenuAction menu
Context MenuRight-click menu
MenubarApp-style menu bar
CommandCommand palette / combobox
PrimitiveDescription
TabsSwitch between panels
BreadcrumbPath trail
PaginationPage navigation
Navigation MenuPrimary nav with flyouts

Data display & feedback

PrimitiveDescription
TableStatic data table
BadgeStatus / category pill
AvatarUser image with fallback
AlertInline callout
ProgressDeterminate progress bar
SkeletonLoading placeholder
CarouselSwipeable slides
ChartRecharts wrapper (see Charts)
SonnerToast notifications (see Toast)