Comments (5)
The Design Tokens tab in the addon panel isn't aware of which tokens the currently open component uses. It will always show all tokens. Currently there is no way to filter tokens by component usage.
from storybook-design-token.
Yes. You should be able to specify the parsed files via https://github.com/UX-and-I/storybook-design-token/tree/v3?tab=readme-ov-file#specify-a-custom-glob-for-your-token-files.
from storybook-design-token.
Thank you, @Sqrrl - That sounds promising! I am a bit uncertain as to how I am supposed to do this? Should I mark my component-based CSS classes in a distinct way and have the parser only look for those files? And it would thus exclude any design-tokens in the global files in each story. Or am I misunderstanding something here?
from storybook-design-token.
Assuming you have separate files containing your tokens (colors.css, spacings.css, …), I would define a blob pattern that only matches these token files. You could name all your token files *.tokens.css for example, and use a glob pattern like **/*.tokens.{css,scss,less,svg}
. Or you could use the glob pattern to "whitelist" only specific file names (e.g. **/{colors,spacings}.css
).
from storybook-design-token.
I apologize for my slow-ness here - I still am not sure I have understood this correctly.
Given this "global" Colors.tokens.css
file:
:root {
/**
* @tokens Colors
* @presenter Color
*/
--color-button-primary: #1ea7fd;
--color-button-primary-hover: #1b7ec2;
--color-button-primary-active: #116699;
--color-button-primary-disabled: #a0dfff;
--color-button-secondary: #e9ecef;
--color-button-secondary-hover: #e2e6ea;
--color-button-secondary-active: #d4d8db;
--color-button-secondary-disabled: #f1f3f5;
}
And a Button.css
file like this:
.storybook-button--primary {
background-color: var(--color-button-primary);
}
.storybook-button--primary:hover {
background-color: var(--color-button-primary-hover);
}
.storybook-button--primary:active {
background-color: var(--color-button-primary-active);
}
.storybook-button--primary:disabled {
background-color: var(--color-button-primary-disabled);
}
I would assume that the color tokens for --color-button-secondary*
to not be shown in the tab in the button story as it is not utilized in this component? Am I mistaken?
from storybook-design-token.
Related Issues (20)
- issue with enabled feature buildStoriesJson HOT 1
- Allow Control Types Config (ArgTypes) HOT 1
- Issue starting storybook-design-token HOT 6
- Storybook webpack autobuild no longer works with storybook-design-token options HOT 7
- Is there a way to disable scrolling container in table view? HOT 1
- Dependencies on Vite should be optional
- Getting warnings during startup and usage of addon in v3 beta HOT 2
- Monorepo import Css injection not working
- Disabling addon panel does not work HOT 8
- ? HOT 1
- Hide search in doc pages?
- Missing "./dist/doc-blocks" specifier in "storybook-design-token" package? HOT 1
- Getting React error when importing DesignTokenDocBlock HOT 1
- Issue with Managing Theme Switching HOT 2
- Storybook 8 compatibility HOT 4
- Tokens that change based on breakpoint do not update in the UI
- Tokens reset once the tab is re-selected
- Tokens that depend on other tokens don't work HOT 1
- Sizing Tokens
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from storybook-design-token.