Question about Spark; how do I toggle the loading on?

  • jeroen4264-1343895693386842165

    Jerry

    18 days ago

    Hey! I'm playing around with Spark and some things are clear but some are not. One of these things is the button that has a loading attribute that you can set to true and that it will show the loading animation. But how do I set it to loading? I tried passing down attributes but that doesn't work.
    βœ…1
    βœ…1
  • max.kayr-1343898331423965256

    Max

    18 days ago

    Hi @Jerry! I am not sure what you mean. You just need to set the "loading" attribute to "true". Then the button shows the loading state. Are you working with Spark One?
  • jeroen4264-1343900871313854506

    Jerry

    18 days ago

    Yes sorry for the vague explaination @Max Indeed if I set the attribute to true it works, but I don't know how to set it to true if the component is nested 3 layers deep.

    for example in this scenario I don't know how to set the loading to true. Do I create a variable isClicked within the component and set that to true when someone uses the onClick event?

    So in other words, I want to set it to loading when someone clicks on the button but I don't want to do it in a messy way and don't know what the best practices are 😬
    1343900871049744455-image.png
  • max.kayr-1343911903432278069

    Max

    18 days ago

    I see 😊 this is not specific to Spark. There are three options:
    - You can bring your logic closer to the button and don't have it high up your tree
    - you can pass down the state from component to component until you reach the button
    - you use contexts

    I believe that there are toddle videos on components and contexts available 😊
  • jeroen4264-1343920796304670762

    Jerry

    18 days ago

    Got it, thanks @Max!
    πŸ’ͺ1
    πŸ’ͺ1

Stop scrolling. Start building.

toddle is a visual web app builder that rivals custom code β€” but accessible to your entire team!

Try toddle β€” it's free!

Β© Copyright 2024 toddle. All rights reserved.