iconbutton.py 935 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. """An icon button component."""
  2. from typing import Optional
  3. from reflex.components.chakra.typography.text import Text
  4. from reflex.components.component import Component
  5. from reflex.vars import Var
  6. class IconButton(Text):
  7. """A button with an icon."""
  8. tag = "IconButton"
  9. library = "@chakra-ui/button@2.1.0"
  10. # The type of button.
  11. type: Var[str]
  12. # A label that describes the button
  13. aria_label: Var[str]
  14. # The icon to be used in the button.
  15. icon: Optional[Component]
  16. # If true, the button will be styled in its active state.
  17. is_active: Var[bool]
  18. # If true, the button will be disabled.
  19. is_disabled: Var[bool]
  20. # If true, the button will show a spinner.
  21. is_loading: Var[bool]
  22. # If true, the button will be perfectly round. Else, it'll be slightly round
  23. is_round: Var[bool]
  24. # Replace the spinner component when isLoading is set to true
  25. spinner: Var[str]