reflex/reflex/.templates/apps/demo/code/webui/components/loading_icon.py
2023-10-26 19:45:33 -07:00

27 lines
680 B
Python

import reflex as rx
class LoadingIcon(rx.Component):
"""A custom loading icon component."""
library = "react-loading-icons"
tag = "SpinningCircles"
stroke: rx.Var[str]
stroke_opacity: rx.Var[str]
fill: rx.Var[str]
fill_opacity: rx.Var[str]
stroke_width: rx.Var[str]
speed: rx.Var[str]
height: rx.Var[str]
def get_event_triggers(self) -> dict:
"""Get the event triggers that pass the component's value to the handler.
Returns:
A dict mapping the event trigger to the var that is passed to the handler.
"""
return {"on_change": lambda status: [status]}
loading_icon = LoadingIcon.create