Watch on YouTubePlayPlays from YouTube. Google's privacy policy (opens in a new tab) applies.
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
- What shadcn/ui is and how it differs from traditional component libraries: you install one component at a time and get its source code.
- shadcn is built on Tailwind and on unstyled, accessible primitives (Radix UI, and now also Base UI and React Aria).
- AI models know shadcn's components well, so they need little extra context to use them.
- The default shadcn look makes many apps look the same; the Create page helps you start from a distinct style.
- How to tell a project uses shadcn: a
components.jsonfile and asrc/components/uifolder. - Two risks with agents:
classNameoverrides that drift from the design language, and hand-rolled components that shadcn already has. - shadcn's official skills help agents keep up with new components and API changes.
- A maintained (paid) Figma kit mirrors shadcn for designing in Figma.
Chapters
- 00:00What shadcn/ui is
- 02:19How shadcn components work
- 04:58Why AI knows shadcn well
- 06:32Escaping the default shadcn look
- 08:56Spotting shadcn in a project
- 09:59Keeping agents consistent with shadcn
- 15:01Docs and the Figma kit
- 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
- 00:10that came up was shadcn UI.
- 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
- 00:24shadcn or who is shadcn?
- 00:27I should rather be asking myself.
- 00:29So if you go to the ui.shadcn.com website, you will find this library of UI components.
- 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.
- 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.
- 00:55You can look him up on X.
- 00:58From what I know, he I think works uh works at Vercel uh as a design engineer.
- 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
- 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
- 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
- 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
- 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.
- 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
- 02:04customization or UI customization capabilities.
- 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
- 02:16access to their true source code.
- 02:19And this is how shadcn was different and was revolutionary at the time when it, you know, first started popping up.
- 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
- 02:36given moment in time.
- 02:38When you import a component like button, let's see.
- 02:41Uh let me find button.
- 02:44Button. Here it is.
- 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
- 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
- 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.
- 03:14The true like the original source code for this particular button is right here on this documentation page.
- 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.
- 03:28All I get is this really nice boilerplate that I can start building up on top of.
- 03:34So shadcn is built on Tailwind, and this is something we already know now.
- 03:40And historically it was based on Radix UI.
- 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.
- 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.
- 04:09But it's not really that easy if you want to do it right.
- 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
- 04:25UI components which are really well implemented from a technical standpoint, but they are not really meant to be used as is.
- 04:33They are more like skeletons for you to further adopt and like style and customize.
- 04:39And shadcn builds on top of these libraries now.
- 04:42Again like historically it was just Radix UI.
- 04:45Over time we started seeing Base UI, React Aria.
- 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.
- 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
- 05:14whole set of UI components for building AI chats or AI experiences.
- 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.
- 05:33But there is one more thing that makes shadcn UI component library especially convenient choice nowadays in the age of AI.
- 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.
- 05:54They know the buttons, they know the inputs, they know exactly the structure of a card component and how to use it.
- 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
- 06:12rules or elaborate uh CLAUDE.md files just for your AI agents to know how to work with your AI components.
- 06:22shadcn is something that Opus knows for the most part right from the get go.
- 06:28So it makes working with it in with AI really really easy.
- 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
- 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
- 06:54this seems or sounds kind of familiar.
- 06:55I have seen that before.
- 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
- 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
- 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.
- 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
- 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
- 07:56and icon library uh you know the curvature of your UI elements and a couple of more things.
- 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
- 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
- 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
- 08:34these command installations or installation commands.
- 08:38It's going to tell these components to look in a very specific way.
- 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
- 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.
- 09:01Now, how can you tell that you are working with shadcn UI components?
- 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
- 09:16a file browser in your in your codebase and you can go and look for a file that is named components.json.
- 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
- 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
- 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.
- 10:00What else is there for us to keep an eye on or watch out when working with shadcn?
- 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
- 10:20comes to overriding the style of UI components.
- 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
- 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.
- 10:47API meaning controls or props that you can use such as size or variant.
- 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
- 11:03property that is going to un uh um like basically let them style whatever styling property they have in mind for this component.
- 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
- 11:25no strict you know design rules to get really quickly out of sync uh when it comes to their design language.
- 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
- 11:44I'm not really a super fan of uh like overriding the style of shadcn components like this.
- 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.
- 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
- 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
- 12:22adding a new variant for that component.
- 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
- 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
- 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
- 13:01of a checkbox rather than importing the one that shadcn already offers.
- 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
- 13:17that shadcn UI library.
- 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
- 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
- 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
- 13:57we have available here in the shadcn UI library.
- 14:00Luckily, there is a very neat thing we can do.
- 14:04We can go over here into the shadcn UI website.
- 14:10Again, make sure you're on the ui.shadcn.com.
- 14:14Make sure you're in the page and then from the left-hand side menu, you can find the skills tab.
- 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.
- 14:32And skills by the way is something that we are going to dive a little bit deeper in one of the next videos.
- 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
- 14:52that you have at your disposal when using shadcn UI component library.
- 14:58So yeah, that is shadcn UI in a nutshell.
- 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
- 15:12these components, which is very likely, I really encourage you to go and give this page a visit.
- 15:19Go through the documentation pages of some of these components.
- 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.
- 15:36And if you want to also make use of shadcn when designing in Figma, there is a very nice unofficial Figma library.
- 15:47And I believe it's also mentioned here in the docs.
- 15:50Let's see. Let me do Figma.
- 15:55And the one that I'm that I have in mind is this one.
- 15:59So the shadcn UI kit by Matt Wierzbicki.
- 16:03So it's a it's a paid library, but it's actively being maintained.
- 16:09You know, the shadcn UI library is something that as I mentioned before, it keeps changing every month.
- 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
- 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.
- 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
- 16:46custom skills.