-
-
Notifications
You must be signed in to change notification settings - Fork 30
Description
In order to build meaningful design systems it is desired to limit the options a developer can choose from.
Example: Instead of having to write ~text-xl/3xl or ~pt-3/6 it is more desired to have presets like ~text-h1 and ~pt-sm. Alternatively "shorthands" with just one value instead of start and end values could make also sense.
E.g:
~text-xl: Will produce same as~text-xl/3xl)~pt-3: Will produce same as~pt-3/6
Proposed API to add Presets:
export default {
// ...
theme: {
// ...
fluid: ({ theme }) => ({
presets: {
fontSize: {
// array describes start and end values
xl: [theme("fontSize.xl"), theme("fontSize.3xl")],
},
spacing: {
3: [theme("spacing.3"), theme("spacing.6")],
},
},
}),
},
plugins: [fluid({})],
};It would be nice to have some great defaults for this as well.
Do you think something this is possible or too complex?
I love this library and it's probaby is the best when it comes to fluid types and spacing in tailwind. I think this feature can make it even more awesome.
Tailwind Utopia is doing something similar with: fl-text-xl
Current undesired solution
For typography it works kind of good with @apply:
@layer utilities {
// can't use ~ in css class names
.text-h1 {
@apply ~text-xl/3xl;
}
}But for spacing it will be very cumbersome, since you have to define it for all possible spacing attributes like padding, margin, gap, etc. And using @apply is generally highly discouraged.