Segment property

I have a custom component with a segment containing two options: “on” and “off.” How can I ensure that the input values in the properties are not passed through when the segment is set to “off,” and therefore have no effect in the template?
Scherm­afbeelding 2024-12-15 om 12.16.13

This is the component code:

Hmm, you could use the hooks file to check what value is selected and generate the relevant HTML based on that…

Here’s the Custom Component from the video.

Let me know if that’d work for you, if not @bon or @tpbradley might be able to suggest other ways to do this!

Thanks again Dan for your excellent support : even on a cloudy Sunday afternoon :grinning: It works fine now :sweat_smile:

1 Like

Super-duper, you’re welcome! Also, there’s nothing better than tinkering away at the computer on a dreary Sunday afternoon :smiling_face:

1 Like

And once again, a (limited) devpack is ready. It’s truly incredible what possibilities Elements offers to build components yourself in a relatively straightforward way. Bit by bit, we’re starting to understand the structure of certain codes. Before I started with custom components, all programming code was completely incomprehensible to me, but now I’m beginning to grasp a little of the structure and underlying logic, even if still in a very limited way. However, it remains fascinating, and every small step forward motivates to keep trying. :nerd_face:

1 Like