-
I was working on a menu button, and wanted to disable I first tried this: let bodyStyles = {
body: {
overflow: 'auto',
},
};
if (show) {
bodyStyles = {
body: {
overflow: 'hidden',
},
};
}
globalCss(bodyStyles)(); This did not work, as calling So I thought, maybe I can use variants in globalCss({
variants: {
show: {
true: {
body: {
overflow: 'hidden',
maxHeight: '100vh',
},
},
},
},
})({ show: true }); But this does not work, because the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
there's no such variant in to achieve your goal globalCss({
'.overflow-hidden': {
overflow: 'hidden'
}
// or
'body.overflow-hidden': {
overflow: 'hidden'
}
}) therefore you have more flexibility to put the logic in your child components |
Beta Was this translation helpful? Give feedback.
there's no such variant in
globalCss
, this function only accepts the global stylesto achieve your goal
use the old way,
document.body.classList.toggle('overflow-hidden')
, then inglobalCss()
add that class:therefore you have more flexibility to put the logic in your child components