Skip to content

Is it possible to add variants to an element that doesn't declare any? #197

Answered by jmjuanes
michaellenaghan asked this question in Q&A
Discussion options

You must be logged in to vote

You are right, only alert, badge, button and spinner 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 the container element with the styles and modifiers that you need. Your example can be easily generated with the following configuration:

export default {
    // ...other configuration
    layout: {
        container: {
            // ...other container styles
            "&.is-readable": {
                maxWidth: "50rem",
            },
        },
    },
};

The & parent selector works lik…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@michaellenaghan
Comment options

Answer selected by michaellenaghan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants