Let's Build a Component Library Using Shadcn's UI Components

  Рет қаралды 21,404

Raj talks tech

Raj talks tech

Күн бұрын

A detailed code-walkthrough of how I built my components library using shadcn-ui components from ui.shadcn.com
Github repo - github.com/rajeshdavidbabu/sh...
Timecodes:
0:00 - What are we building ?
1:03 - Requirements for a component library
2:20 - Building the library template
3:43 - Cleaning up the template
4:23 - Setting up shadcn configs
6:50 - Setting up tailwind build process
7:47 - Setting up tsconfig
8:11 - Setting up vite-config and package.json
10:38 - Adding more components to the mix
11:06 - Testing the library with an app
15:30 - Avoiding classname clashes
16:08 - Removing base-css from tailwindcss
16:47 - Github repo

Пікірлер: 46
@akahades11
@akahades11 Жыл бұрын
You deserve more recognition. Keep up the good work! I liked and subscribed in hopes of more quality contents like this.
@raj_talks_tech
@raj_talks_tech Жыл бұрын
Happy that you found value, will try and do my best !
@Mohammed-019
@Mohammed-019 Жыл бұрын
This is the video I was looking for, I am wait for more quality contents like this.❤
@raj_talks_tech
@raj_talks_tech Жыл бұрын
Glad you liked it! Will try to come up with more quality content
@yashkhd1100
@yashkhd1100 Жыл бұрын
This was great...liked and subscribed..!! One addition with this already great video can be setting up pro grade library structure with Nx or Turbo workspace
@raj_talks_tech
@raj_talks_tech Жыл бұрын
Thanks Yash. I am a barebones guy, I like minimal build-tooling setup and scale it based on my needs. Some CLI tools have a lot of boilerplate !
@tiagoagm
@tiagoagm 10 ай бұрын
Very good man. Great tutorial. Thanks
@raj_talks_tech
@raj_talks_tech 10 ай бұрын
Cheers bud. Glad you found it useful !
@Assoehosselaar
@Assoehosselaar Жыл бұрын
Amazing video!
@raj_talks_tech
@raj_talks_tech Жыл бұрын
Glad you found it helpful !
@pluraltest9242
@pluraltest9242 Жыл бұрын
Awesome content
@raj_talks_tech
@raj_talks_tech Жыл бұрын
Thanks for the feedback !
@DioArsya
@DioArsya 11 ай бұрын
wow this is so cooool 🎉
@user-ge6fi4iy6q
@user-ge6fi4iy6q 6 ай бұрын
Yeay!, my subs make it hit 1k. thank you for your hard work and share to the people
@raj_talks_tech
@raj_talks_tech 6 ай бұрын
Thanks for the love !!!
@Shubham-yc6nz
@Shubham-yc6nz 11 ай бұрын
Thanks quality content. I didn't understand everything but not bad
@raj_talks_tech
@raj_talks_tech 11 ай бұрын
Appreciate the feedback, can you tell me what you dint understand so that I can improve my next videos
@mrbanana6969
@mrbanana6969 3 ай бұрын
Nice tutorial. I set my test app to be ts instead of js and the variant props (i.e. variant and size for Button) are not typed. So there is no intellisense/ I can essentially add any prop to the button in importing apps, despite the d.ts files for the button being build properly. any ideas why this would be ?
@raj_talks_tech
@raj_talks_tech 3 ай бұрын
Not sure looks like a dev environment problem. Never tried this setup, usually if you are using JS it shouldn't complain unless u add a //@ts-check at the top of the file
@vuluu4066
@vuluu4066 11 ай бұрын
Although we have the tree-shacking for the components, the shadcn-ui-library-starter/dist/style.css still includes css of all the exposed components. Do you have any solutions to solve it?
@raj_talks_tech
@raj_talks_tech 11 ай бұрын
Hey, Thanks for the question I haven't tried this out yet, but it could be that this is a limitation of tailwindcss. In the final build of your app, do you see tailwindcss purging unused css ?
@vuluu4066
@vuluu4066 11 ай бұрын
​@@raj_talks_tech A potential solution is that setting up a monorepo for the Component Library. Each component has their own Vite config to build and to expose js, css artifacts.
@raj_talks_tech
@raj_talks_tech 11 ай бұрын
That could work. But isn't that an overkill ? I assume chakra-ui had such a setup like that but they never seem to recommend it. But yeah should work ! Or you could try pandacss instead of tailwindcss
@eca8799
@eca8799 2 ай бұрын
is this possible to do in an existing app project?
@raj_talks_tech
@raj_talks_tech 2 ай бұрын
Should be if you have tailwindcss support
@JoshPalmeroc
@JoshPalmeroc 19 күн бұрын
Do you know how to include the css within the components automatically? It would be nice if the consumer of the library doesn't additionally need to import a css file. Thanks for the video btw very helpful!
@raj_talks_tech
@raj_talks_tech 19 күн бұрын
U could write ur own plugin for tailwind, or just build and import the css file
@CardCollectorKing
@CardCollectorKing 11 ай бұрын
Any possibility of going through form components using shadcn?
@raj_talks_tech
@raj_talks_tech 11 ай бұрын
Hey, I will add it to my list of things to consider. Thanks for the feedback !
@jamesnelson174
@jamesnelson174 11 ай бұрын
Great tutorial, How can i build my own npm package from shadcn and only use and build the only components i want. i want to have it on npm package too. I want to be able to use it in other projects not just by copy pasting. Thank you... Anticipating your response.
@raj_talks_tech
@raj_talks_tech 11 ай бұрын
Hey James, Thanks the code is in the description and you just have to do an npm build and publish it to the public npm registry, and you are good to go! In your target apps, you can add them as an npm module and use it!
@jamesnelson174
@jamesnelson174 11 ай бұрын
@@raj_talks_tech thanks for the reply. Can u do an example on ur channel so we all learn.? Thank you again
@raj_talks_tech
@raj_talks_tech 11 ай бұрын
Will consider it for future videos !
@JD-eu8re
@JD-eu8re 9 ай бұрын
what do we change so that we don't have to install Tailwind in the consumer App ?
@raj_talks_tech
@raj_talks_tech 9 ай бұрын
I mean you dont have to, you only have to import the index.css from this library you are building. Once your library bundle is ready then you can simply work with that. Look at the example project !
@Phantom-pj1ls
@Phantom-pj1ls 10 ай бұрын
What about if I dont want to use Tailwind? Can I still use shadcn?
@raj_talks_tech
@raj_talks_tech 10 ай бұрын
Most likely not. Because all the components still use tailwind classes heavily.
@Phantom-pj1ls
@Phantom-pj1ls 10 ай бұрын
@@raj_talks_tech Yeah it sucks! It's an awesome tool and I hope someday we can use it with other than Tailwind! I had to make some tweaks even to get basic color change between active/inactive tabs!
@raj_talks_tech
@raj_talks_tech 10 ай бұрын
​@@Phantom-pj1ls Or you can try and convert the tailwind css classes to css-module classes and use them like a normal CSS. That would also be an option.
@Phantom-pj1ls
@Phantom-pj1ls 10 ай бұрын
@@raj_talks_tech I could but that wasn't the problem! The problem is that for some reason this data-[state=active]: "bg color here" doesn't seem to work css directly like in Tailwind! I had to use a hook to toggle between active tabs and with that state changing color!
@Randomguy48279xyz
@Randomguy48279xyz 11 ай бұрын
👍
@waffle-codes-js
@waffle-codes-js Жыл бұрын
I promise I'm not trying to be a jerk, I had a hard time with the word as well.. Component is pronounced: Kuhm-poh-nuhnt. The first O makes more of an 'UH' sound, The second "o" sounds the same as the letter, e.g. "oh".
@raj_talks_tech
@raj_talks_tech Жыл бұрын
haha yes you are right. I often miss pronounce it. Thanks for the feedback!
@mujtabakamal9538
@mujtabakamal9538 10 ай бұрын
How can I import this library in NextJs app
@raj_talks_tech
@raj_talks_tech 10 ай бұрын
You can publish it and then import it. But if you are using Next.js then I would say follow the instructions for setting up the library at ui.shadcn.com
@mujtabakamal9538
@mujtabakamal9538 10 ай бұрын
thanks
shadcn/ui - Theming Wrapped in a Tailwind Plugin/Preset
30:14
simonswiss
Рет қаралды 46 М.
The Anti Component Library
10:35
Huntabyte
Рет қаралды 45 М.
Is it Cake or Fake ? 🍰
00:53
A4
Рет қаралды 17 МЛН
Watermelon Cat?! 🙀 #cat #cute #kitten
00:56
Stocat
Рет қаралды 27 МЛН
100❤️
00:20
Nonomen ノノメン
Рет қаралды 70 МЛН
1🥺🎉 #thankyou
00:29
はじめしゃちょー(hajime)
Рет қаралды 84 МЛН
Large Tailwind Components - What to do About All Those Classes
25:18
This UI component library is mind-blowing
8:23
Beyond Fireship
Рет қаралды 588 М.
React UI Library Structure, Storybook and Tests
22:50
Jack Herrington
Рет қаралды 48 М.
Top 10 CSS One Liners That Will Blow Your Mind
13:34
developedbyed
Рет қаралды 905 М.
Build And Publish A React Component Library
24:02
PortEXE
Рет қаралды 98 М.
Build a UI Library with React, Typescript, TailwindCSS and Storybook
1:03:20
Code With Gionatha
Рет қаралды 24 М.
The GOAT of React UI Libraries
19:48
CoderOne
Рет қаралды 43 М.
Create a library using Vite lib mode
30:00
Alvaro Dev Labs
Рет қаралды 18 М.
10 common mistakes with the Next.js App Router
20:37
Vercel
Рет қаралды 182 М.
МОЩНЕЕ ТВОЕГО ПК - iPad Pro M4 (feat. Brickspacer)
28:01
ЗЕ МАККЕРС
Рет қаралды 77 М.
Настоящий детектор , который нужен каждому!
0:16
Ender Пересказы
Рет қаралды 345 М.
keren sih #iphone #apple
0:16
kadangaruan
Рет қаралды 1,7 МЛН
Купил этот ваш VR.
37:21
Ремонтяш
Рет қаралды 231 М.
Bardak ile Projektör Nasıl Yapılır?
0:19
Safak Novruz
Рет қаралды 6 МЛН
How To Unlock Your iphone With Your Voice
0:34
요루퐁 yorupong
Рет қаралды 23 МЛН