In this video I'll walk you through how to setup storybook for the first time as well as the fundamentals you need to know to create stories and develop ui or react JS / TS components in isolation.
Can you make full tutorial from scratch including testing , build a full storybook like for a company with best coding? using vitejs, reactjs, javascript, tailwind-css. All latest versions. please? 🙏 & explaining everything.
@md.lutfullahillabib the fundamentals are all here, and the testing follow up is linked above, I don’t really see what else there would be to cover. Creating a “full” storybook would just be reiterating the same patterns
@rajatguptanarwana it’s not really worth cloning, there’s very little code written. I suggest running the storybook init in your own project, it will come with much better examples to play around with.
You are amazing Marius Espejo. The content and your explanation are very clear. It is very easy to follow along and understand everything. I can't wait to see the next video.
Awesome ....I have got clear idea about Storybook. I am usually a fan of WebDevSimplified you tube channel. But your channel is something I have recently explored. I could say you have nailed it by vivid explanation.
That’s kind of the point of args, you can set an initial prop but the controls allows you dynamically update. The core idea is it’s like documentation that isn’t static, you can play around with it
It is very explicit, thank you! I have signed up) I use stories only to develop small Components, right? And for the App, I should use a simple Component with props (like Light.ts in your video)? I know that it is quite a stupid question, but still)
There is no restriction on how “small” but the point is that you start with small and those components you should be able to compose into larger components which those could have stories as well
Dude, did you go to css school or something? You are very fast and fluent. Thanks for the video. Very useful. I may have to use this tool for a while to determine what value this will add to my work flow & whether the benefits outweigh the cons.
Nah I play around with CSS until it looks right just like most people haha. As for the “cons” of storybook it’s really mostly the added code to write stories, but it’s up to you how much you utilize it. In my mind a lot of the benefits definitely outweighs a little extra code but definitely it also depends on your workflow
Thanks for the great video. I have one question. What we be the development workflow once you are done the development? Copy and paste? Or is there any easier and better way to bring this to my application?
Hi. Thank you. How do I change my existing stories seeing that ComponentStory, ComponentMeta does not exist anymore in the latest version of Storybook? Any ideas? Tx in advance.
I think it automatically does that for localhost but for any other site you can click on the little info icon next to the url and set it to developer mode. It’s on a per site basis unfortunately
@@mariusespejo I received an internship offer for a really nice company which they asked me to look at Storybook and this video was amazing from someone who never coded in my life hahaha Probably I would like to know more how it is used in a professional environment with examples etc
Ah I see, to a degree the fundamentals are all here. It honestly is mostly about isolated development, documentation, and testing. I do have a video on storybook interaction testing. You also can find a bunch of public company storybooks you can use to see how others are using it. Most people would use it to build design systems, component libraries, etc. Will think about other video topics for this space. Anyways good luck on your internship!
hey am create boilerplate react with antd 5, styled-component, typescript, storybook 7 but I am confused to how can i add antd 5 css customisation file in storybook preview.js file
import React from "react"; import { StoryObj, Meta } from "@storybook/react"; import Button from "./Button"; export default { title: "Components/Button", component: Button, } as Meta; // type individual stories type Story = StoryObj; export const Base: Story = { args: {}, }; export const Another: Story = { args: { label = "Button", }, render: (args) => , }; i am create same as your tutorial but strill getting error 'Button' refers to a value, but is being used as a type here. Did you mean 'typeof Button'?
Hello, I'm new to Storybook, and I found this video very instructive. Could you share an example of how to use React Context API with Storybook? Thanks in advance.
Hey there, there’s nothing special about using context in storybook. Just as usual you just need to have a provider to your stories, e.g. to provide mock data. Basically just follow typical usage as shown in react docs
Here’s an example of where you can add decorators wrapping your stories, you can place providers in there storybook.js.org/docs/writing-stories/decorators#story-decorators
IDK whats going on, I follow every one of these tutorials step by step exactly and it always ends up breaking or crashing in someway. I get this error : Can't resolve "./Light" not sure why this is doing this...
@@mariusespejo Just figured it out, I just had to restart StoryBook. For some reason, it was giving me errors over an old component I had already deleted..but it didnt register until restarting StoryBook. Thanks man
i don’t know that i would call it outdated, it still solves the same problem although perhaps just not being actively maintained. There is a fork of it called dts-cli that you can perhaps consider. Again also if you’re concerned then you can configure tools like rollup yourself, tsdx is just the zero config get started quickly path to that
@@mariusespejo just FYR Tried tsdx, lot of errors due to internal roll-up version conflicts. As you've suggested, using vite + roll-up config. It's working fine now. Thanks
It’s not on a repo. Honestly if you watch the video it’s literally just running two commands (vite & storybook) and writing the two files… it would take you 5min to write