Is there a way to change color properties of component instances? If not, are there any workarounds?
hi @asgsdf all these informations are well documented in WF documentation.
link is pointing to the exact part that will give you an answer but it will be for you beneficial always search first there to find answers to your questions you can also finish all WFU video courses to learn and get familiar with this platform.
Hi @Stan,
Thanks for the infoā¦ but the anchor you sent is for unlinking a component, which is what shows up when doing a quick search, but does not answer the question.
I think itās obvious unlinking the component is an option, but also defeats the purpose of using a component in the first place in most scenarios. Thatās why I was asking here to see what kind of workarounds folks had, if any. Thanks again for providing yours.
hi @asgsdf answer
The workaround for setting the component background is very simple. Wrap the component in div
element and add another absolutely positioned div
element called eg. background and give it the color you need. Because all elements are transparent your background will be visible. Donāt forget to set correctly relative and absolute positioning together with z-indexes
hope this will help to solve your request
THE EXAMPLE of the above description
You have to keep in mind that WF offers only very basic, simple, and limited tools but this is the price for no-code.
Thatās a fairly simple and clever way to handle background colors (as long as your components arenāt Sections). Thanks for taking the time to explain.
Yep, but if you read through the documentation it looks like theyāre already working on it, so fingers crossed!
I like your newcomer enthusiasm and optimism @asgsdf. Hope this will say for a long time. Donāt lose it.
2021
2023
If you do not have further questions related to your topic feel free to close it as solved.
Hi,
there is actually a really easy solution.
You can set up a pageload animation and change the background color on load.
That way you donāt need any additional div blocks and can use your default component.
You can see the setup here:
https://preview.webflow.com/preview/julians-dandy-site-0952f8?utm_medium=preview_link&utm_source=designer&utm_content=julians-dandy-site-0952f8&preview=07ec3de6cc0bdc2fdff75f5fc9a5c636&workflow=preview
Ah nice! Looks like that would work for text color too. Never would have thought of that, thanks!
Hello! Iām in a similar situation. I have different pages, and actually i want to establish a colour palette for each one (I want a page with some title colors in Blue, but i want them green in another page). I think this is done easily in react by passing the color as a component prop and setting the color as a style. Butā¦ can this be done in webflow? As you guys, I want to maintain the layout and size of the text, for example. But in this particular case, I donāt find useful unlinking the components, or linking them ha!
Can you guys help me?
Iām so glad Iām not the only one that has weird things that happen in webflow for no logical reason
Hey guys I thought Iād add another solution here that feels a bit more elegant than using Webflow interactions or absolutely positioned elements.
We can use the combination of a component text property and some custom CSS.
-
After creating our component we can go into the settings of the element we want to change the background for - in my case itās my section element
-
Letās add a new attribute called ādata-bg-colorā and hook the value up to a component property
-
Create a new property and call it āBackground Colorā. Set the default value to whichever color youād like - in my case Iāll use āwhiteā (the word doesnāt matter, just as long as it matches the CSS weāre about to write)
-
After clicking āCreateā you should have something that looks like this - time for our CSS
-
Create a new code embed and paste the following code into it
<style> /* change ".section_fractional-bdm" to the class name of your element */ /* change "blue" to the color you want */ /* change "var(--background-color--background-secondary) to the CSS color you want" */ .section_fractional-bdm[data-bg-color="blue"] { background-color: var(--background-color--background-secondary); } </style>
-
Letās talk about this code
- The yellow part is the class name of our section weāre changing the background color of
- The part immediately following it wrapped in āā - is saying if an element of this class also has this attribute ādata-bg-colorā and its value is āblueā then do this style to it
- ābackground-color: var(ābackground-colorābackground-secondary);ā is setting the background color to one of my color variables - in this case itās a nice light blue (#EEF5FC). We could remove the var part and simply write something like āblueā and it will work but it will be a yucky default blue . Any valid CSS color works here (hex, rgb etc.)
- You can copy this code in between the style tags as many times as youād like to create as many different background colors as youād like
-
Now letās go back out of the component and change its property from the default to āblueā and watch the magic unfold
Hi ! can someone please review this https://discourse.webflow.com/t/nested-cms-and-hover-interaction/295099?u=paula_cortes