You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm looking for the best practice when styling sandpack, I know there's the @codesandbox/sandpack/unstyled export, however this isn't a viable choice because they aren't modular enough to be interoperable with the regular styled exports. I don't mind styling from scratch, I would just prefer to not have to set syntax highlighting for the editor.
This way I could still use theme and have syntax highlighting alongside benefitting rom the editor props such as wrap content etc but I could apply my own classes to everything else. However this throws the error below.
Error: [sandpack-react]: "useSandpack" must be wrapped by a "SandpackProvider"
Which leads me to believe the SandpackProvider components are incompatible.
What I'm currently trying
To overwrite the default sp-classes from sandpack with my own custom css class. (as a side note, where would I find the other sp- classes do you suggest just reading the source code because i could not locate them in the docs)
However the runtime styles used by the library are overwriting the classes I pass in with the options object.
You can see my css rule ss-block is being overwrriten by sp-c-iKJbEZ
May or may not be helpful
Josh Comeau has a styled sandpack that's pretty close to what I'm looking for.
The new React docs also implement a custom sandpack config however they do the syntax highlighting manually + are using an older verison
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Overview
I'm looking for the best practice when styling
sandpack
, I know there's the@codesandbox/sandpack/unstyled
export, however this isn't a viable choice because they aren't modular enough to be interoperable with the regular styled exports. I don't mind styling from scratch, I would just prefer to not have to set syntax highlighting for the editor.What I want
This way I could still use theme and have syntax highlighting alongside benefitting rom the editor props such as wrap content etc but I could apply my own classes to everything else. However this throws the error below.
Which leads me to believe the
SandpackProvider
components are incompatible.What I'm currently trying
To overwrite the default
sp-
classes from sandpack with my own custom css class. (as a side note, where would I find the othersp-
classes do you suggest just reading the source code because i could not locate them in the docs)However the runtime styles used by the library are overwriting the classes I pass in with the options object.
You can see my css rule
ss-block
is being overwrriten bysp-c-iKJbEZ
May or may not be helpful
Josh Comeau has a styled sandpack that's pretty close to what I'm looking for.
The new React docs also implement a custom sandpack config however they do the syntax highlighting manually + are using an older verison
Beta Was this translation helpful? Give feedback.
All reactions