Hello! I recently made an updated Storybook 7 crash course here 👉 kzbin.info/www/bejne/eaaqi5qPpJtgjrs
@gavdev122 жыл бұрын
Perfect video for someone who knows react but has never made a package before. Love it
@stevesmith06246 ай бұрын
I was looking for resources on creating a design system with React, this was the perfect video for it. Thanks alot!
@ya21382 жыл бұрын
After searching for a while of this topic, you may be the only one who explain the doc section even with tsdx. Damn awesome, thank you dude.
@mariusespejo2 жыл бұрын
Glad to help!!
@AwakeningofAI3 жыл бұрын
this was precisely what I was looking for. great tutorial mate. neat and clean concepts.
@mariusespejo3 жыл бұрын
Glad you liked it!
@OliverKelso2 жыл бұрын
This is great man, thank you. I've recently been thrown into React and Storybook, coming from Vue. I was having a lot of trouble understanding what the real benefit of Storybook was, but this really cleared up a lot of questions I has having! Thanks!
@mariusespejo2 жыл бұрын
One big benefit, which I don’t remember if I mentioned in the video: is that it promotes this idea of developing “component first”. Rather than the usual first you make a page then, you add layout, then you add components within. With storybook you can decide to go bottom up, from component to page. Which in my opinion encourages really thinking about having good component boundaries and ultimately having a really good component API. Also this video is already a bit old and the newest storybook 6.5 has some really cool features such as various testing tools that you can use for unit testing
@OliverKelso2 жыл бұрын
@@mariusespejo Absolutely, and it was when you said "A bottom up approach" is when the light bulb went off in my head. Again thank you!
@iamchiragarora Жыл бұрын
As of 24th May 2023, after installing react+storybook template with tsdx, storybook is not a part of dependencies. So I faced multiple errors like "start-storybook" is not recognized. I had to add it as a dependency and then run npx storybook@next automigrate to fix the issue.
@mariusespejo Жыл бұрын
Thanks for the note. It seems tsdx is not much maintained anymore unfortunately.
@fabbyptc2 жыл бұрын
Man, I have no words enought to thank you! You've saved me! I had to create a library for work and failed with all the tutorials I've tried. Your tutorial was the one that resolved my problem. Thanks a lot!
@mariusespejo2 жыл бұрын
No problem! Happy to have helped 🙂
@hw7416 Жыл бұрын
You are a blessing! Thank you!
@andybliss59653 жыл бұрын
Thanks for this nice video. I need this for my work. What's quite funny is you suddenly sound British like my when you pronounce 'Button'
@oguzhanbayrak8046 Жыл бұрын
If you are watching this video after storybook published newest version(^7.0.*) of storybook, you will encounter problem that's your storybook server couldn't be initialize. because of cound't found "start-storybook". Because of storybook changed "start-storybook" to "storybook dev". You can run this command for autofix your storybook config. "npx storybook@next automigrate". and thanks for video :)
@mariusespejo Жыл бұрын
Thank you for the tip! I actually am planning to create an updated v7 video covering some of the new features, stay tuned!
@samueldusek703 жыл бұрын
Hi Marius, thanks for this video. It was exactly what I was looking for. Keep the good work. :)
@icutshapes81642 жыл бұрын
Exactly what I was looking for. Thanks for introducing me to TSDX.
@mariusespejo2 жыл бұрын
Tsdx is great! Glad to help 🙌
@johnddonnet51512 жыл бұрын
Finally learnt how to correctly create a button :D
@mariusespejo2 жыл бұрын
Gotta start somewhere 😄
@codefork942 жыл бұрын
phenomenal walkthrough 🔥🔥🔥
@sergeykahnwald66402 жыл бұрын
Storybook is a cool package) But there are some cases when we don’t need all the power of storybook, but just a simple “test page” with all our components where we can play with its props. There is one package that works just fine for this, called storybox-react
@amitavroydev2 жыл бұрын
I am not sure if it's an isolated event, but when I run the tsdx create command.. it fails and hence I am not able to install the stuff and even get started.
@mariusespejo2 жыл бұрын
I assume it tells you in the install logs why it failed?
@amitavroydev2 жыл бұрын
@@mariusespejo Might sound so silly but I tried to install it on a different folder and it just worked which really doesn't make sense but yeah it happened. So, for now I guess I am able to work. However, I am for sure going to look at what just happened. Because I had even tried using different node versions using NVM to check... :) Anyways, thanks for the reply
@jihyunlee13402 жыл бұрын
same here. I got the same problem and stucked at the beginning
@amitavroydev2 жыл бұрын
@Jihyun Lee now have you solved the problem
@jihyunlee13402 жыл бұрын
@@amitavroydev Yup! I tried it again on another computer installed node v14 it works perfectly. I feel like I struggled for nothing...🤣
@devendrasaroj89192 жыл бұрын
Got mdx running through this tsdx, otherwise with standard setup I was getting errors for mdx files. Thanks for tutorial.
@muxammad27772 жыл бұрын
How did you run it, I have done exactly like him added mdx efter |, and maked i file under stories and called the file Button.histories.mdx .. when I'm writing something in the file i see there are something wrong. since the color is the same for (import ) and the other text.
@MrIgorii3 жыл бұрын
Noice man, so clear and well structured
@mariusespejo3 жыл бұрын
thanks Igor 🙏
@LeslieDuan Жыл бұрын
great content, very informative
@jacqueskorb8792 жыл бұрын
Thank you. All good so far!
@jaammmiiii3 жыл бұрын
Great tutorial! Thanks! Can you share your extension/settings for VSCode so it auto-formats (Prettier) on save? I've installed the MDX extension and while it does provide syntax highlighting, it doesn't help with formatting.
@mariusespejo3 жыл бұрын
I don’t have auto format on save, I find it sometimes tries to format too early that way (while I’m still typing). I don’t use anything for formatting other than just prettier, it also works for markdown. Sometimes I edit out me doing right click and selecting format so it might seem like I’m formatting automatically when I’m not. I believe I’ve also used Markdown All In One extension which is really nice and can also do formatting I think
@regilearn21383 жыл бұрын
It would be grate if you can do a video adding material ui to this setup
@mariusespejo3 жыл бұрын
I mean you can do that if you’re maybe using storybook as docs for your components in an app, but really the intent of this video was if imagine you were making your own version of material-ui, your own component library. In that case it wouldn’t be something I’d add to this setup, but instead my own styling strategy like styled-components or something similar
@anhnguyenduy10773 жыл бұрын
Awesome tutorial. Thank you very much
@mariusespejo3 жыл бұрын
You’re welcome!
@AlEgorova Жыл бұрын
Thanks for video! Github's repo would be helpful )))
@magdasok-f2i2 жыл бұрын
great video! Thanks, Marius :)
@mariusespejo2 жыл бұрын
You’re welcome!
@shahmirjadoon35872 жыл бұрын
Very good video. Helped alot
@mariusespejo2 жыл бұрын
Glad it helped!
@diegoscastanho2 жыл бұрын
Amazing, thank you!
@yourfavoritefounder72032 жыл бұрын
Nice job!
@parthasarathimondal71902 жыл бұрын
Hey when I am creating a secondary button, I am getting no stories up there for secondary button but the default button is showing up.
@mariusespejo2 жыл бұрын
Did you create the secondary story itself?
@skoizumi2911013 жыл бұрын
Thanks for detail video on storybook and react. When starting new application with the new style do we develop two react applications? One works with storybook and the other for real application?
@mariusespejo3 жыл бұрын
You can think of storybook as simply a alternative development environment which also acts as documentation for your components, so it has nothing to do with the number of applications that you would have. Whatever component you develop in storybook should be reusable in your actual applications
@none0n Жыл бұрын
What if I want to publish each component into individual packages? Could you check out Turbo and how us how to set it up? Thanks.
@mariusespejo Жыл бұрын
All you need are separate builds and individual publishing.. yes you can also do a monorepo with turborepo
@none0n Жыл бұрын
@@mariusespejo I finally got this sorted out
@none0n Жыл бұрын
@@mariusespejo thank you
3 жыл бұрын
Thanks man, very informative video
@mariusespejo3 жыл бұрын
Glad it’s helpful!
@ap863 жыл бұрын
Thanks for the walkthrough 👍Have you managed to get mdx to be type safe when using typescript? Editor doesn't complain about errors, and build doesn't break when I pass an invalid value to a prop. This makes it pretty fragile. But I love the idea of using mdx
@mariusespejo3 жыл бұрын
Hmm that’s a good point, I haven’t looked into that yet. It looks like folks have opened a ticket on it but it doesn’t sound like there is any traction: github.com/microsoft/TypeScript/issues/36440
@ap863 жыл бұрын
@@mariusespejo yeah it seems so. Have to go with tsx for now and follow the progress on types in mdx files. Thanks for replying 👍😊
@shivanshpatel40722 жыл бұрын
Awesome video 🤩
@mariusespejo2 жыл бұрын
🙂
@LithiumFireX2 жыл бұрын
How do you apply conditional styles to more than two variants? Ternary operators only support two variants.
@mariusespejo2 жыл бұрын
You technically can chain ternaries but that would be ugly lol. What I would suggest is creating maps for things that vary, e.g. const paddingByVariant = { sm: 10, md: 20, lg: 30 }; Then in your code you just do a lookup like: paddingByVariant[props.variant]
@natikranz44073 жыл бұрын
Hello, great tutorial! Is there a way that I can use styled-components on project? I've searched many erros on build with it
@mariusespejo3 жыл бұрын
yes absolutely! you can use any CSS-in-JS solution including styled-components, emotion, etc. it's actually simpler to use those in my opinion because then you don't have to worry about css processors and such
@saisudheerreddy26572 жыл бұрын
Hello Marius, Your video makes me better understanding the storybook. but I have one confusion is the storybook end-user UI builder or it's just for the developer documentation?
@mariusespejo2 жыл бұрын
It can serve both purposes! You can use it to develop components in isolation and once you’re happy with your component API you can integrate it with your actual app
@saisudheerreddy26572 жыл бұрын
@@mariusespejo Thanks a lot
@erickllerenas67512 жыл бұрын
How to decide which files to export and which to exclude based on good practices? (Im talking about the index.js file where you export all your components)
@mariusespejo2 жыл бұрын
Well basically whatever you want exposed to consumers, and even better things that you’ve actually documented usage for
@erickllerenas67512 жыл бұрын
@@mariusespejo But there should be a script that generates the index for this file, what do you think?
@mariusespejo2 жыл бұрын
I mean that’s up to you, depends on how complex it is for you to just write the index file
@shuaib-hasan-akib3 жыл бұрын
Hello Marius, great video. Please, make a project with React, TS, and Redux.
@mariusespejo3 жыл бұрын
Will do soon
@Gusfaria113 жыл бұрын
This is great. Thank you. Any ideas on how to structure the css? Is this on top of webpack?
@mariusespejo3 жыл бұрын
really up to you, but I personally like css-in-js solutions for React stuff. I mention towards the end of the video storybook is built with webpack while the code/package itself is compiled with rollup. So if you decide to add a specific css loader, you just have to work with both configurations
@mk98343 жыл бұрын
interesting video as always!
@mariusespejo3 жыл бұрын
glad you think so! thanks!
@AdityaBrahmin7 ай бұрын
Thank, but apart from that try to explore about real usage cases like not explaining storybook just apply it in any react application.
@muxammad27772 жыл бұрын
thank you for the video. what is the meta been used for ? I dont understand there where you export Meta what is that ? thank you brother
@mariusespejo2 жыл бұрын
Meta is basically metadata for the storybook view, e.g. the title you provide there determines the title for that component’s set of stories on the storybook ui
@muxammad27772 жыл бұрын
@@mariusespejo ooh okay I understand now thank you very much.
@luisalonsoramirezcamareno22233 жыл бұрын
great video but i'm stuck cause of this err: Unexpected default export without title: {"includeStories":[],"parameters":{"docs":{}}} . Help! It happened when i was trying to create the Button.stories.mdx file
@MaxViews247 ай бұрын
how to deploy storybook in static site at the same time library to npm?
@mariusespejo7 ай бұрын
Depends on what your deployment pipeline looks like, do you have it automated? A storybook deployment in general just means run storybook build and have some server to host it, github pages might be easiest, assuming your library is open source anyways
@mr.random84472 жыл бұрын
What typescript react snippets you using? My snippets default with a type instead of an interface
@mariusespejo2 жыл бұрын
If you search “react snippets” in extensions it’s the one that starts with ES7. Honestly though using type is fine unless you really want users to extend an interface
@texhio Жыл бұрын
why i'm getting 'start-storybook' is not recognized as an internal or external command, error
@mariusespejo Жыл бұрын
Storybook recently came out with a new major version, and also tsdx seems like it’s not as maintained as before. Might be a good idea to just setup storybook yourself from scratch. I recently made a storybook 7 setup video if you’re interested
@glancecx Жыл бұрын
I've tried to get this running and open a browser in port 6006 but the new version of Storybook 7.0 runs and error with yarn storybook. I believe its because storybook no longer uses start-storybook and build-storybook. Anyone figure out how to get this working?
@mariusespejo Жыл бұрын
To follow this tutorial I suggest installing at v6, then take a look at the v7 upgrade guide, they have a tool to automatically upgrade your code to v7. Will try to make a new v7 video soon
@OttoAgne3 жыл бұрын
Great tutorial! Thanks! Is a different to VUE 3 app? Do you have any VUE 3, VITE crash courses?
@mariusespejo3 жыл бұрын
I know that storybook is fairly agnostic and can work with vue, however the specifics of that I’m not very aware of.. I have not had a chance to try vue so I also don’t have any content on it. Perhaps in the future
@ConnorM4683 жыл бұрын
Awesome tutorial! For whatever reason when I want to add a description to my component with the comments I have to terminate my storybook connection and restart it to get it to show. Any fixes? Thanks!
@mariusespejo3 жыл бұрын
That has happened to me before actually, I was actually surprised it didn’t happen when I was recording. I’m not entirely sure what prevents it from being picked up, sorry
@ConnorM4683 жыл бұрын
@@mariusespejo Not a big deal. Do you happen to know how to use css files with rollup? Can't seem to figure out how to build with it.
@mariusespejo3 жыл бұрын
There is a plug-in for css. Or you can use any css-in-js solution and it should just work
@shfunky3 жыл бұрын
Learned a lot, thank you so much! Somewhat unrelated question but how did you manage to have JSX + Markdown syntax highlighting for .mdx files in Vscode?
@mariusespejo3 жыл бұрын
ah if you search for mdx in vs code extensions it should pop up as an option!
@shfunky2 жыл бұрын
@@mariusespejo sorry, completely missed the notification for this message :D thank you so much!
@mariusespejo2 жыл бұрын
No problem!
@rickvian2 жыл бұрын
if i want to setup storybook for existing next typescript project, do i follow the same process?
@mariusespejo2 жыл бұрын
Not exactly, this is more for when you want a standalone project/library. For existing projects you likely will want to use storybooks’s “sb init” command, might want to check the docs. If you google “storybook init nextjs” the first article will probably give you some ideas
@AN-qw7ye Жыл бұрын
the updated version storybook v7 cannot use npm run storybook anymore 😓
@mariusespejo Жыл бұрын
Storybook has a really good migration tool. You can follow this video using v6 and run the auto migration to upgrade to v7. But I do plan to make a v7 tutorial soon!
@AN-qw7ye Жыл бұрын
@@mariusespejo As I just install storybook it will automatically installed v7 for me. Hence, I cant run storybook as it will cause error. What I've to do is doing one more step which is ```npx storybook@latest upgrade``` then the storybook can be run again :) Awesome!! looking forward to your v7 tutorial! Cheers
@mariusespejo Жыл бұрын
Just posted! kzbin.info/www/bejne/eaaqi5qPpJtgjrs
@shoaibsayyed33582 жыл бұрын
How to add scss support for the react components and for storybook?
@mariusespejo2 жыл бұрын
Storybook has a webpack config that you can customize
@shoaibsayyed33582 жыл бұрын
@@mariusespejo What I did is, I have created a tsdx.config.js and post CSS rollup plugin to handle scss to CSS compilation, and also added @storybook/preset-scss for storybook in main.js, And it is working.
@mariusespejo2 жыл бұрын
Great! Glad you figured it out, thanks for sharing
@islamis_powerful Жыл бұрын
Hi there, How are you? I have issue that I have mentioned below. I'm using storybook v7. Facing this issue in your tutorial. 'start-storybook' is not recognized as an internal or external command, operable program or batch file. Thanks Regards: Muhammad Fizan Iqbal
@mariusespejo Жыл бұрын
V7 is a major update that just came out, please check official docs for how to migrate
@islamis_powerful Жыл бұрын
@@mariusespejo I'm still on same issue.I have saw about migration but didn't work.
@mariusespejo Жыл бұрын
It would be best for you to follow the official docs on how to create a new storybook with your project. You can use this video to give you some ideas but but be aware that it’s not going to map to v7 one to one.
@islamis_powerful Жыл бұрын
@@mariusespejo Yup I know. Thanks for letting me know man. I'll try it own my own. Thanks a lot for your positive response.
@ashish2010ful2 жыл бұрын
How to host different versions of Storybook using local server and not npm or chromatic ?
@mariusespejo2 жыл бұрын
When you build storybook it just ends up being basically a static SPA that you can use whatever to serve it up
@sergeykahnwald66402 жыл бұрын
great!
@haribabumanoharan5366 Жыл бұрын
1. 'tsdx' is not recognized as an internal or external command, operable program or batch file. 2. $ yarn start bash: yarn: command not found How to solve this errors ?
@mariusespejo Жыл бұрын
Did you install both globally?
@yo9211243 жыл бұрын
Great video, but im having an issue, as soon as i add the button component into the storybook and try to open it, the app crashes, and the ram consumption goes all the way to 100%, do you know what could it be? i actually have 16gb ram, and i read some error reports in github, but there is nothing too concret
@mariusespejo3 жыл бұрын
Honestly likely a problem with storybook which doesn’t seem to follow semver very well, lots of big changes happen even on minor version updates
@starlite72493 жыл бұрын
YYYYEESSSS!!!! just what i wanted Storybook React with Typescript. But Marius no discord still .... BigSad
@mariusespejo3 жыл бұрын
😅
@kurniawanhendra26833 жыл бұрын
thanks man,
@mariusespejo3 жыл бұрын
Interested in adding dark mode to your React app? Take a look! kzbin.info/www/bejne/fIeqYYF5rM-Gp5o
@Play-Date-Care2 жыл бұрын
Thank you so much for the video, sending you lots of respect for the wonderful explanation!
@carljkempe3 жыл бұрын
What extension are you using for snippets?
@mariusespejo3 жыл бұрын
Don’t remember the specific name but they’re honestly all mostly the same, just search for “react snippets” and pick one you like
@mybird72722 жыл бұрын
how to run react?
@vladimirmryscuk84093 жыл бұрын
hi, great video! what's this vscode theme?
@mariusespejo3 жыл бұрын
Either github dark or nightowl I usually used in videos
@emanuelameh57223 жыл бұрын
Stories not displaying in my browser. Any idea why?
@mariusespejo3 жыл бұрын
Perhaps you didn’t add .stories to the file name? If all else fails try restarting your storybook
@av033 жыл бұрын
subscribed!
@mariusespejo3 жыл бұрын
Thanks!!
@thalibmuhammad95192 жыл бұрын
whats the difference between tsdx and npx? why its exist?
@mariusespejo2 жыл бұрын
Totally different tools. Npx is usually a command used to initialize projects using npm. Tsdx is sort of a build tool for typescript projects that are meant to be libraries (e.g. to be packed up for npm distribution). I suggest reading documentation about both.
@thongtech19842 жыл бұрын
Can you do a similar videos with Angular?
@mariusespejo2 жыл бұрын
Sorry I haven’t really used much of angular, it’s all the same fundamentals though basically you use angular components instead of react… most of the core topics I covered here will be the same
@thalibmuhammad95192 жыл бұрын
which one is better? docosaurus or storybook?
@mariusespejo2 жыл бұрын
Both are good for different purposes. Storybook is sort of a component development environment that also happens to document component usage. Docusaurus works as a general purpose docs site for… anything!
@muxammad27772 жыл бұрын
Hello Marius Again The two Buttons don't shown in the strorybook, but the two names is shown. what im doing wrong her const Template: Story = (args) => ; export const Default = () => Template.bind({}); export const Secondary = () => Template.bind({}); Secondary.args = { variant: 'secondary', children: 'I am secondary bro', }; Button is her import React, { HtmlHTMLAttributes, ReactNode } from 'react'; export interface Props extends HtmlHTMLAttributes { children: ReactNode; variant: 'primary' | 'secondary'; } export const Button = ({ children, variant = 'primary', ...props }: Props) => { return ( {children} ); }; thank you 🙏
@muxammad27772 жыл бұрын
my mistake and stupid mistake. 🙊🙊 export const Default = Template.bind({}); export const Secondary = Template.bind({});
@mariusespejo2 жыл бұрын
I don’t see any obvious issues with your code. Maybe just try restarting the storybook server?
@muxammad27772 жыл бұрын
by the way 'subscribed: 'done'
@oscar_cornejo3 жыл бұрын
how use lerna with this?
@mariusespejo3 жыл бұрын
Sorry not familiar with lerna
@storm-bl5br2 жыл бұрын
teachers,the code repository could share with us ,thanks for you
@Fatima-ie5kj3 жыл бұрын
sir one little request can u make a short project with react & typescript using reducer & context?
@mariusespejo3 жыл бұрын
I actually have a vid in my channel on react + typescript and it covers reducers
@Fatima-ie5kj3 жыл бұрын
@@mariusespejo thnx
@martinui48922 жыл бұрын
Storybook es Free ?
@mariusespejo2 жыл бұрын
Yes
@jihyunlee13402 жыл бұрын
Anyone has a problem with tsdx installation, change your node version. In my case... node v17.8.0 / npm v7.0.0 (x) node v14.17.0 / npm v 6.14.13 (o)
@mariusespejo2 жыл бұрын
Npm v7+ installs in a slightly different way, e.g. it usually tries to automatically install peer dependencies. You can opt out of that usually by doing npm install -legacy-peer-deps
@jihyunlee13402 жыл бұрын
@@mariusespejo Thank you so much! Best channel I've ever watched! I'm happy to study with your tutorials.
@mariusespejo2 жыл бұрын
Thank you, glad you like the content 🙂
@yaktd57043 жыл бұрын
As a Nestjs Developer, I thought you would use Angular!
@mariusespejo3 жыл бұрын
It’s all about picking the right tool for the job
@jihyunlee13402 жыл бұрын
After npx tsdx create file-name, it says Failed to install dependencies Error: Command failed with exit code 1: npm install @babel/core @size-limit/preset-small-lib @storybook/addon-essentials @storybook/addon-info @storybook/addon-links @storybook/addons @storybook/react @types/react @types/react-dom babel-loader husky react react-dom react-is size-limit tsdx tslib typescript --save-dev I did install one by one and I work found out I can't install from react to typescript part. so sad...
@mariusespejo2 жыл бұрын
Might want to create an issue on the tsdx repo, likely just a problem with the current version, I’m sure it’ll be fixed
@jihyunlee13402 жыл бұрын
@@mariusespejo I changed node, npm version and worked well!