hover card and one prop for dialog

This commit is contained in:
Tom Gotsman 2024-10-29 16:12:02 +00:00
parent 8f07082eba
commit a15737a0d6
2 changed files with 16 additions and 1 deletions

View File

@ -25,6 +25,9 @@ class DialogRoot(RadixThemesComponent):
# Fired when the open state changes. # Fired when the open state changes.
on_open_change: EventHandler[identity_event(bool)] on_open_change: EventHandler[identity_event(bool)]
# The open state of the dialog when it is initially rendered. Use when you do not need to control its open state.
default_open: Var[bool]
class DialogTrigger(RadixThemesTriggerComponent): class DialogTrigger(RadixThemesTriggerComponent):
"""Trigger an action or event, to open a Dialog modal.""" """Trigger an action or event, to open a Dialog modal."""

View File

@ -1,6 +1,6 @@
"""Interactive components provided by @radix-ui/themes.""" """Interactive components provided by @radix-ui/themes."""
from typing import Literal from typing import Literal, Union
from reflex.components.component import ComponentNamespace from reflex.components.component import ComponentNamespace
from reflex.components.core.breakpoints import Responsive from reflex.components.core.breakpoints import Responsive
@ -55,8 +55,20 @@ class HoverCardContent(elements.Div, RadixThemesComponent):
# The preferred alignment against the trigger. May change when collisions occur. # The preferred alignment against the trigger. May change when collisions occur.
align: Var[Literal["start", "center", "end"]] align: Var[Literal["start", "center", "end"]]
# An offset in pixels from the "start" or "end" alignment options.
align_offset: Var[int]
# Whether or not the hover card should avoid collisions with its trigger. # Whether or not the hover card should avoid collisions with its trigger.
avoid_collisions: Var[bool] avoid_collisions: Var[bool]
# The distance in pixels from the boundary edges where collision detection should occur. Accepts a number (same for all sides), or a partial padding object, for example: { top: 20, left: 20 }.
collision_padding: Var[Union[int, dict[str, int]]]
# The sticky behavior on the align axis. "partial" will keep the content in the boundary as long as the trigger is at least partially in the boundary whilst "always" will keep the content in the boundary regardless
sticky: Var[Literal["partial", "always"]]
# Hovercard size "1" - "3"
size: Var[Responsive[Literal["1", "2", "3"]]]
class HoverCard(ComponentNamespace): class HoverCard(ComponentNamespace):