zahid ansari
Building scalable systems by applying mental models to code and architecture.
Website
Install this app to stay connected and in the loop.
Building meaningful experiences one pixel at a time 😉.
Made with by Zahid
views
zahid ansari
Building scalable systems by applying mental models to code and architecture.
Website
Install this app to stay connected and in the loop.
Building meaningful experiences one pixel at a time 😉.
Made with by Zahid
views

Share
Stop copying generic components. Learn how to extend ShadCN to build a unique, maintainable design system for your brand.
ShadCN UI took the React world by storm because it's not a library—it's copy-paste code you own. But how do you maintain consistency as your app grows?
In a team setting, everyone started modifying the base ShadCN components differently. We had 5 different button styles and inconsistent spacing. We needed a centralized token system.
Since ShadCN uses Tailwind, we manage our design tokens (colors, radius, spacing) in
1tailwind.config.jsDon't hardcode hex values in components. Use semantic names.
1// tailwind.config.js
2module.exports = {
3 theme: {
4 extend: {
5 colors: {
6 brand: {
7 50: '#fef2f2',
8 500: '#ef4444', // Our primary red
9 900: '#7f1d1d',
10 }
11 }
12 }
13 }
14}Wrapping a base component to enforce brand guidelines.
1import { ButtonString } from '@/components/ui/button';
2import { cn } from '@/lib/utils';
3
4interface ActionButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
5 variant?: 'primary' | 'ghost'; // Restrict to only brand-approved variants
6}
7
8export const ActionButton = ({ className, variant = 'primary', ...props }: ActionButtonProps) => {
9 return (
10 <ButtonString
11 className={cn(
12 "uppercase tracking-widest font-bold", // Brand override
13 variant === 'primary' && "bg-brand-500 hover:bg-brand-900",
14 className
15 )}
16 {...props}
17 />
18 );
19};1components/ui/button.tsx1className1--primary1/designShadCN gives you a head start, but your discipline with Tailwind config and TypeScript interfaces makes it a system.
Tech Stack: ShadCN, TailwindCSS, TypeScript