Skip to content

Commit cc199a3

Browse files
authored
select follow up changes (#6)
1 parent 69e29ec commit cc199a3

File tree

1 file changed

+28
-31
lines changed

1 file changed

+28
-31
lines changed

reflex_ui/components/base/select.py

Lines changed: 28 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,7 @@ class SelectRoot(SelectBaseComponent):
9898

9999

100100
class SelectTrigger(SelectBaseComponent):
101-
"""A button that opens the select menu.
102-
Renders a `<div>` element.
103-
"""
101+
"""A button that opens the select menu."""
104102

105103
tag = "Select.Trigger"
106104

@@ -160,39 +158,39 @@ class SelectPositioner(SelectBaseComponent):
160158

161159
tag = "Select.Positioner"
162160

163-
# How to align the popup relative to the specified side.
164-
align: Var[LiteralAlign] = Var.create("center")
161+
# How to align the popup relative to the specified side. Defaults to "center".
162+
align: Var[LiteralAlign]
165163

166-
# Additional offset along the alignment axis in pixels.
167-
align_offset: Var[int] = Var.create(0)
164+
# Additional offset along the alignment axis in pixels. Defaults to 0.
165+
align_offset: Var[int]
168166

169-
# Which side of the anchor element to align the popup against. May automatically change to avoid collisions.
170-
side: Var[LiteralSide] = Var.create("bottom")
167+
# Which side of the anchor element to align the popup against. May automatically change to avoid collisions. Defaults to "bottom".
168+
side: Var[LiteralSide]
171169

172170
# Minimum distance to maintain between the arrow and the edges of the popup.
173-
# Use it to prevent the arrow element from hanging out of the rounded corners of a popup.
174-
arrow_padding: Var[int] = Var.create(5)
171+
# Use it to prevent the arrow element from hanging out of the rounded corners of a popup. Defaults to 5.
172+
arrow_padding: Var[int]
175173

176-
# Additional space to maintain from the edge of the collision boundary.
177-
collision_padding: Var[int | list[int]] = Var.create(5)
174+
# Additional space to maintain from the edge of the collision boundary. Defaults to 5.
175+
collision_padding: Var[int | list[int]]
178176

179-
# Whether to maintain the popup in the viewport after the anchor element was scrolled out of view.
180-
sticky: Var[bool] = Var.create(False)
177+
# Whether to maintain the popup in the viewport after the anchor element was scrolled out of view. Defaults to False.
178+
sticky: Var[bool]
181179

182-
# Determines which CSS position property to use.
183-
position_method: Var[LiteralPosition] = Var.create("absolute")
180+
# Determines which CSS position property to use. Defaults to "absolute".
181+
position_method: Var[LiteralPosition]
184182

185-
# Whether the positioner overlaps the trigger so the selected item's text is aligned with the trigger's value text. This only applies to mouse input and is automatically disabled if there is not enough space.
183+
# Whether the positioner overlaps the trigger so the selected item's text is aligned with the trigger's value text. This only applies to mouse input and is automatically disabled if there is not enough space. Defaults to False.
186184
align_item_with_trigger: Var[bool] = Var.create(False)
187185

188-
# Whether the popup tracks any layout shift of its positioning anchor.
189-
track_anchor: Var[bool] = Var.create(True)
186+
# Whether the popup tracks any layout shift of its positioning anchor. Defaults to True.
187+
track_anchor: Var[bool]
190188

191189
# Distance between the anchor and the popup in pixels.
192-
side_offset: Var[int] = Var.create(0)
190+
side_offset: Var[int] = Var.create(4)
193191

194192
# Determines how to handle collisions when positioning the popup.
195-
collision_avoidance: Var[str] = Var.create("shift")
193+
collision_avoidance: Var[str]
196194

197195
# The render prop
198196
render_: Component
@@ -231,7 +229,7 @@ class SelectItem(SelectBaseComponent):
231229
value: Var[Any]
232230

233231
# Whether the component should ignore user interaction.
234-
disabled: Var[bool] = Var.create(False)
232+
disabled: Var[bool]
235233

236234
# The render prop
237235
render_: Var[Component]
@@ -263,8 +261,8 @@ class SelectItemIndicator(SelectBaseComponent):
263261

264262
tag = "Select.ItemIndicator"
265263

266-
# Whether to keep the HTML element in the DOM when the item is not selected.
267-
keep_mounted: Var[bool] = Var.create(False)
264+
# Whether to keep the HTML element in the DOM when the item is not selected. Defaults to False.
265+
keep_mounted: Var[bool]
268266

269267
# The render prop
270268
render_: Var[Component]
@@ -359,8 +357,8 @@ class SelectScrollUpArrow(SelectBaseComponent):
359357

360358
tag = "Select.ScrollUpArrow"
361359

362-
# Whether to keep the component mounted when not visible
363-
keep_mounted: Var[bool] = Var.create(False)
360+
# Whether to keep the component mounted when not visible. Defaults to False.
361+
keep_mounted: Var[bool]
364362

365363
# The render prop
366364
render_: Var[Component]
@@ -377,11 +375,11 @@ class SelectScrollDownArrow(SelectBaseComponent):
377375

378376
tag = "Select.ScrollDownArrow"
379377

380-
# Whether to keep the component mounted when not visible
381-
keep_mounted: Var[bool] = Var.create(False)
378+
# Whether to keep the component mounted when not visible. Defaults to False.
379+
keep_mounted: Var[bool]
382380

383381
# The render prop
384-
render_: Component
382+
render_: Var[Component]
385383

386384
@classmethod
387385
def create(cls, *children, **props) -> Component:
@@ -437,7 +435,6 @@ def create(cls, *children, **props) -> Component:
437435
positioner_props = {
438436
k: props.pop(k) for k in cls._positioner_props & props.keys()
439437
}
440-
positioner_props.setdefault("side_offset", 4)
441438
portal_props = {k: props.pop(k) for k in cls._portal_props & props.keys()}
442439

443440
# Get extracted values with defaults

0 commit comments

Comments
 (0)