1
0

button.py 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. """A button component."""
  2. from reflex.components.libs.chakra import ChakraComponent
  3. from reflex.vars import Var
  4. class Button(ChakraComponent):
  5. """The Button component is used to trigger an event or event, such as submitting a form, opening a dialog, canceling an event, or performing a delete operation."""
  6. tag = "Button"
  7. # The space between the button icon and label.
  8. icon_spacing: Var[int]
  9. # If true, the button will be styled in its active state.
  10. is_active: Var[bool]
  11. # If true, the button will be styled in its disabled state.
  12. is_disabled: Var[bool]
  13. # If true, the button will take up the full width of its container.
  14. is_full_width: Var[bool]
  15. # If true, the button will show a spinner.
  16. is_loading: Var[bool]
  17. # The label to show in the button when isLoading is true If no text is passed, it only shows the spinner.
  18. loading_text: Var[str]
  19. # "lg" | "md" | "sm" | "xs"
  20. size: Var[str]
  21. # "ghost" | "outline" | "solid" | "link" | "unstyled"
  22. variant: Var[str]
  23. # Built in color scheme for ease of use.
  24. # Options:
  25. # "whiteAlpha" | "blackAlpha" | "gray" | "red" | "orange" | "yellow" | "green" | "teal" | "blue" | "cyan"
  26. # | "purple" | "pink" | "linkedin" | "facebook" | "messenger" | "whatsapp" | "twitter" | "telegram"
  27. color_scheme: Var[str]
  28. # The type of button.
  29. type_: Var[str]
  30. class ButtonGroup(ChakraComponent):
  31. """A group of buttons."""
  32. tag = "ButtonGroup"
  33. # If true, the borderRadius of button that are direct children will be altered to look flushed together.
  34. is_attached: Var[bool]
  35. # If true, all wrapped button will be disabled.
  36. is_disabled: Var[bool]
  37. # The spacing between the buttons.
  38. spacing: Var[int]