-
Notifications
You must be signed in to change notification settings - Fork 63
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
grid type #222
Comments
What's an example of where you'd see yourself using a grid design token? I'm struggling to see how this fits in. |
In order to create grid layouts. If you're asking about my personal usage, so I use for grid layouts and in media queries. But I also have a
I also have an article about building CSS grid system https://dev.to/pavellaptev/simple-grid-system-with-subgrid-classes-2f44 |
Sorry, to rephrase, why would you do this with design tokens instead of just writing |
Yes, good question. I think in general, it should help to align all platforms that are using grid layouts. Personally, I just want to have a standard type for it, so tools like Style Dictionary, could be aware about this type and I don't need to write additional modifiers. |
Hi all 👋🏽 . I stumbled across this issue because I am researching how we can use design tokens to handle different grid layouts just based on design tokens/css variables. I work at a large publisher/media company with over 100 publications and we have 4 different "themes", and in some cases the grid column numbers could be different across themes, in one specific component. So the regular spacing system would not solve our needs. So different themes is a use case where grid-layout tokens would be very useful. |
My initial thought when seeing new token type proposals is to ask: can this be solved with groups? eg, without using a new token type, you might have this: {
"grid": {
"columns": {
"count": {
"$type": "number",
"$value": 12
},
"gap": {
"$type": "dimension",
"$value": "10px"
},
"width": {
"$type": "dimension",
"$value": "100px"
},
"margin": {
"$type": "dimension",
"$value": "20px"
}
}
}
} I think this still captures the spirit of the design decision; you could even add more context in $description props. If there's value in having the translator "know" that these values should be used to calculate, say, css grid syntax, perhaps that's just a configuration of the translator rather than explicit in the token itself. Eg: generateCssGridSyntax({
columnCount: tokens.grid.columns.count,
columnWidth: tokens.grid.columns.width
});
// outputs something like
// grid-template-columns: repeat(12, 100px); |
What do you think about the
$grid
type for design tokens? In web development, we often use grids, but I'm wondering if it could also be helpful for other developer areas like iOS/Android.CSS grid — https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_grid_layout
Swift UI — has the grid concept https://developer.apple.com/documentation/swiftui/grid
Android API — https://developer.android.com/reference/android/widget/GridLayout#attr_android:orientation
Figma API — https://www.figma.com/plugin-docs/api/LayoutGrid
Penpot implementation — https://community.penpot.app/t/sneak-peek-on-upcoming-penpots-grid-layout-plus-flex-layout-combo/3027
Here are my proposals. The first one is good to provide only one direction per token, which could be not so good, because there could be
row
andcolumns
at the same time:And the most universal, but not so elegant approach:
Any thoughts?
The text was updated successfully, but these errors were encountered: