-
SummaryHi, I’m currently working on a Storybook setup for my project, and I’m trying to use a story as a JSX element within another story. However, I’m encountering an error, and I’m not sure how to resolve it. Here are the details: I’m defining a FormHandler component and creating a Storybook story for it. In one of the stories, I want to use another story (Disabled) as a JSX element within the inputField prop. However, I get the following errors:
Additional informationStorybook version: v8.1 Here is my story for the component: import { Meta, StoryObj } from '@storybook/react';
import { FormHandler } from './FormHandler';
import { Disabled } from './Input.stories'; // Importing the story
const meta: Meta<typeof FormHandler> = {
title: 'Components/FormHandler',
component: FormHandler,
};
export default meta;
type Story = StoryObj<typeof FormHandler>;
export const Default: Story = {
args: {
inputField: <Disabled {...Disabled.args} />, // Using the story here
label: 'Token Name',
},
render: (args) => <FormHandler {...args} />,
}; Here is my Disabled Story: export const Disabled: Story = {
args: {
disabled: true,
placeholder: 'Enter text...',
},
render: (args) => <Input {...args} />,
}; Prop type for my component: interface FormHandlerProps {
inputField: React.ReactNode;
label: string;
} Create a reproductionNo response |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
This seems unintentional
you probably want to put |
Beta Was this translation helpful? Give feedback.
This seems unintentional
inputField: <Disabled {...Disabled.args} />,
you probably want to put
<Input {...Disabled.args} />