Skip to content

Commit

Permalink
HighLevelSelect: pass flex_shrink prop to SelectTrigger (#2876)
Browse files Browse the repository at this point in the history
* Revert "Remove width prop from rx.select (#2835)"

This reverts commit d14292d.

* HighLevelSelect: pass flex_shrink prop to SelectTrigger

This allows the high level select to have width="100%" and also shrink-to-fit inside a parent container.

Fix #2824, kind of
  • Loading branch information
masenf committed Mar 18, 2024
1 parent ee1ff7f commit f446d06
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 4 additions & 1 deletion reflex/components/radix/themes/components/select.py
Expand Up @@ -181,6 +181,9 @@ class HighLevelSelect(SelectRoot):
# The radius of the select.
radius: Var[LiteralRadius]

# The width of the select.
width: Var[str]

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

Expand All @@ -203,7 +206,7 @@ def create(cls, items: Union[List[str], Var[List[str]]], **props) -> Component:

trigger_props = {
prop: props.pop(prop)
for prop in ["placeholder", "variant", "radius"]
for prop in ["placeholder", "variant", "radius", "width", "flex_shrink"]
if prop in props
}

Expand Down
4 changes: 4 additions & 0 deletions reflex/components/radix/themes/components/select.pyi
Expand Up @@ -863,6 +863,7 @@ class HighLevelSelect(SelectRoot):
Literal["none", "small", "medium", "large", "full"],
]
] = None,
width: Optional[Union[Var[str], str]] = None,
position: Optional[
Union[
Var[Literal["item-aligned", "popper"]],
Expand Down Expand Up @@ -949,6 +950,7 @@ class HighLevelSelect(SelectRoot):
high_contrast: Whether to render the select with higher contrast color against background.
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.
Expand Down Expand Up @@ -1061,6 +1063,7 @@ class Select(ComponentNamespace):
Literal["none", "small", "medium", "large", "full"],
]
] = None,
width: Optional[Union[Var[str], str]] = None,
position: Optional[
Union[
Var[Literal["item-aligned", "popper"]],
Expand Down Expand Up @@ -1147,6 +1150,7 @@ class Select(ComponentNamespace):
high_contrast: Whether to render the select with higher contrast color against background.
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.
Expand Down

0 comments on commit f446d06

Please sign in to comment.