-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Addon-docs: Design token support #7671
Comments
With addon-docs, there is already a bunch of stuff to create a Design System with Storybook. But we still have to document the tokens manually. Having an auto generated doc for the tokens would be AWESOME! I can't wait to see it implemented 🙇♀️ |
Hey, just wanted to give a little ping as the maintainer of https://github.com/UX-and-I/storybook-design-token. I would love to see it integrated with SB Docs and will assist wherever possible. |
Hi 😄 Any news on this issue? Do we have a chance to see it in the coming releases? |
Hey. There are some really interesting efforts to come up with a more standardized specification of design tokens here and here. While the design token addon does its job right now, I'm not sure if extracting token information from stylesheets and such is the way to go in the future. So I'm unsure of how to proceed here. |
@Sqrrl Since you have been in this space for a while, i would really like to hear what do you think is the way to go in the future. I am just an intrigued observer here |
"In this space for a while" is a bit of a stretch. 😉But it sure sounds compelling to have a standardized token format that we can use both in our design tools and to generate and document our styles. |
I think the format that @Sqrrl uses is an excellent way to present design tokens ( I replicate it in my own projects). And agree with him that extracting token information from stylesheets may not be the best route, at least, as the default. I use Amazon's Style Dictionary to generate the design tokens. One of the many target formats it supports is JSON. I currently use these JSON "property" files to generate the design token stories. With that said. I think a good way forward would be to:
One thing I also think is important to discuss is where these tokens are presented. Some may favor them in a panel, as is done with storybook-design-token, but I think there should also be the option to have them as top-level stories, here's an example. Thoughts? |
I’ve been waiting for a proposal from the W3C working group before trying to bring this into core. https://github.com/design-tokens/community-group But it sounds like that’s a longer term process, so we should push this forward to make more useful addons (or extend the current one— I love what @Sqrrl has done so far!) in the meantime. @ryanfitzer your proposal sounds super reasonable. For me the top priority is to bring them into Storybook as DocBlocks, which should also be renderable in the Addons panel and also as top level stories (if you’re using Storybook for React, for now). I’ll post more about that soon. |
Oh yes please! I just released Theemo, read here about: https://gos.si/blog/say-hello-to-theemo-the-yordle-powered-theme-automator/ Basically the idea with this is theemo already knows about all your tokens. Would like to connect theemo to this. In the end theemo automates everything for you, just one command away. Let me know how to collaborate. |
@gossi @Sqrrl let's tackle this together in 6.1. The 6.0 schedule is slipping and it's going to be a complex release. As soon as it's out the door, I'll start a document that we can iterate together. In the meantime if anybody wants to put together POC's (either as standalone addons or enhancements to |
I started using Style Dictionary for tokens and Storybook for the whole design system, and I'm also looking forward to a standard format for tokens that Storybook could integrate natively. In the mean time, @ryanfitzer could you share how you generate the design token stories from Style Dictionary's JSON output? Thanks |
Following my previous comment about using both Style Dictionary and Storybook, here's how I use the former's global JSON output in the later's stories, based on some examples I've seen elsewhere. For colors: import { Meta, ColorPalette, ColorItem } from '@storybook/addon-docs/blocks';
import tokens from 'design-tokens/dist/properties.json';
<Meta title="Tokens/Options/Colors" />
# Options for colors
## Brand colors
<ColorPalette>
{Object.entries(tokens.color.brand).map(([id, data], index) => {
return (
<ColorItem
key={id}
title={data.path.join('.')}
subtitle={data.comment}
colors={[data.value]}
/>
);
})}
</ColorPalette> For typography sizes: import { Meta, Typeset } from '@storybook/addon-docs/blocks';
import tokens from 'design-tokens/dist/properties.json';
<Meta title="Tokens/Options/Typography" />
# Typography
<Container>
{Object.entries(tokens.size.font).map(([id, data], index) => {
console.log(id);
return (
<Typeset
fontSizes={[data.value]}
fontWeight="300"
sampleText={`${id}: ${data.original.value}`}
title="test"
subtitle="test"
/>
); }) }
</Container> As you can see, I target a fraction of my color tokens ( But there are a few issues:
I can't share a link to the full code as it's in a private repo, sorry. |
There are some nice ideas in this article written by @varya: |
Converting this to a discussion. We’re reserving feature issues for things that are on our short-term roadmap. We’ll check back periodically to see whether this is a good candidate to be added. If this feature would be useful to you, please upvote! |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Incorporate https://github.com/UX-and-I/storybook-design-token into SB Docs
The text was updated successfully, but these errors were encountered: