button.py 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. """Interactive components provided by @radix-ui/themes."""
  2. from typing import Literal
  3. from reflex import el
  4. from reflex.vars import Var
  5. from ..base import (
  6. CommonMarginProps,
  7. LiteralAccentColor,
  8. LiteralRadius,
  9. LiteralVariant,
  10. RadixThemesComponent,
  11. )
  12. LiteralButtonSize = Literal[1, 2, 3, 4]
  13. class Button(el.Button, CommonMarginProps, RadixThemesComponent):
  14. """Trigger an action or event, such as submitting a form or displaying a dialog."""
  15. tag = "Button"
  16. # Change the default rendered element for the one passed as a child, merging their props and behavior.
  17. as_child: Var[bool]
  18. # Button size "1" - "4"
  19. size: Var[LiteralButtonSize]
  20. # Variant of button: "solid" | "soft" | "outline" | "ghost"
  21. variant: Var[LiteralVariant]
  22. # Override theme color for button
  23. color: Var[LiteralAccentColor]
  24. # Whether to render the button with higher contrast color against background
  25. high_contrast: Var[bool]
  26. # Override theme radius for button: "none" | "small" | "medium" | "large" | "full"
  27. radius: Var[LiteralRadius]