Claude Code for Product Designers
Lesson 36 of 49, 0 of 49 lessons completed
Sign in
Watch on YouTubePlay

Plays from YouTube. Google's privacy policy (opens in a new tab) applies.

Up next

3.8 Your notes in their repo

Next lesson in 8 s

3.7 The team's kit

Adam explains what shadcn/ui is, why AI models know it so well and why so many apps built with it look alike. Then he shows how to tell a project uses it and how to keep agents building with its components instead of around them.

What you'll learn

  1. What shadcn/ui is and how it differs from traditional component libraries: you install one component at a time and get its source code.
  2. shadcn is built on Tailwind and on unstyled, accessible primitives (Radix UI, and now also Base UI and React Aria).
  3. AI models know shadcn's components well, so they need little extra context to use them.
  4. The default shadcn look makes many apps look the same; the Create page helps you start from a distinct style.
  5. How to tell a project uses shadcn: a components.json file and a src/components/ui folder.
  6. Two risks with agents: className overrides that drift from the design language, and hand-rolled components that shadcn already has.
  7. shadcn's official skills help agents keep up with new components and API changes.
  8. A maintained (paid) Figma kit mirrors shadcn for designing in Figma.

Chapters

  1. 00:00What shadcn/ui is
  2. 02:19How shadcn components work
  3. 04:58Why AI knows shadcn well
  4. 06:32Escaping the default shadcn look
  5. 08:56Spotting shadcn in a project
  6. 09:59Keeping agents consistent with shadcn
  7. 15:01Docs and the Figma kit
  1. 00:00In the previous video, when we asked Claude to uh walk us through like the basics of this new code base that we are onboarding into, one of the names
  2. 00:10that came up was shadcn UI.
  3. 00:13And since this is not the first time this name uh comes up in this video course, in this video, let's finally unpack it and let's ask ourselves what is
  4. 00:24shadcn or who is shadcn?
  5. 00:27I should rather be asking myself.
  6. 00:29So if you go to the ui.shadcn.com website, you will find this library of UI components.
  7. 00:37The title says the foundation for your design system, the foundation here being key uh as it's really all about like customizing the looks of it.
  8. 00:47This library of components has been built and it's been maintained for a couple of years now by this guy who goes by shadcn online.
  9. 00:55You can look him up on X.
  10. 00:58From what I know, he I think works uh works at Vercel uh as a design engineer.
  11. 01:04And um the library of components uh he maintains here uh it's also part partially maintained by or I think it's co-created by community is um a little bit different
  12. 01:15from what they from what typical library of UI components used to look like in an engineering environment or world because you see it wasn't really like like we had
  13. 01:27it as designers in Figma when you know, when we wanted to um had uh if we wanted to like make ourselves make our lives a little bit easier and
  14. 01:37rather than creating all of the UI components from scratch, you know, what we could do is we could go to Figma community, find a UI kit that we like
  15. 01:44and we could duplicate this entire file having instant access to all of the UI components and we were free to do whatever we wanted with these.
  16. 01:52In the engineering world, uh a lot of the UI uh library comp- component libraries, you know, the moment installed them through things like npm, you had very limited uh
  17. 02:04customization or UI customization capabilities.
  18. 02:08You had access to all of these components, but it was really difficult for you to really make them their own because you didn't really or you not always had
  19. 02:16access to their true source code.
  20. 02:19And this is how shadcn was different and was revolutionary at the time when it, you know, first started popping up.
  21. 02:26Because with shadcn, not only you don't install everything at once, and instead you install like one component at a time depending on like what are your needs at a
  22. 02:36given moment in time.
  23. 02:38When you import a component like button, let's see.
  24. 02:41Uh let me find button.
  25. 02:44Button. Here it is.
  26. 02:46So when you import a component like this through a command that go goes like this, and this is something you would run in your terminal, npm shadcn at latest
  27. 02:55add button, what this is going to do, it's going to create a brand new copy of that button component with all of its source code living directly in your
  28. 03:04codebase. And that is totally up to you how you'll decide to um how how you'll decide to like change or customize the styling of this.
  29. 03:14The true like the original source code for this particular button is right here on this documentation page.
  30. 03:19And you can see I have access to all of the Tailwind CSS classes, and I can again like do whatever I want with this button.
  31. 03:28All I get is this really nice boilerplate that I can start building up on top of.
  32. 03:34So shadcn is built on Tailwind, and this is something we already know now.
  33. 03:40And historically it was based on Radix UI.
  34. 03:43So Radix UI is this another library which gives you like foundations for building really nice um like well thought through, but also accessible and well implemented primitive UI components.
  35. 03:58You would think that creating a dropdown with uh let's say uh lists like sublists which you know show up when you hover a particular item is easy.
  36. 04:09But it's not really that easy if you want to do it right.
  37. 04:13this is why libraries such as Radix UI, React Aria, or Base UI are so popular nowadays because the like what they give you are these bare bones unstyled primitive
  38. 04:25UI components which are really well implemented from a technical standpoint, but they are not really meant to be used as is.
  39. 04:33They are more like skeletons for you to further adopt and like style and customize.
  40. 04:39And shadcn builds on top of these libraries now.
  41. 04:42Again like historically it was just Radix UI.
  42. 04:45Over time we started seeing Base UI, React Aria.
  43. 04:48Like in shadcn these components they don't really look different because they like all of this styling layer comes from the interpretation of of this like UI component library.
  44. 05:02And as the UI component library grew over time, nowadays you can see just how much things you can have here including one of the recent additions which is a
  45. 05:14whole set of UI components for building AI chats or AI experiences.
  46. 05:21So this made it a very easy choice for engineers who wanted to move fast without necessarily sacrificing that like that visual or like branded look.
  47. 05:33But there is one more thing that makes shadcn UI component library especially convenient choice nowadays in the age of AI.
  48. 05:41Meaning a lot of the modern AI models such as Opus or OpenAI models are really well trained on the API of the shadcn UI component library.
  49. 05:54They know the buttons, they know the inputs, they know exactly the structure of a card component and how to use it.
  50. 06:03It's not that you need to install a whole of additional or have a lot a lot a whole lot of additional context in the form of skill files or
  51. 06:12rules or elaborate uh CLAUDE.md files just for your AI agents to know how to work with your AI components.
  52. 06:22shadcn is something that Opus knows for the most part right from the get go.
  53. 06:28So it makes working with it in with AI really really easy.
  54. 06:33Um now there is also there is also like a dark side of all of this meaning right now when I have this card on in front of me on
  55. 06:43my screen without like even if you never heard about shadcn UI before just by the look of this UI component you might have the impression that hey this thing
  56. 06:54this seems or sounds kind of familiar.
  57. 06:55I have seen that before.
  58. 06:58The reason for this is because a lot of the like vibe coded apps nowadays just go and take like the the default shadcn look without really going into any
  59. 07:09further UI customization which is you know which is a bummer because uh recently shadcn uh released a very nice new feature uh or like a tab here called create
  60. 07:22which allows you to create um a very strong solid foundation for uh like a super distinct visual style for you to later customize and tweak.
  61. 07:32So all you need to do is go to ui.shadcn.com/create and then use the options here on the left hand side to go and have fun with uh just you
  62. 07:43know changing the way your UI feels starting with the style then we can customize the base color the theme or the accent color and color of charts typography uh
  63. 07:56and icon library uh you know the curvature of your UI elements and a couple of more things.
  64. 08:02When it once it feels right I can say this feels right to me right now but once it feels right, what you can do is get over here to
  65. 08:11the get code tab and you can like choose your tech stack if you know it and then just copy the command and that is going to create this new
  66. 08:21shadcn configuration file in your codebase and that configuration file is going to later instruct all of your new components that you'll keep importing into your app over time through
  67. 08:34these command installations or installation commands.
  68. 08:38It's going to tell these components to look in a very specific way.
  69. 08:42Of course, again, you can do it manually or you can ask Claude to do most of this for you and that is going to work just as fine and
  70. 08:50that is a pretty neat way to have a very a very like a nice starting point in a really short matter of time.
  71. 09:01Now, how can you tell that you are working with shadcn UI components?
  72. 09:06Well, unless your Claude has already told you this in your exploratory conversation, one thing that you can do on your own is go into the like a folders or
  73. 09:16a file browser in your in your codebase and you can go and look for a file that is named components.json.
  74. 09:27This is where the configuration of your shadcn components live and I can actually see the UI like the the name shadcn coming up over here and the style being
  75. 09:37this Radix Nova and also another thing that you can do is you can check out the SRC folder components and you have that when you have that UI subfolder
  76. 09:51with names that look sort of like this, this is another way to tell that hey, these components are most likely coming from shadcn.
  77. 10:00What else is there for us to keep an eye on or watch out when working with shadcn?
  78. 10:06Well, other engineers creating new views uh or new app screens with shadcn UI components sometimes struggle to harness their or like keep their AI agents under control when it
  79. 10:20comes to overriding the style of UI components.
  80. 10:24So um one like standout characteristics of working with uh shadcn UI components is that um let me actually go back and and try to find this uh button component
  81. 10:35example uh is that when you work with uh when you import a shadcn components like this, well it is going to come with some basic API.
  82. 10:47API meaning controls or props that you can use such as size or variant.
  83. 10:52There is nothing that is going to stop you or even worse your AI agent or AI agent of somebody else to go over here and add a class name
  84. 11:03property that is going to un uh um like basically let them style whatever styling property they have in mind for this component.
  85. 11:13And I'm mentioning this because with this kind of a setup with this uh class name being like unrestricted, it is very easy for uh a team of engineers with
  86. 11:25no strict you know design rules to get really quickly out of sync uh when it comes to their design language.
  87. 11:33So that is one thing that I tried to that I try to like um keep my Claude AI uh agents especially uh especially you know um mindful of that
  88. 11:44I'm not really a super fan of uh like overriding the style of shadcn components like this.
  89. 11:51Instead I always encourage my AI agents and I would like oftentimes have a rule that says something along these lines in either CLAUDE.md file or somewhere else.
  90. 12:01I would advise them to just use uh the variants of components and if there is no such a variant to really um uh like like to to suit the
  91. 12:13the the need that I have, then maybe it's a good moment to go into a component file itself and maybe change its API and I don't know, like consider
  92. 12:22adding a new variant for that component.
  93. 12:25Another thing that I find slightly annoying, that I find my AI agents do every now and then, is simply forgetting the fact that we are using shadcn UI components
  94. 12:37and just getting into the habit of creating their own hand-rolled UI implementations of like either just custom divs or creating straight up new UI components which have been built
  95. 12:52which are built and can can be imported from shadcn, but just for some reason these AI agents are going to go and like create for example their own version
  96. 13:01of a checkbox rather than importing the one that shadcn already offers.
  97. 13:06So that is another thing that I try to keep my agents remember that hey, whenever there is a need for a like something new, first up consider importing from
  98. 13:17that shadcn UI library.
  99. 13:19And finally, even though what I said at the beginning is true that a lot of the currently available modern AI models are very heavily trained on this UI kit
  100. 13:32because, you know, the development here is ongoing and we keep seeing new components or like changes to the API of existing components from month to month, sometimes it's difficult
  101. 13:47for our for our AI agents to keep track of everything that is new, which makes them miss out on an opportunity to maybe use this shiny new feature that
  102. 13:57we have available here in the shadcn UI library.
  103. 14:00Luckily, there is a very neat thing we can do.
  104. 14:04We can go over here into the shadcn UI website.
  105. 14:10Again, make sure you're on the ui.shadcn.com.
  106. 14:14Make sure you're in the page and then from the left-hand side menu, you can find the skills tab.
  107. 14:21So, there is an official set of skills which you can install in your in your like either on your computer or in your repository.
  108. 14:32And skills by the way is something that we are going to dive a little bit deeper in one of the next videos.
  109. 14:39Basically, with these skills installed, you give your Claude additional context on, you know, how to use or how to make the best use out of all of the tools
  110. 14:52that you have at your disposal when using shadcn UI component library.
  111. 14:58So yeah, that is shadcn UI in a nutshell.
  112. 15:02I really encourage you when you whatever whether you're thinking of creating in something new from scratch or whether you're onboarding yourself into a codebase that happens to be using
  113. 15:12these components, which is very likely, I really encourage you to go and give this page a visit.
  114. 15:19Go through the documentation pages of some of these components.
  115. 15:24Have a have a read on like the like the proper the properties or the variants that you can find for things like buttons, UIs, drop-down menus, and whatnot.
  116. 15:36And if you want to also make use of shadcn when designing in Figma, there is a very nice unofficial Figma library.
  117. 15:47And I believe it's also mentioned here in the docs.
  118. 15:50Let's see. Let me do Figma.
  119. 15:55And the one that I'm that I have in mind is this one.
  120. 15:59So the shadcn UI kit by Matt Wierzbicki.
  121. 16:03So it's a it's a paid library, but it's actively being maintained.
  122. 16:09You know, the shadcn UI library is something that as I mentioned before, it keeps changing every month.
  123. 16:16And this UI kit here, when you buy it once, you get these updates also very regularly, making sure you have the most up-to-date like Figma mirrors of what this
  124. 16:27UI kit is. So really encourage you to go give that page a visit as well as you prepare to work with with these components.
  125. 16:37So yeah, with that, I'm going to see you in the next video in which we are going to talk a little bit more about our own custom instructions and
  126. 16:46custom skills.

The cheat sheet is for signed-in viewers. Inside: the lesson's prompts ready to reuse, the commands and shortcuts, useful links and what to watch out for.

Sign in to get the cheat sheet

Loading the cheat sheet…