data_list.py 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. """Components for the DataList component of Radix Themes."""
  2. from types import SimpleNamespace
  3. from typing import Literal
  4. from reflex.components.core.breakpoints import Responsive
  5. from reflex.vars import Var
  6. from ..base import LiteralAccentColor, RadixThemesComponent
  7. class DataListRoot(RadixThemesComponent):
  8. """Root element for a DataList component."""
  9. tag = "DataList.Root"
  10. # The orientation of the data list item: "horizontal" | "vertical"
  11. orientation: Var[Responsive[Literal["horizontal", "vertical"]]]
  12. # The size of the data list item: "1" | "2" | "3"
  13. size: Var[Responsive[Literal["1", "2", "3"]]]
  14. # Trims the leading whitespace from the start or end of the text.
  15. trim: Var[Responsive[Literal["normal", "start", "end", "both"]]]
  16. class DataListItem(RadixThemesComponent):
  17. """An item in the DataList component."""
  18. tag = "DataList.Item"
  19. # The alignment of the data list item within its container.
  20. align: Var[Responsive[Literal["start", "center", "end", "baseline", "stretch"]]]
  21. class DataListLabel(RadixThemesComponent):
  22. """A label in the DataList component."""
  23. tag = "DataList.Label"
  24. # The width of the component
  25. width: Var[Responsive[str]]
  26. # The minimum width of the component
  27. min_width: Var[Responsive[str]]
  28. # The maximum width of the component
  29. max_width: Var[Responsive[str]]
  30. # The color scheme for the DataList component.
  31. color_scheme: Var[LiteralAccentColor]
  32. class DataListValue(RadixThemesComponent):
  33. """A value in the DataList component."""
  34. tag = "DataList.Value"
  35. class DataList(SimpleNamespace):
  36. """DataList components namespace."""
  37. root = staticmethod(DataListRoot.create)
  38. item = staticmethod(DataListItem.create)
  39. label = staticmethod(DataListLabel.create)
  40. value = staticmethod(DataListValue.create)
  41. data_list = DataList()