Questions tagged [storybook]

Introducing Storybook - the ultimate playground for JavaScript UI components! Within this innovative development environment, you can effortlessly explore a vast component library. Dive into the various states of each component with complete isolation from your application. Plus, engage in interactive development and testing to bring your components to life like never before.

Exploring Typescript keyof in Storybook's User Interface customizations

Currently, I am working on developing components for integration with Storybook, but I am encountering an issue related to Typescript inferred types. While striving for code reusability, I prefer not to specify the options for a control within the story i ...

Can you explain the distinction between the MSW Storybook Addon and the storybook-addon-mock?

As I set up my Storybook environment, I came across two different libraries for mocking API requests: MSW Storybook Addon and storybook-addon-mock. Both seem similar to me, and I am unsure of which one to choose and why. Is there any significant difference ...

Unit test for Storybook add-on is failing due to NextJS useRouter() returning null

I've encountered an issue while trying to integrate my stories into unit tests using Jest and React Testing Library in a NextJS application. When viewing the components in Storybook, everything works smoothly with the Storybook Addon Next Router. However, ...

Talebook by Syncfusion

I'm completely new to Storybook and I am currently exploring the possibility of creating a Storybook application that showcases a variety of controls, including Syncfusion controls and other custom controls that I will be developing in the future. Has any ...

What is the best way to transform a Storybook typescript meta declaration into MDX format?

My typescript story file is working fine for a component, but new business requirements call for additional README style documentation. To meet this need, I am trying to convert the .ts story into an .mdx story. However, I am facing challenges in adding de ...

Lack of MaterialUI Table props causing issues in Storybook

Currently, I am utilizing MaterialUI with some modifications to create a personalized library. My tool of choice for documentation is Storybook, using Typescript. An issue I have encountered is that the storybook table props are not consistently auto-gene ...

It appears that the home page of next.js is not appearing properly in the Storybook

Currently, I am in the process of setting up my next home page in storybooks for the first time. Following a tutorial, I successfully created my next-app and initialized storybooks. Now, I am stuck at importing my homepage into storybooks. To achieve this, ...

What is the best way to bundle .scss files while releasing Storybook components in an npm package?

