Skip to content

Commit

Permalink
Allow access to position from HighLevelSelect (reflex-dev#2829)
Browse files Browse the repository at this point in the history
  • Loading branch information
hjpr authored and Malte Klemm committed Mar 12, 2024
1 parent 5a5ac14 commit 60bd0a0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
7 changes: 6 additions & 1 deletion reflex/components/radix/themes/components/select.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,9 @@ class HighLevelSelect(SelectRoot):
# The width of the select.
width: Var[str]

# The positioning mode to use. Default is "item-aligned".
position: Var[Literal["item-aligned", "popper"]]

@classmethod
def create(cls, items: Union[List[str], Var[List[str]]], **props) -> Component:
"""Create a select component.
Expand All @@ -196,7 +199,9 @@ def create(cls, items: Union[List[str], Var[List[str]]], **props) -> Component:
The select component.
"""
content_props = {
prop: props.pop(prop) for prop in ["high_contrast"] if prop in props
prop: props.pop(prop)
for prop in ["high_contrast", "position"]
if prop in props
}

trigger_props = {
Expand Down
14 changes: 14 additions & 0 deletions reflex/components/radix/themes/components/select.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -864,6 +864,12 @@ class HighLevelSelect(SelectRoot):
]
] = None,
width: Optional[Union[Var[str], str]] = None,
position: Optional[
Union[
Var[Literal["item-aligned", "popper"]],
Literal["item-aligned", "popper"],
]
] = None,
size: Optional[
Union[Var[Literal["1", "2", "3"]], Literal["1", "2", "3"]]
] = None,
Expand Down Expand Up @@ -945,6 +951,7 @@ class HighLevelSelect(SelectRoot):
variant: The variant of the select.
radius: The radius of the select.
width: The width of the select.
position: The positioning mode to use. Default is "item-aligned".
size: The size of the select: "1" | "2" | "3"
default_value: The value of the select when initially rendered. Use when you do not need to control the state of the select.
value: The controlled value of the select. Should be used in conjunction with on_change.
Expand Down Expand Up @@ -1057,6 +1064,12 @@ class Select(ComponentNamespace):
]
] = None,
width: Optional[Union[Var[str], str]] = None,
position: Optional[
Union[
Var[Literal["item-aligned", "popper"]],
Literal["item-aligned", "popper"],
]
] = None,
size: Optional[
Union[Var[Literal["1", "2", "3"]], Literal["1", "2", "3"]]
] = None,
Expand Down Expand Up @@ -1138,6 +1151,7 @@ class Select(ComponentNamespace):
variant: The variant of the select.
radius: The radius of the select.
width: The width of the select.
position: The positioning mode to use. Default is "item-aligned".
size: The size of the select: "1" | "2" | "3"
default_value: The value of the select when initially rendered. Use when you do not need to control the state of the select.
value: The controlled value of the select. Should be used in conjunction with on_change.
Expand Down

0 comments on commit 60bd0a0

Please sign in to comment.