Replies: 2 comments 1 reply
-
As a workaround, I was able to create a function with the following declaration: export const SizeVariants = {
render: (props: ComponentPropsWithoutRef<typeof Button>) => (
<VariantCanvas
columnAxis={[
'size',
[
button.raw({ size: 'xs' }),
button.raw({ size: 'sm' }),
button.raw({ size: 'md' }),
button.raw({ size: 'lg' }),
button.raw({ size: 'xl' }),
button.raw({ size: '2xl' }),
],
]}
of={Button}
props={props}
rowAxis={[
'variant',
[
button.raw({ variant: 'solid' }),
button.raw({ variant: 'outline' }),
button.raw({ variant: 'ghost' }),
button.raw({ variant: 'link' }),
],
]}
/>
),
} This does not solve the problem, but still better. |
Beta Was this translation helpful? Give feedback.
0 replies
-
I feel like you're looking for you could make a specific panda.config file for your storybook, separated from the one in your app, that basically extends it and just specify that additional config.staticCss so that only in your Storybook app you'd get all variants generated by default with this, you wouldn't need to use |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Description
It would be great if we could run a
raw
function against every variant key.Problem Statement/Justification
When using Storybook, I'm not a big fan of creating per-variant stories. Instead, I use a render function that renders all variants at once:
However, even if I pass
button.raw
to theVariantCanvas
, it doesn't work, sinceraw
are build-time functions. The only escape hatch I see now is to use all these staticraw
calls:But in such a way, I can instead write like
before
. But I don't want to. 🫠Proposed Solution or API
The solution is to create a
raw
function alternative which will identify every possible variant's value by its keys:Alternatives
See Problem Statement/Justification
Additional Information
No response
Beta Was this translation helpful? Give feedback.
All reactions