Help forum

Hardcoding animations on conditional rendering?

  • Alfred

    2 years ago

    Hi,
    Has someone achieved hardcoding CSS animations on elements which utilise conditional rendering "show"? We have multiple features and components relying on conditional rendering and where the user experience would be improved. Sidepanels, toasts, dialogs, dimmers, dropdowns etc. We have chosen conditional rendering "show" instead of handling display: none/flex.
  • Victor Giron

    2 years ago

    I am also having this challenge, for drawers for example, since the element is show=false, the animation doesn't work
  • Alfred

    2 years ago

    Yes, without any animation it makes the user experience look a bit rough also for adding/removing items in repeated lists
  • Lucas G

    2 years ago

    To animate with the show/hide you'll have to handle how the classes for the animation get applied
  • One way to do it is via workflows
  • Lucas G

    2 years ago

    Since the typical way to animate is to add a class, we have to first handle the condition to show then add the class
  • Alfred

    2 years ago

    I guess you should be able to trigger the workflow from "on load" if you have a sidebar component. That handles the component's internal classes, so that the component does not have to be handled with both a show attribute and show/hide. I'll try to test it this afternoon.