After successfully publishing my Storybook components in an npm package (let's call it my-storybook) and following the guidelines provided in this tutorial: I encountered an issue when trying to utilize them in a project. For each component exported ...

The Storybook file is unable to find and import the corresponding .vue file

Issue with Importing Vue File in Storybook I am facing an issue while trying to import a vue file (component/index.vue) into my storybook file (component/index.stories.ts). The compilation is failing and the import cannot be completed. component/index.st ...

Creating a seamless integration of Material UI V5 ThemeProvider in Storybook V6 within the NX workspace involves a series

I am currently utilizing nx.dev as my monorepo setup with various React clients. With NX, I have centralized the configuration for Material Ui inside the lib folder. The issue arises when I try to integrate Storybook within the mui folder. Unfortunately, ...

The error message "bound Template cannot be used as component" is triggered when a storybook attempts to utilize children as an argument

As per the Storybook documentation, you can find more information at: // List.stories.ts | List.stories.tsx import React from 'react'; import { List, ListProps } from './List'; // ...

"Explore the React Storybook with a curated selection of three unique unit tests

I've encountered a puzzling issue. I have 9 unit tests that are running flawlessly with the jest command. However, when I run storybook, only 3 out of the 9 tests are displayed. The version of Storybook being used is 5.1.7. https://i.stack.imgur.com/l8nXf ...

Seamlessly incorporating Storybook with Tailwind CSS, Create Next App, and TypeScript

*This is a new question regarding my struggles with integrating Storybook and Tailwind CSS. Despite following the recommended steps, I am unable to make Tailwind work within Storybook. Here's what I've done: I started a TypeScript project from scratch usi ...

Challenges arise when attempting to share a theme across different repositories within a Storybook monorepo that utilizes

In my unique project setup, I have a singular repository containing atoms, molecules, and organisms along with storybooks to develop a custom components library. This library is based on MUI framework with a customized theme applied, all built with TypeScr ...

Issue: Error code 0308010C encountered in the digital envelope routines, indicating unsupport for the command npm run storybook

Whenever I attempt to run npm run storybook An error pops up in the terminal: Error: error:0308010C:digital envelope routines::unsupported at new Hash (node:internal/crypto/hash:71:19) at Object.createHash (node:crypto:133:10) Operating System - ...

The perplexing tale of Storybook, Ionic React, and styled-components CSS sequencing puzzles

I am facing an issue with my custom components in Ionic, where the styles overridden by Ionic's standard components. The component looks fine on the app page but gets messed up when used in Storybook. After some investigation, I realized that the order of ...

Guide to customizing the layout preview specifically for certain components in Storybook, without affecting all components

Currently working on my storybook project and facing an issue. I'm aiming to have the layout centered in the preview section. I attempted export const parameters = { layout: 'centered', }; in the .storybook/preview.js file However, this c ...

I'm wondering, on a storybook, where is the best place to set my MUI X license key

Can you help with where to specify my license key in Storybook? I need guidance on where to set the license key in Storybook. According to MUI Docs, it should be done before React renders the first component and only once in the application. However, I ...

Sending data to a child component within Storybook

Looking for a more efficient method to pass values to a nested component in Storybook. Instead of explicitly listing each value, is there a way to set them all at once? function Dropdown({ label, type, size, title, disabled }) { return ( <div cl ...

Combining Font Variables from Next.js with Storybook in a Next.js Application Enhanced with TailwindCSS

I'm currently developing a Next.js application that utilizes App Router and incorporates TailwindCSS for styling. In addition, I have implemented Storybook for component development. The challenge I am facing involves integrating custom fonts with Storyboo ...

What could be causing the EBUSY: resource busy or locked, open errno: -4082 error to appear while trying to build storybook 7 in next.js 13?

While attempting to create a storybook, I encountered the following error in my project: [Error: EBUSY: resource busy or locked, open 'C:UsersaliDesktopWorksDesign Systemsprojectsstorybook-test2 ode_modules.cachestorybookdev-servera5a8bf6e622ae ...

I updated the version to 13, and as a result, the process of building the storybook has encountered a roadblock

After upgrading next.js to version 13, the storybook build is failing. Here's a snippet from the storybook: I'm stuck on how to fix this issue and would appreciate any help in resolving it. error ERR! => Failed to build the preview ERR! Module not ...

Caution: A value of `true` was passed for a non-Boolean attribute `error`

While creating a component and its stories in Storybook for React, I keep encountering an error message intermittently: The issue seems to be originating from this part of the code inside the component. It appears that removing {...props} from the input e ...

After the installation of Storybook, there is a duplicate identifier error that arises with 'LibraryManagedAttributes'

Upon running the command npx storybook@latest init for setting up Storybook, which results in modifying package.json, I encounter an issue where I cannot run the project using npm due to: Error: node_modules/@types/react-dom/node_modules/@types/re ...

Unusual behavior of Typescript with Storybook's addon-docs

I'm trying to integrate storybook addon-docs into my TypeScript React project. Everything seems to be almost working, but I've noticed that the file name is affecting how the props type table gets rendered. Here is my file structure: src - Button -- Butto ...

The data type 'boolean' cannot be assigned to the type 'StoryFnReactReturnType' in a React Storybook project using Typescript

I am currently working on setting up a Button component with Storybook in typescript. I am referencing The Documentation and using this specific example. Below is my Component and its story: components/Button.tsx: import {FC} from 'react'; exp ...

The theming feature in React Material-UI v5 does not seem to be compatible with Story

After spending a few days customizing the primary color and adding two additional colors to the palette, I encountered an issue where the new colors were not being reflected on the button despite properly declaring them. Even wrapping the button under the ...

Using Storybook with Amplify in a Next.js application runtime

I am attempting to run Storybook from Amplify in a Next.js project. Initially, the framework was set as Next.js SSR, but I changed it to React while keeping the app platform as Web Compute. In the amplify.yaml file, I made the following updates: version: ...

Issue: receiving an error message "Error: spawn wslvar ENOENT" while attempting to run yarn storybook on

Currently, I am attempting to follow a tutorial found at The tutorial provides the following set of commands: # Clone the template npx degit chromaui/intro-storybook-react-template taskbox cd taskbox # Install dependencies yarn # Run the test runner (J ...

"What is the significance of the .default property in scss modules when used with typescript

When dealing with scss modules in a TypeScript environment, my modules are saved within a property named default. Button-styles.scss .button { background-color: black; } index.tsx import * as React from 'react'; import * as styles from './Button-styles ...

Is there a way to incorporate static assets in SCSS while using Storybook?

I've created a SCSS library located in the styles/ folder with code like this: // Variables $path-to-img: "/img" !default; $path-to-fonts: "/fonts" !default; // Example use case .bg-pattern-2 { background-image: linear-gradient(to bo ...

"Troubleshooting: MUI MonthPicker triggers LocalizationProvider issue within the Storybook environment

I'm currently utilizing the MUI MonthPicker in my code, which is functioning correctly. However, when I incorporate the component into the storybook, it presents me with the following error message: MUI: Can not find utils in context. It looks like ...

Personalize your Material UI ToolTip

I am currently working on customizing the material ui tooltip for React Storybook. After attempting to adjust various CSS properties such as width, height, and background color, I have not been successful in seeing these changes reflected. import * as Re ...

In order for styling to be applied in Storybook, the default Ant Design component must be exported

I want to create React Components using Ant Design and showcase them in Storybook. Both the components and storybook are functioning correctly as expected. modal.stories.js import React from "react"; import { action } from "@storybook/addon-actions"; im ...

Struggling to incorporate sass into ReactJS storybook

Recently, I delved into the world of storybook for ReactJS. Following a helpful blog post, I successfully created my own component library and even managed to publish it on npm. However, when attempting to incorporate SASS support for my plugin, I encount ...

managing static assets within a storybook monorepo

I have a lerna + yarn workspaces monorepo with multiple packages and components, each one containing its own /assets folder with static images: /packages      /component1             /assets ...

What is the most efficient way to switch perspectives?

I'm currently utilizing storybook to simulate various pages of my application. My concept involves encapsulating storybook within one context for mock data, and then during live application execution, switching to a different context where data is fetched ...

Troubleshooting the hoist-non-react-statics problem during the rollup.js compilation process

Encountering difficulties while attempting to construct my storybook using rollup.js. Within my react components, I am utilizing @mui/material, and the installation page suggests installing two additional packages called @emotion/react and @emotion/styled. ...

The storybook is struggling to find the correct builder for the Angular project

I have set up a complex angular workspace with multiple projects. Within the main angular workspace project directory, I have two folders - one for the project application named eventric, and another for a library called storybook. https://i.stack.imgur.c ...

Incorporate dimensions using makeStyles within the material-ui theme

const myStyles = makeStyles( (theme) => ({ containerForIcon: { padding: theme.spacing(0, 4, 0, 0), [theme.breakpoints.up('md')]: { padding: theme.spacing(-1, 5, 0, -1), }, }, <Grid item className={cla ...

What is the best method for incorporating a custom font with @fontface in Storybook version 6.5.5?

I have attempted multiple online solutions to incorporate a custom font in Storybook, but unfortunately, none have been successful. Here are the files that I have added under the .storybook folder based on this guidance: webpack.config.js : const pat ...

In the Show Code feature of Storybook, every element is being displayed for

My Vue 3 + Storybook setup is all running smoothly, except for a little hiccup when I click "Show Code". It seems to display everything instead of just the template. Can anyone help me figure out what's going wrong? https://i.stack.imgur.com/zzBl0.pn ...

Encountering a talebook mishap: the function fn.apply is not recognized

Currently, I'm in the process of refactoring a React webapp from CRA to utilizing Vite and encountering some hurdles with Storybook. The Storybook's interface opens up as expected, displaying a list of stories on the left panel. However, when selecting any ...

Setting up Storybook with Tailwindcss, ReactJS and Typescript: A comprehensive guide

What is the best way to configure Storybook to handle Tailwindcss styles and absolute paths? Just a heads up, this question and answer are self-documenting in line with this. It was quite the process to figure out, but I'm certain it will help others ...

Is it possible to import a package from a monorepo located in a different repository?

Currently, I have successfully set up a create-react-app and a storybook packages in a lerna monorepo. My goal now is to utilize the components created within the storybook package in an entirely fresh repository. I attempted using npm install git://githu ...

Storybook ran into an issue locating the module "example.png" in images loaded via the CSS url() function in a project using Next.js 13 and Tailwind

I am currently working with Nextjs 13 and Tailwindcss. When attempting to run Storybook for the project, I encountered this error: ModuleNotFoundError: Module not found: Error: Can't resolve '/images/example.png' in 'C: eposmvpsrcstyles' The issue ari ...

What could be causing the absence of the exported Object when importing into a different Typescript project?

I am currently in the process of developing a React component library using Typescript that I want to import into another Typescript project. Specifically, I want to import an Analytics chart library into a storybook for demonstration and testing purposes. ...

Achieving Jest integration with Angular 9 in a Storybook setup

We are currently utilizing Storybook 5 alongside Angular 9, with Jest 26 for some of the testing procedures. The issue we're facing arises when using Typescript version below 3.8.0 - a requirement for Angular 9's ng build --prod. This results in multiple ...

Storybook files enhanced with ESLint

Can anyone help me with writing a script for the stories extensions as well? Below is what I currently have: "eslint": "eslint '**/{*,*.stories}.{ts,tsx}'", Here's my project structure: src components SomeComponen ...

The 'default' export is not found in the 'tailwind.config.js' file

Is it possible to utilize a theme variable for Tailwind within the Nuxt code for Storybook? Although everything appears to be fine during development, I encounter an error when building Storybook stating that ""default" is not exported by "t ...

Storybook is pulling fonts from an incorrect location on the server

Regrettably, I am facing an issue where the fonts do not load when accessing a page with Quasar integration. In the Developer Tools, it shows a path error like this: http://localhost:6006/undefined/node_modules/@quasar/extras/roboto-font/web-font/KFOmCnqEu ...

Using NextJS with Storybook: The Issue with Optional Chaining

https://i.stack.imgur.com/lY2F1.png rehype-ignore - index.js contains the following code snippet: import { visit } from 'unist-util-visit'; const rehypeIgnore = (options = {}) => { const { openDelimiter = 'rehype:ignore:start', ...

Creating a magical narrative within an NX workspace with the help of a user interface library

Within my NX workspace, I have multiple applications and libraries. As someone new to Storybook, I followed the instructions found here: in order to incorporate Storybook support into a simple component library. This library consists of two Angular module ...

Explore the potential of utilizing Reactive Forms in conjunction with storybook templates

Currently, I am working on developing some custom components and form elements that I intend to include in Storybook. To ensure completeness, I want the stories to utilize FormControl and FormGroup to demonstrate a real-world use case. Here is an example ...