I am facing the same issue and would also like to know how to solve it, please.
Just like OP, when I try to place keys like large: { ... }, small: { ... }, it doesn’t work as expected. Instead of setting default styles, the entire contents of defaultStyles are placed into the responsiveStyles.large property of the component. This results in large: { large: { ... } ...}.
Is there a way to set default styles for tablet and mobile breakpoints?
Hello, has there been any progress on this topic? Additionally, I need to add default styles to the component, with different values for each breakpoint. If there have been any developments, please let me know. Thank you!
For those who keep having issues, the fix is not applied AFAIK so my current approach is the following:
Create your custom component with you general default styles (the ones that don’t depend on a specific breakpoint)
On the visual editor drag you custom component to a page, click on “Data” panel, then “Code” and then “Edit JSX”
In that code window you are able to use Mitosis Styling Feature and the cool thing is that you can use any custom media query (you are not limited to the 3 options that builder has)
Once you are done with the editing, click save and create a template of that custom component
Now instead of using the custom component, use the template and you will be no longer limited!
Don’t know if there’s a better approach but is the one I got working.
Yes, you can use different styles for breakpoints in defaultStyles when registering a component in Builder.io. Instead of defaultStyles, you should define styles within defaults using responsiveStyles. Here’s an example: