Change url of a button from CMS but have a default if not

I’m curious if there’s a good way to have a button, either as a component or not, to have a default url assigned to it and have that url be overwritten by a CMS field if it’s been set.

For instance:
I have CTA-Button with a default url of in my hero section of a CMS page template. I want to change the url that CTA-Button to on a few of my CMS page entries but leave it as for the other entries that I haven’t set.

Basically [if cta override is set, use new url; else leave as]

Any thoughts or best practices?

Components have been upgraded lately, quietly- I’ve noticed some new stuff. Give it a try. What you’re describing here is a conditional override- it may work conditionally, or it may override it with a NULL link. Can’t guess.

The old-school way to do this is to create two buttons, identical.

Button A - static text, default link, set to conditionally visible.
Will only display if you do NOT have a link set on your CMS item

Button B - dynamic text, dynamic link, set to conditionally visible.
Will only display if you DO have a link set on your CMS item.

Thanks. Yeah, right now I’ve got the 2 button method implemented, but it’s not very clean to look at and easy to forget that there’s a hidden button there. From my experimenting, the component asks for the CMS value and if that’s not set, it returns NULL. Otherwise, if it’s a “static” component, you can override it in the designer and have a default url value if not overwritten. But if you hook it up to the CMS, it just pulls the CMS field’s value which is NULL. Maybe that’ll be an option in the future :person_shrugging:

Yes or it may be possible to use conditional visibility within the component itself, so that it’s two-button approach is at least self-contained and reusable.

Great to see Webflow making big inroads here.