SolidJSS
SolidJSโ€ข2y agoโ€ข
3 replies
Cathal

Storybook `children` not working as expected

While migrating some code from React to Solid, I noticed an issue in how children are handled in Storybook args.

The following works fine with React, but not Solid:

const Base: Story = {
  args: {
    children: <span>Button Text</span>,
  },
};

export const Red: Story = {
  args: {
    ...Base.args,
    accent: "red"
  }
};

export const Blue: Story = {
  args: {
    ...Base.args,
    accent: "blue"
  }
};


With Solid, if both Red and Blue are rendered on a single page, only 1 will have children.
Is this expected behaviour, or an issue with the Storybook plugin?

Here's an reproduction (see the 'docs' page).
https://stackblitz.com/edit/solidjs-templates-2xn7hg

First time using Solid, so apologies if I've done something stupid. ๐Ÿ™‚
StackBlitzCathal Mullan
Vite + solid templates
solid-storybook-issue - StackBlitz
Was this page helpful?