Skip to content

Design in Code Once You Have a Design System

April 3, 2025 at 03:22 PM

Note: This is not a blog, it's a semi-private digital garden with mostly first drafts that are often co-written with an LLM. Unless I shared this link with you directly, you might be missing important context or reading an outdated perspective.


Once you have a solid design system in place, for React apps, the most efficient approach is often to design directly in code. This is particularly true for standard software products like SaaS applications.

The old downsides that no longer apply

At Quora, all designers were required to code as early as 2011. This had some upsides but looking back it created some severe downsides:

Code is now so cheap that this isn’t a problem any more.

Enforcement via Cursor Rules

One of the most useful things I do for the team is keep a cursor rules file that enforces the design system. It varies by project but the base version looks like this:


# Your rule content

- Always use ShadCN UI components when possible.
- Use Tailwind CSS for styles whenever possible.
- Avoid introducing new colors. There is an existing ShadCN UI theme. Reuse that.
- Trust default settings for margin, padding, roundedness and colors. don't add opinions like that each time.
- We are using a standard ShadCN themes including dark mode settings using :root and .dark. Always do colors in a way that respects dark mode.
- Check components/ for existing components for re-use and double check with the user if something seems reusable.

Benefits

  1. Faster Iteration: Changes can be implemented and tested immediately, with rapid feedback loops
  2. Better Consistency: Direct use of design system components ensures adherence to standards
  3. Reduced Documentation: The code itself serves as documentation, eliminating need for redlines and handoffs
  4. Improved Collaboration: Designers and developers work in the same medium
  5. Representative Data: Especially important for AI products where content is the product - working directly with real data flows