Replies: 1 comment 1 reply
-
Set up your enums as theme variables under a namespace and then reference that namespace in the utility: @theme {
--grid-area-sidebar: sidebar;
--grid-area-header: header;
}
@utility area-* {
grid-area: --value(--grid-area-*);
} |
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
-
I have a grid using
grid-template
, which means I have named grid areas likeheader
,sidebar
, etc. I wanted to create a utility class to quickly place elements in a specific grid area and use them like this:area-header
,area-sidebar
, etc. But I can't figure out how to do that as it seems that only numeric values are accepted but I need to use raw string values in this case.I've tried the following, but none of these work:
Of course, I can use
[grid-area:header]
but a utility class would be nice.EDIT:
I could also create a simple utility class for every possible value, which provided better code completion. From that point of view it would be nice if enums were supported to create those utilities a lot quicker. I don't know, something like the following:
Beta Was this translation helpful? Give feedback.
All reactions