Join the Webstudio community

Updated 10 months ago

How to show Element only in the Designer

At a glance

The community members are discussing how to show a 12-column grid only in the design mode and not in the published version of a Webflow project. One community member suggests using an HTML Embed and an expression to conditionally show the grid based on the system.origin. Another community member asks why this is needed, and the original poster explains that they want to display the grid during the design phase without having to set the element to display: none before publishing.

The discussion includes references to Webflow's native grid guide and Timothy Ricks' Lumos framework, which seems to have a more flexible grid approach. Some community members suggest manually turning the grid on and off, while others recommend an automatic solution to hide the grid when the project is published. One community member provides a CSS selector to hide the grid in production, but cautions that it relies on an internal implementation detail that could change in the future.

The community members agree that a better solution would be to have a way to display the grid guidelines without the need for "hackery". An issue has been created on GitHub to further discuss and explore solutions for this use case.

Useful resources
Hi, is there a way to show Elements only in the Designer? For Webflow there is something like this:

html:not(.wf-design-mode) .styleguide_guide_wrap { display: none; }

I wanna show my 12 col grid only in the Design mode...
1
J
O
M
16 comments
theres probably multiple ways to tackle this but I'll take a stab. You could add an HTML Embed to the canvas and bind an expression to conditionally show it. It will show if the system.origin is equal to your project subdomain. This should work if you don't use the subdomain as your actual site. System.origin translates to whatever the domain you are currently viewing. So on a custom domain it would be yourcustomdomain.com but in the editor it uses the subdomain

system.origin === 'https://<yourprojectdomain>.wstd.io'
Attachment
image.png
why do you neeed this in the first place?
I want to display the grid for the design phase and not set the element to display none every time before publishing. Timothy Ricks also has such an element in the lumos styleguide.
Can you point me to this video please? I am curious to better understand the use case to better understand the ideal solution
webflow has this guide fyi
Attachment
image.png
ive personally never used it before though
yeah, I am curious to see what this grid is about from Timothy
I see, that's interesting, is it because wf's native guide is not flexible enough to set up the exact grid cell size?
@Mano would just turning on and off manually be an option? especially since we now have a very handy quick on/off switch directly in the navigator?

Or do you think it also needs a safeguard for automatic off when published and forgot to turn it off?
to finally answer that speicific question, here is a selector you could use to achieve that hiding in prod:

Plain Text
body:not([data-ws-component]) .styleguide_guide_wrap {
    display: none;
}


Though with caution, just like with ".wf-design-mode", that attribute is internal implementation detail and can change in the future.
I do want to think in more detail about these guide lines, so we can have them without the need for this hackery and in a way that works for everyone
Yes, exactly. I never used wf's native guide but.

I've been using T.Ricks' flexible grid approach ever since I discovered it.
I think it also needs a automatic off when published... would be very smart!
Figma has also a very good implementation of grid
Add a reply
Sign up and join the conversation on Discord