Menu

1 / 2

Our Button has 696 call sites, and four of our five busiest public pages contain no button element at all

DEV Community: typescript·Daniel Pertu·about 23 hours ago
#ppGfmrDT
Reading 0:00
15s threshold

CogniPrep's entire design system is one directory:

components/ui/ alert-dialog.tsx badge.tsx button.tsx card.tsx dialog.tsx dropdown-menu.tsx form-input.tsx fullscreen-dialog.tsx input.tsx label.tsx nav-button.tsx password-input.tsx skeleton.tsx textarea.tsx

Enter fullscreen mode

Exit fullscreen mode

Fourteen files, five Radix dependencies, and each Radix package is imported by exactly one of them:

grep -rho "@radix-ui/[a-z-]*" --include = "*.tsx" components | sort | uniq -c # 1 @radix-ui/react-alert-dialog # 3 @radix-ui/react-dialog # 1 @radix-ui/react-dropdown-menu # 1 @radix-ui/react-label # 1 @radix-ui/react-slot

Enter fullscreen mode

Exit fullscreen mode

That encapsulation is the part I would keep: nothing outside components/ui knows Radix exists, so replacing a primitive is a one-file change.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.