button.py 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. """A button component."""
  2. from pynecone.components.libs.chakra import ChakraComponent
  3. from pynecone.var 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 type of button.
  8. type: Var[str]
  9. # The space between the button icon and label.
  10. icon_spacing: Var[int]
  11. # If true, the button will be styled in its active state.
  12. is_active: Var[bool]
  13. # If true, the button will be styled in its disabled state.
  14. is_disabled: Var[bool]
  15. # If true, the button will take up the full width of its container.
  16. is_full_width: Var[bool]
  17. # If true, the button will show a spinner.
  18. is_loading: Var[bool]
  19. # The label to show in the button when isLoading is true If no text is passed, it only shows the spinner.
  20. loading_text: Var[str]
  21. # "lg" | "md" | "sm" | "xs"
  22. size: Var[str]
  23. # "ghost" | "outline" | "solid" | "link" | "unstyled"
  24. variant: Var[str]
  25. # Built in color scheme for ease of use.
  26. color_scheme: Var[str]
  27. class ButtonGroup(ChakraComponent):
  28. """A group of buttons."""
  29. tag = "ButtonGroup"
  30. # If true, the borderRadius of button that are direct children will be altered to look flushed together.
  31. is_attached: Var[bool]
  32. # If true, all wrapped button will be disabled.
  33. is_disabled: Var[bool]
  34. # The spacing between the buttons.
  35. spacing: Var[int]