Is it possible to add variants to an element that doesn't declare any? #197
-
I would like to add a readable: {
maxWidth: "50rem",
}, so that I can do this: <div class="container is-readable">
...
</div> I've seen how Is it possible to add variants to an element that doesn't declare any in advance? (Of course, it would be easy to just add the class. I kind of see this as an opportunity to learn something about how the framework works, though.) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You are right, only Instead of just adding the class, you can use the export default {
// ...other configuration
layout: {
container: {
// ...other container styles
"&.is-readable": {
maxWidth: "50rem",
},
},
},
}; The I have created a playground with this example. |
Beta Was this translation helpful? Give feedback.
You are right, only
alert
,badge
,button
andspinner
can generate additional variants automatically using the extra keys defined in its configuration (see the table in https://siimple.xyz/elements).Instead of just adding the class, you can use the
layout.container
field of the configuration to extend thecontainer
element with the styles and modifiers that you need. Your example can be easily generated with the following configuration:The
&
parent selector works lik…