react-st-modal icon indicating copy to clipboard operation
react-st-modal copied to clipboard

Undocumented 'Customization via css variables'?

Open LiteSoul opened this issue 4 years ago • 1 comments

Hi there! I can't find documentation to apply css variables on the modal. There seems to be some variables by inspecting... but how to use them?:

st-modal-2

Also both these links give 404:

st-modal-1

LiteSoul avatar Feb 22 '21 20:02 LiteSoul

You can do this by putting something like

:root{
    /* Override ST Modal Defaults */
    --st-modal-borderRadius: 0px;
    --st-modal-boxShadow: none;
    ...
}

in one of your own css files. The trick is to make sure it is included/imported after 'react-st-modal' so that it overwrites the variables from the default stylesheet. This makes it a bit tricky to add global defaults near the root of your app. You could do something like

useEffect(()=>{
    document.querySelector(':root').style.setProperty('st-modal-borderRadius', '0px');
},[])

to achieve this, even if that's slightly unconventional.

@Nodlik I love this library - great work!

jash8506 avatar Jul 29 '21 00:07 jash8506