link.py 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. """Components for rendering heading.
  2. https://www.radix-ui.com/themes/docs/theme/typography
  3. """
  4. from __future__ import annotations
  5. from typing import Literal
  6. from reflex.components.el.elements.inline import A
  7. from reflex.vars import Var
  8. from ..base import (
  9. CommonMarginProps,
  10. LiteralAccentColor,
  11. RadixThemesComponent,
  12. )
  13. from .base import (
  14. LiteralTextSize,
  15. LiteralTextTrim,
  16. LiteralTextWeight,
  17. )
  18. LiteralLinkUnderline = Literal["auto", "hover", "always"]
  19. class Link(CommonMarginProps, RadixThemesComponent, A):
  20. """A semantic element for navigation between pages."""
  21. tag = "Link"
  22. # Change the default rendered element for the one passed as a child, merging their props and behavior.
  23. as_child: Var[bool]
  24. # Text size: "1" - "9"
  25. size: Var[LiteralTextSize]
  26. # Thickness of text: "light" | "regular" | "medium" | "bold"
  27. weight: Var[LiteralTextWeight]
  28. # Removes the leading trim space: "normal" | "start" | "end" | "both"
  29. trim: Var[LiteralTextTrim]
  30. # Sets the visibility of the underline affordance: "auto" | "hover" | "always"
  31. underline: Var[LiteralLinkUnderline]
  32. # Overrides the accent color inherited from the Theme.
  33. color: Var[LiteralAccentColor]
  34. # Whether to render the text with higher contrast color
  35. high_contrast: Var[bool]