optionalize all Var props without defaults

This commit is contained in:
Benedikt Bartscher 2024-02-29 20:39:58 +01:00
parent fd5a5b97f2
commit d0f15c591d
No known key found for this signature in database
130 changed files with 1680 additions and 1701 deletions

View File

@ -1,5 +1,5 @@
"""Display the title of the current page."""
from typing import Optional
from reflex.components.component import Component
from reflex.vars import Var
@ -11,10 +11,10 @@ class RawLink(Component):
tag = "link"
# The href.
href: Var[str]
href: Optional[Var[str]] = None
# The type of link.
rel: Var[str]
rel: Optional[Var[str]] = None
class ScriptTag(Component):
@ -23,22 +23,22 @@ class ScriptTag(Component):
tag = "script"
# The type of script represented.
type_: Var[str]
type_: Optional[Var[str]] = None
# The URI of an external script.
source: Var[str]
source: Optional[Var[str]] = None
# Metadata to verify the content of the script.
integrity: Var[str]
integrity: Optional[Var[str]] = None
# Whether to allow cross-origin requests.
crossorigin: Var[str]
crossorigin: Optional[Var[str]] = None
# Indicates which referrer to send when fetching the script.
referrer_policy: Var[str]
referrer_policy: Optional[Var[str]] = None
# Whether to asynchronously load the script.
is_async: Var[bool]
is_async: Optional[Var[bool]] = None
# Whether to defer loading the script.
defer: Var[bool]
defer: Optional[Var[bool]] = None

View File

@ -1,10 +1,10 @@
"""Next.js script wrappers and inline script functionality.
https://nextjs.org/docs/app/api-reference/components/script
from typing import Optional
https://nextjs.org/docs/app/api-reference/components/script.
"""
from __future__ import annotations
from typing import Any, Union
from typing import Any, Optional, Union
from reflex.components.component import Component
from reflex.vars import Var
@ -25,7 +25,7 @@ class Script(Component):
is_default = True
# Required unless inline script is used
src: Var[str]
src: Optional[Var[str]] = None
# When the script will execute: afterInteractive | beforeInteractive | lazyOnload
strategy: Var[str] = "afterInteractive" # type: ignore

View File

@ -1,4 +1,5 @@
"""Badge component."""
from typing import Optional
from reflex.components.chakra import ChakraComponent, LiteralVariant
from reflex.vars import Var
@ -10,7 +11,7 @@ class Badge(ChakraComponent):
tag = "Badge"
# Variant of the badge ("solid" | "subtle" | "outline")
variant: Var[LiteralVariant]
variant: Optional[Var[LiteralVariant]] = None
# The color of the badge
color_scheme: Var[str]
color_scheme: Optional[Var[str]] = None

View File

@ -1,5 +1,5 @@
"""A line to divide parts of the layout."""
from typing import Literal
from typing import Literal, Optional
from reflex.components.chakra import ChakraComponent, LiteralDividerVariant
from reflex.vars import Var
@ -13,7 +13,7 @@ class Divider(ChakraComponent):
tag = "Divider"
# Pass the orientation prop and set it to either horizontal or vertical. If the vertical orientation is used, make sure that the parent element is assigned a height.
orientation: Var[LiteralLayout]
orientation: Optional[Var[LiteralLayout]] = None
# Variant of the divider ("solid" | "dashed")
variant: Var[LiteralDividerVariant]
variant: Optional[Var[LiteralDividerVariant]] = None

View File

@ -1,12 +1,12 @@
"""List components."""
from __future__ import annotations
from typing import Generic, Optional, TypeVar
from reflex.components.chakra import ChakraComponent
from reflex.components.component import Component
from reflex.components.core.foreach import Foreach
from reflex.vars import Var
from typing import TypeVar, Generic
T = TypeVar("T")
@ -17,13 +17,13 @@ class List(ChakraComponent, Generic[T]):
tag = "List"
# The space between each list item
spacing: Var[str]
spacing: Optional[Var[str]] = None
# Shorthand prop for listStylePosition
style_position: Var[str]
style_position: Optional[Var[str]] = None
# Shorthand prop for listStyleType
style_type: Var[str]
style_type: Optional[Var[str]] = None
@classmethod
def create(

View File

@ -1,4 +1,5 @@
"""Statistics components."""
from typing import Optional
from reflex.components.chakra import ChakraComponent
from reflex.components.component import Component
@ -71,7 +72,7 @@ class StatArrow(ChakraComponent):
tag = "StatArrow"
# The type of arrow, either increase or decrease.
type_: Var[str]
type_: Optional[Var[str]] = None
class StatGroup(ChakraComponent):

View File

@ -1,5 +1,5 @@
"""Table components."""
from typing import List, Tuple
from typing import List, Optional, Tuple
from reflex.components.chakra import ChakraComponent
from reflex.components.component import Component
@ -14,16 +14,16 @@ class Table(ChakraComponent):
tag = "Table"
# The color scheme of the table
color_scheme: Var[str]
color_scheme: Optional[Var[str]] = None
# The variant of the table style to use
variant: Var[str]
variant: Optional[Var[str]] = None
# The size of the table
size: Var[str]
size: Optional[Var[str]] = None
# The placement of the table caption.
placement: Var[str]
placement: Optional[Var[str]] = None
@classmethod
def create(
@ -274,7 +274,7 @@ class Th(ChakraComponent):
_invalid_children: List[str] = ["Tbody", "Thead", "Tr", "Td", "Th"]
# Aligns the cell content to the right.
is_numeric: Var[bool]
is_numeric: Optional[Var[bool]] = None
class Td(ChakraComponent):
@ -286,7 +286,7 @@ class Td(ChakraComponent):
_invalid_children: List[str] = ["Tbody", "Thead"]
# Aligns the cell content to the right.
is_numeric: Var[bool]
is_numeric: Optional[Var[bool]] = None
class TableCaption(ChakraComponent):
@ -295,7 +295,7 @@ class TableCaption(ChakraComponent):
tag = "TableCaption"
# The placement of the table caption. This sets the `caption-side` CSS attribute.
placement: Var[str]
placement: Optional[Var[str]] = None
class TableContainer(ChakraComponent):

View File

@ -44,17 +44,17 @@ class Tag(ChakraComponent):
# options: "gray" | "red" | "orange" | "yellow" | "green" | "teal" | "blue" |
# "cyan" | "purple" | "pink"
# default: "gray"
color_scheme: Var[LiteralTagColorScheme]
color_scheme: Optional[Var[LiteralTagColorScheme]] = None
# The size of the tag
# options: "sm" | "md" | "lg"
# default: "md"
size: Var[LiteralTagSize]
size: Optional[Var[LiteralTagSize]] = None
# The variant of the tag
# options: "solid" | "subtle" | "outline"
# default: "solid"
variant: Var[LiteralVariant]
variant: Optional[Var[LiteralVariant]] = None
@classmethod
def create(

View File

@ -1,5 +1,4 @@
"""Container to stack elements with spacing."""
from typing import List, Optional, Union
from reflex.components.chakra import ChakraComponent
@ -13,19 +12,19 @@ class Accordion(ChakraComponent):
tag = "Accordion"
# If true, multiple accordion items can be expanded at once.
allow_multiple: Var[bool]
allow_multiple: Optional[Var[bool]] = None
# If true, any expanded accordion item can be collapsed again.
allow_toggle: Var[bool]
allow_toggle: Optional[Var[bool]] = None
# The initial index(es) of the expanded accordion item(s).
default_index: Var[Optional[List[int]]]
default_index: Optional[Var[Optional[List[int]]]] = None
# The index(es) of the expanded accordion item
index: Var[Union[int, List[int]]]
index: Optional[Var[Union[int, List[int]]]] = None
# If true, height animation and transitions will be disabled.
reduce_motion: Var[bool]
reduce_motion: Optional[Var[bool]] = None
@classmethod
def create(
@ -83,13 +82,13 @@ class AccordionItem(ChakraComponent):
tag = "AccordionItem"
# A unique id for the accordion item.
id_: Var[str]
id_: Optional[Var[str]] = None
# If true, the accordion item will be disabled.
is_disabled: Var[bool]
is_disabled: Optional[Var[bool]] = None
# If true, the accordion item will be focusable.
is_focusable: Var[bool]
is_focusable: Optional[Var[bool]] = None
class AccordionButton(ChakraComponent):

View File

@ -1,5 +1,4 @@
"""Tab components."""
from typing import List, Optional, Tuple
from reflex.components.chakra import (
@ -18,34 +17,34 @@ class Tabs(ChakraComponent):
tag = "Tabs"
# The alignment of the tabs ("center" | "end" | "start").
align: Var[LiteralTagAlign]
align: Optional[Var[LiteralTagAlign]] = None
# The initial index of the selected tab (in uncontrolled mode).
default_index: Var[int]
default_index: Optional[Var[int]] = None
# The id of the tab.
id_: Var[str]
id_: Optional[Var[str]] = None
# If true, tabs will stretch to width of the tablist.
is_fitted: Var[bool]
is_fitted: Optional[Var[bool]] = None
# Performance booster. If true, rendering of the tab panel's will be deferred until it is selected.
is_lazy: Var[bool]
is_lazy: Optional[Var[bool]] = None
# If true, the tabs will be manually activated and display its panel by pressing Space or Enter. If false, the tabs will be automatically activated and their panel is displayed when they receive focus.
is_manual: Var[bool]
is_manual: Optional[Var[bool]] = None
# The orientation of the tab list.
orientation: Var[str]
orientation: Optional[Var[str]] = None
# "line" | "enclosed" | "enclosed-colored" | "soft-rounded" | "solid-rounded" | "unstyled"
variant: Var[LiteralTabsVariant]
variant: Optional[Var[LiteralTabsVariant]] = None
# The color scheme of the tabs.
color_scheme: Var[LiteralColorScheme]
color_scheme: Optional[Var[LiteralColorScheme]] = None
# Index of the selected tab (in controlled mode).
index: Var[int]
index: Optional[Var[int]] = None
@classmethod
def create(
@ -79,16 +78,16 @@ class Tab(ChakraComponent):
tag = "Tab"
# If true, the Tab won't be toggleable.
is_disabled: Var[bool]
is_disabled: Optional[Var[bool]] = None
# If true, the Tab will be selected.
is_selected: Var[bool]
is_selected: Optional[Var[bool]] = None
# The id of the tab.
id_: Var[str]
id_: Optional[Var[str]] = None
# The id of the panel.
panel_id: Var[str]
panel_id: Optional[Var[str]] = None
_valid_parents: List[str] = ["TabList"]

View File

@ -1,5 +1,5 @@
"""A transition Component."""
from typing import Union
from typing import Optional, Union
from reflex.components.chakra import ChakraComponent
from reflex.vars import Var
@ -9,10 +9,10 @@ class Transition(ChakraComponent):
"""Base componemt of all transitions."""
# Show the component; triggers when enter or exit states
in_: Var[bool]
in_: Optional[Var[bool]] = None
# If true, the element will unmount when `in={false}` and animation is done
unmount_on_exit: Var[bool]
unmount_on_exit: Optional[Var[bool]] = None
class Fade(Transition):
@ -27,10 +27,10 @@ class ScaleFade(Transition):
tag = "ScaleFade"
# The initial scale of the element
initial_scale: Var[float]
initial_scale: Optional[Var[float]] = None
# If true, the element will transition back to exit state
reverse: Var[bool]
reverse: Optional[Var[bool]] = None
class Slide(Transition):
@ -39,7 +39,7 @@ class Slide(Transition):
tag = "Slide"
# The direction to slide from
direction: Var[str]
direction: Optional[Var[str]] = None
class SlideFade(Transition):
@ -48,13 +48,13 @@ class SlideFade(Transition):
tag = "SlideFade"
# The offset on the horizontal or x axis
offsetX: Var[Union[str, int]]
offsetX: Optional[Var[Union[str, int]]] = None
# The offset on the vertical or y axis
offsetY: Var[Union[str, int]]
offsetY: Optional[Var[Union[str, int]]] = None
# If true, the element will be transitioned back to the offset when it leaves. Otherwise, it'll only fade out
reverse: Var[bool]
reverse: Optional[Var[bool]] = None
class Collapse(Transition):
@ -63,10 +63,10 @@ class Collapse(Transition):
tag = "Collapse"
# If true, the opacity of the content will be animated
animateOpacity: Var[bool]
animateOpacity: Optional[Var[bool]] = None
# The height you want the content in its expanded state.
endingHeight: Var[str]
endingHeight: Optional[Var[str]] = None
# The height you want the content in its collapsed state.
startingHeight: Var[Union[str, int]]
startingHeight: Optional[Var[Union[str, int]]] = None

View File

@ -1,4 +1,5 @@
"""Alert components."""
from typing import Optional
from reflex.components.chakra import (
ChakraComponent,
@ -15,10 +16,10 @@ class Alert(ChakraComponent):
tag = "Alert"
# The status of the alert ("success" | "info" | "warning" | "error")
status: Var[LiteralStatus]
status: Optional[Var[LiteralStatus]] = None
# "subtle" | "left-accent" | "top-accent" | "solid"
variant: Var[LiteralAlertVariant]
variant: Optional[Var[LiteralAlertVariant]] = None
@classmethod
def create(

View File

@ -1,5 +1,5 @@
"""Container to stack elements with spacing."""
from typing import Union
from typing import Optional, Union
from reflex.components.chakra import ChakraComponent
from reflex.components.component import Component
@ -12,34 +12,34 @@ class CircularProgress(ChakraComponent):
tag = "CircularProgress"
# If true, the cap of the progress indicator will be rounded.
cap_is_round: Var[bool]
cap_is_round: Optional[Var[bool]] = None
# If true, the progress will be indeterminate and the value prop will be ignored
is_indeterminate: Var[bool]
is_indeterminate: Optional[Var[bool]] = None
# Maximum value defining 100% progress made (must be higher than 'min')
max_: Var[int]
max_: Optional[Var[int]] = None
# Minimum value defining 'no progress' (must be lower than 'max')
min_: Var[int]
min_: Optional[Var[int]] = None
# This defines the stroke width of the svg circle.
thickness: Var[Union[str, int]]
thickness: Optional[Var[Union[str, int]]] = None
# The color name of the progress track. Use a color key in the theme object
track_color: Var[str]
track_color: Optional[Var[str]] = None
# Current progress (must be between min/max).
value: Var[int]
value: Optional[Var[int]] = None
# The desired valueText to use in place of the value.
value_text: Var[str]
value_text: Optional[Var[str]] = None
# The color name of the progress bar
color: Var[str]
color: Optional[Var[str]] = None
# The size of the circular progress
size: Var[str]
size: Optional[Var[str]] = None
@classmethod
def create(cls, *children, label=None, **props) -> Component:

View File

@ -1,6 +1,5 @@
"""Container to stack elements with spacing."""
from typing import Union
from typing import Optional, Union
from reflex.components.chakra import ChakraComponent
from reflex.vars import Var
@ -12,22 +11,22 @@ class Progress(ChakraComponent):
tag = "Progress"
# If true, the progress bar will show stripe
has_stripe: Var[bool]
has_stripe: Optional[Var[bool]] = None
# If true, and has_stripe is true, the stripes will be animated
is_animated: Var[bool]
is_animated: Optional[Var[bool]] = None
# If true, the progress will be indeterminate and the value prop will be ignored
is_indeterminate: Var[bool]
is_indeterminate: Optional[Var[bool]] = None
# The maximum value of the progress
max_: Var[int]
max_: Optional[Var[int]] = None
# The minimum value of the progress
min_: Var[int]
min_: Optional[Var[int]] = None
# The value of the progress indicator. If undefined the progress bar will be in indeterminate state
value: Var[Union[int, float]]
value: Optional[Var[Union[int, float]]] = None
# The color scheme of the progress bar.
color_scheme: Var[str]
color_scheme: Optional[Var[str]] = None

View File

@ -1,4 +1,5 @@
"""Container to stack elements with spacing."""
from typing import Optional
from reflex.components.chakra import ChakraComponent
from reflex.vars import Var
@ -10,19 +11,19 @@ class Skeleton(ChakraComponent):
tag = "Skeleton"
# The color at the animation end
end_color: Var[str]
end_color: Optional[Var[str]] = None
# The fadeIn duration in seconds
fade_duration: Var[float]
fade_duration: Optional[Var[float]] = None
# If true, it'll render its children with a nice fade transition
is_loaded: Var[bool]
is_loaded: Optional[Var[bool]] = None
# The animation speed in seconds
speed: Var[float]
speed: Optional[Var[float]] = None
# The color at the animation start
start_color: Var[str]
start_color: Optional[Var[str]] = None
class SkeletonCircle(ChakraComponent):
@ -31,19 +32,19 @@ class SkeletonCircle(ChakraComponent):
tag = "SkeletonCircle"
# The color at the animation end
end_color: Var[str]
end_color: Optional[Var[str]] = None
# The fadeIn duration in seconds
fade_duration: Var[float]
fade_duration: Optional[Var[float]] = None
# If true, it'll render its children with a nice fade transition
is_loaded: Var[bool]
is_loaded: Optional[Var[bool]] = None
# The animation speed in seconds
speed: Var[float]
speed: Optional[Var[float]] = None
# The color at the animation start
start_color: Var[str]
start_color: Optional[Var[str]] = None
class SkeletonText(ChakraComponent):
@ -52,19 +53,19 @@ class SkeletonText(ChakraComponent):
tag = "SkeletonText"
# The color at the animation end
end_color: Var[str]
end_color: Optional[Var[str]] = None
# The fadeIn duration in seconds
fade_duration: Var[float]
fade_duration: Optional[Var[float]] = None
# If true, it'll render its children with a nice fade transition
is_loaded: Var[bool]
is_loaded: Optional[Var[bool]] = None
# The animation speed in seconds
speed: Var[float]
speed: Optional[Var[float]] = None
# The color at the animation start
start_color: Var[str]
start_color: Optional[Var[str]] = None
# Number is lines of text.
no_of_lines: Var[int]
no_of_lines: Optional[Var[int]] = None

View File

@ -1,4 +1,5 @@
"""Container to stack elements with spacing."""
from typing import Optional
from reflex.components.chakra import ChakraComponent, LiteralSpinnerSize
from reflex.vars import Var
@ -10,16 +11,16 @@ class Spinner(ChakraComponent):
tag = "Spinner"
# The color of the empty area in the spinner
empty_color: Var[str]
empty_color: Optional[Var[str]] = None
# For accessibility, it is important to add a fallback loading text. This text will be visible to screen readers.
label: Var[str]
label: Optional[Var[str]] = None
# The speed of the spinner must be as a string and in seconds '1s'. Default is '0.45s'.
speed: Var[str]
speed: Optional[Var[str]] = None
# The thickness of the spinner.
thickness: Var[int]
thickness: Optional[Var[int]] = None
# "xs" | "sm" | "md" | "lg" | "xl"
size: Var[LiteralSpinnerSize]
size: Optional[Var[LiteralSpinnerSize]] = None

View File

@ -1,5 +1,5 @@
"""A button component."""
from typing import List
from typing import List, Optional
from reflex.components.chakra import (
ChakraComponent,
@ -17,48 +17,48 @@ class Button(ChakraComponent):
tag = "Button"
# The space between the button icon and label.
icon_spacing: Var[int]
icon_spacing: Optional[Var[int]] = None
# If true, the button will be styled in its active state.
is_active: Var[bool]
is_active: Optional[Var[bool]] = None
# If true, the button will be styled in its disabled state.
is_disabled: Var[bool]
is_disabled: Optional[Var[bool]] = None
# If true, the button will take up the full width of its container.
is_full_width: Var[bool]
is_full_width: Optional[Var[bool]] = None
# If true, the button will show a spinner.
is_loading: Var[bool]
is_loading: Optional[Var[bool]] = None
# The label to show in the button when isLoading is true If no text is passed, it only shows the spinner.
loading_text: Var[str]
loading_text: Optional[Var[str]] = None
# "lg" | "md" | "sm" | "xs"
size: Var[LiteralButtonSize]
size: Optional[Var[LiteralButtonSize]] = None
# "ghost" | "outline" | "solid" | "link" | "unstyled"
variant: Var[LiteralButtonVariant]
variant: Optional[Var[LiteralButtonVariant]] = None
# Built in color scheme for ease of use.
# Options:
# "whiteAlpha" | "blackAlpha" | "gray" | "red" | "orange" | "yellow" | "green" | "teal" | "blue" | "cyan"
# | "purple" | "pink" | "linkedin" | "facebook" | "messenger" | "whatsapp" | "twitter" | "telegram"
color_scheme: Var[LiteralColorScheme]
color_scheme: Optional[Var[LiteralColorScheme]] = None
# Position of the loading spinner.
# Options:
# "start" | "end"
spinner_placement: Var[LiteralSpinnerPlacement]
spinner_placement: Optional[Var[LiteralSpinnerPlacement]] = None
# The type of button.
type_: Var[str]
type_: Optional[Var[str]] = None
# Components that are not allowed as children.
_invalid_children: List[str] = ["Button", "MenuButton"]
# The name of the form field
name: Var[str]
name: Optional[Var[str]] = None
class ButtonGroup(ChakraComponent):
@ -67,16 +67,16 @@ class ButtonGroup(ChakraComponent):
tag = "ButtonGroup"
# If true, the borderRadius of button that are direct children will be altered to look flushed together.
is_attached: Var[bool]
is_attached: Optional[Var[bool]] = None
# If true, all wrapped button will be disabled.
is_disabled: Var[bool]
is_disabled: Optional[Var[bool]] = None
# The spacing between the buttons.
spacing: Var[int]
spacing: Optional[Var[int]] = None
# "lg" | "md" | "sm" | "xs"
size: Var[LiteralButtonSize]
size: Optional[Var[LiteralButtonSize]] = None
# "ghost" | "outline" | "solid" | "link" | "unstyled"
variant: Var[LiteralButtonVariant]
variant: Optional[Var[LiteralButtonVariant]] = None

View File

@ -1,7 +1,7 @@
"""A checkbox component."""
from __future__ import annotations
from typing import Any, Union
from typing import Any, Optional, Union
from reflex.components.chakra import (
ChakraComponent,
@ -21,40 +21,40 @@ class Checkbox(ChakraComponent):
# Options:
# "whiteAlpha" | "blackAlpha" | "gray" | "red" | "orange" | "yellow" | "green" | "teal" | "blue" | "cyan"
# | "purple" | "pink" | "linkedin" | "facebook" | "messenger" | "whatsapp" | "twitter" | "telegram"
color_scheme: Var[LiteralColorScheme]
color_scheme: Optional[Var[LiteralColorScheme]] = None
# "sm" | "md" | "lg"
size: Var[LiteralTagSize]
size: Optional[Var[LiteralTagSize]] = None
# If true, the checkbox will be checked.
is_checked: Var[bool]
is_checked: Optional[Var[bool]] = None
# If true, the checkbox will be disabled
is_disabled: Var[bool]
is_disabled: Optional[Var[bool]] = None
# If true and is_disabled is passed, the checkbox will remain tabbable but not interactive
is_focusable: Var[bool]
is_focusable: Optional[Var[bool]] = None
# If true, the checkbox will be indeterminate. This only affects the icon shown inside checkbox and does not modify the is_checked var.
is_indeterminate: Var[bool]
is_indeterminate: Optional[Var[bool]] = None
# If true, the checkbox is marked as invalid. Changes style of unchecked state.
is_invalid: Var[bool]
is_invalid: Optional[Var[bool]] = None
# If true, the checkbox will be readonly
is_read_only: Var[bool]
is_read_only: Optional[Var[bool]] = None
# If true, the checkbox input is marked as required, and required attribute will be added
is_required: Var[bool]
is_required: Optional[Var[bool]] = None
# The name of the input field in a checkbox (Useful for form submission).
name: Var[str]
name: Optional[Var[str]] = None
# The value of the input field when checked (use is_checked prop for a bool)
value: Var[str] = Var.create("true") # type: ignore
# The spacing between the checkbox and its label text (0.5rem)
spacing: Var[str]
spacing: Optional[Var[str]] = None
def get_event_triggers(self) -> dict[str, Union[Var, Any]]:
"""Get the event triggers that pass the component's value to the handler.
@ -74,13 +74,13 @@ class CheckboxGroup(ChakraComponent):
tag = "CheckboxGroup"
# The value of the checkbox group
value: Var[str]
value: Optional[Var[str]] = None
# The initial value of the checkbox group
default_value: Var[str]
default_value: Optional[Var[str]] = None
# If true, all wrapped checkbox inputs will be disabled
is_disabled: Var[bool]
is_disabled: Optional[Var[bool]] = None
# If true, input elements will receive checked attribute instead of isChecked. This assumes, you're using native radio inputs
is_native: Var[bool]
is_native: Optional[Var[bool]] = None

View File

@ -1,7 +1,7 @@
"""An editable component."""
from __future__ import annotations
from typing import Any, Union
from typing import Any, Optional, Union
from reflex.components.chakra import ChakraComponent
from reflex.constants import EventTriggers
@ -14,28 +14,28 @@ class Editable(ChakraComponent):
tag = "Editable"
# If true, the Editable will be disabled.
is_disabled: Var[bool]
is_disabled: Optional[Var[bool]] = None
# If true, the read only view, has a tabIndex set to 0 so it can receive focus via the keyboard or click.
is_preview_focusable: Var[bool]
is_preview_focusable: Optional[Var[bool]] = None
# The placeholder text when the value is empty.
placeholder: Var[str]
placeholder: Optional[Var[str]] = None
# If true, the input's text will be highlighted on focus.
select_all_on_focus: Var[bool]
select_all_on_focus: Optional[Var[bool]] = None
# If true, the Editable will start with edit mode by default.
start_with_edit_view: Var[bool]
start_with_edit_view: Optional[Var[bool]] = None
# If true, it'll update the value onBlur and turn off the edit mode.
submit_on_blur: Var[bool]
submit_on_blur: Optional[Var[bool]] = None
# The value of the Editable in both edit & preview mode
value: Var[str]
value: Optional[Var[str]] = None
# The initial value of the Editable in both edit and preview mode.
default_value: Var[str]
default_value: Optional[Var[str]] = None
def get_event_triggers(self) -> dict[str, Union[Var, Any]]:
"""Get the event triggers that pass the component's value to the handler.

View File

@ -2,7 +2,7 @@
from __future__ import annotations
from hashlib import md5
from typing import Any, Dict, Iterator
from typing import Any, Dict, Iterator, Optional
from jinja2 import Environment
@ -45,7 +45,7 @@ class Form(ChakraComponent):
reset_on_submit: Var[bool] = False # type: ignore
# The name used to make this form's submit handler function unique
handle_submit_unique_name: Var[str]
handle_submit_unique_name: Optional[Var[str]] = None
@classmethod
def create(cls, *children, **props) -> Component:
@ -154,19 +154,19 @@ class FormControl(ChakraComponent):
tag = "FormControl"
# If true, the form control will be disabled.
is_disabled: Var[bool]
is_disabled: Optional[Var[bool]] = None
# If true, the form control will be invalid.
is_invalid: Var[bool]
is_invalid: Optional[Var[bool]] = None
# If true, the form control will be readonly
is_read_only: Var[bool]
is_read_only: Optional[Var[bool]] = None
# If true, the form control will be required.
is_required: Var[bool]
is_required: Optional[Var[bool]] = None
# The label text used to inform users as to what information is requested for a text field.
label: Var[str]
label: Optional[Var[str]] = None
@classmethod
def create(
@ -225,7 +225,7 @@ class FormLabel(ChakraComponent):
tag = "FormLabel"
# Link
html_for: Var[str]
html_for: Optional[Var[str]] = None
class FormErrorMessage(ChakraComponent):

View File

@ -1,5 +1,4 @@
"""An icon button component."""
from typing import Optional
from reflex.components.chakra.typography.text import Text
@ -14,25 +13,25 @@ class IconButton(Text):
library = "@chakra-ui/button@2.1.0"
# The type of button.
type: Var[str]
type: Optional[Var[str]] = None
# A label that describes the button
aria_label: Var[str]
aria_label: Optional[Var[str]] = None
# The icon to be used in the button.
icon: Optional[Component]
# If true, the button will be styled in its active state.
is_active: Var[bool]
is_active: Optional[Var[bool]] = None
# If true, the button will be disabled.
is_disabled: Var[bool]
is_disabled: Optional[Var[bool]] = None
# If true, the button will show a spinner.
is_loading: Var[bool]
is_loading: Optional[Var[bool]] = None
# If true, the button will be perfectly round. Else, it'll be slightly round
is_round: Var[bool]
is_round: Optional[Var[bool]] = None
# Replace the spinner component when isLoading is set to true
spinner: Var[str]
spinner: Optional[Var[str]] = None

View File

@ -1,6 +1,5 @@
"""An input component."""
from typing import Any, Dict
from typing import Any, Dict, Optional
from reflex.components.chakra import (
ChakraComponent,
@ -21,43 +20,43 @@ class Input(ChakraComponent):
tag = "Input"
# State var to bind the input.
value: Var[str]
value: Optional[Var[str]] = None
# The default value of the input.
default_value: Var[str]
default_value: Optional[Var[str]] = None
# The placeholder text.
placeholder: Var[str]
placeholder: Optional[Var[str]] = None
# The type of input.
type_: Var[LiteralInputType]
type_: Optional[Var[LiteralInputType]] = None
# The border color when the input is invalid.
error_border_color: Var[str]
error_border_color: Optional[Var[str]] = None
# The border color when the input is focused.
focus_border_color: Var[str]
focus_border_color: Optional[Var[str]] = None
# If true, the form control will be disabled. This has 2 side effects - The FormLabel will have `data-disabled` attribute - The form element (e.g, Input) will be disabled
is_disabled: Var[bool]
is_disabled: Optional[Var[bool]] = None
# If true, the form control will be invalid. This has 2 side effects - The FormLabel and FormErrorIcon will have `data-invalid` set to true - The form element (e.g, Input) will have `aria-invalid` set to true
is_invalid: Var[bool]
is_invalid: Optional[Var[bool]] = None
# If true, the form control will be readonly.
is_read_only: Var[bool]
is_read_only: Optional[Var[bool]] = None
# If true, the form control will be required. This has 2 side effects - The FormLabel will show a required indicator - The form element (e.g, Input) will have `aria-required` set to true
is_required: Var[bool]
is_required: Optional[Var[bool]] = None
# "outline" | "filled" | "flushed" | "unstyled"
variant: Var[LiteralInputVariant]
variant: Optional[Var[LiteralInputVariant]] = None
# "lg" | "md" | "sm" | "xs"
size: Var[LiteralButtonSize]
size: Optional[Var[LiteralButtonSize]] = None
# The name of the form field
name: Var[str]
name: Optional[Var[str]] = None
def _get_imports(self) -> imports.ImportDict:
return imports.merge_imports(

View File

@ -51,19 +51,19 @@ class Select(Component):
alias = "MultiSelect"
# Focus the control when it is mounted
auto_focus: Var[bool]
auto_focus: Optional[Var[bool]] = None
# Remove the currently focused option when the user presses backspace
# when Select isClearable or isMulti
backspace_removes_value: Var[bool]
backspace_removes_value: Optional[Var[bool]] = None
# Remove focus from the input when the user selects an option
# (handy for dismissing the keyboard on touch devices)
blur_input_on_select: Var[bool]
blur_input_on_select: Optional[Var[bool]] = None
# When the user reaches the top/bottom of the menu,
# prevent scroll on the scroll-parent
capture_menu_scroll: Var[bool]
capture_menu_scroll: Optional[Var[bool]] = None
# [chakra]
# To use the chakraStyles prop, first,
@ -101,13 +101,13 @@ class Select(Component):
# - placeholder - Box
# - singleValue - Box
# - valueContainer - Box
chakra_styles: Var[str]
chakra_styles: Optional[Var[str]] = None
# Close the select menu when the user selects an option
close_menu_on_select: Var[bool]
close_menu_on_select: Optional[Var[bool]] = None
# If true, close the select menu when the user scrolls the document/body.
close_menu_on_scroll: Var[bool]
close_menu_on_scroll: Optional[Var[bool]] = None
# [chakra]
# The visual color appearance of the component
@ -116,117 +116,117 @@ class Select(Component):
# "purple" | "pink" | "linkedin" | "facebook" | "messenger" |
# "whatsapp" | "twitter" | "telegram"
# default: "gray"
color_scheme: Var[str]
color_scheme: Optional[Var[str]] = None
# This complex object includes all the compositional components
# that are used in react-select. If you wish to overwrite a component,
# pass in an object with the appropriate namespace.
# If you only wish to restyle a component,
# we recommend using the styles prop instead.
components: Var[Dict[str, Component]]
components: Optional[Var[Dict[str, Component]]] = None
# Whether the value of the select, e.g. SingleValue,
# should be displayed in the control.
control_should_render_value: Var[bool]
control_should_render_value: Optional[Var[bool]] = None
# Delimiter used to join multiple values into a single HTML Input value
delimiter: Var[str]
delimiter: Optional[Var[str]] = None
# [chakra]
# Colors the component border with the given chakra color string on error state
# default: "red.500"
error_border_color: Var[str]
error_border_color: Optional[Var[str]] = None
# Clear all values when the user presses escape AND the menu is closed
escape_clears_value: Var[bool]
escape_clears_value: Optional[Var[bool]] = None
# [chakra]
# Colors the component border with the given chakra color string on focus
# default: "blue.500"
focus_border_color: Var[str]
focus_border_color: Optional[Var[str]] = None
# Sets the form attribute on the input
form: Var[str]
form: Optional[Var[str]] = None
# Hide the selected option from the menu
hide_selected_options: Var[bool]
hide_selected_options: Optional[Var[bool]] = None
# The id to set on the SelectContainer component.
# id: Var[str]
# id: Optional[Var[str]] = None
# The value of the search input
input_value: Var[str]
input_value: Optional[Var[str]] = None
# The id of the search input
input_id: Var[str]
input_id: Optional[Var[str]] = None
# Is the select value clearable
is_clearable: Var[bool]
is_clearable: Optional[Var[bool]] = None
# Is the select disabled
is_disabled: Var[bool]
is_disabled: Optional[Var[bool]] = None
# [chakra]
# Style component in the chakra invalid style
# default: False
is_invalid: Var[bool]
is_invalid: Optional[Var[bool]] = None
# Support multiple selected options
is_multi: Var[bool]
is_multi: Optional[Var[bool]] = None
# [chakra]
# Style component as disabled (chakra style)
# default: False
is_read_only: Var[bool]
is_read_only: Optional[Var[bool]] = None
# Is the select direction right-to-left
is_rtl: Var[bool]
is_rtl: Optional[Var[bool]] = None
# Whether to enable search functionality
is_searchable: Var[bool]
is_searchable: Optional[Var[bool]] = None
# Minimum height of the menu before flipping
min_menu_height: Var[int]
min_menu_height: Optional[Var[int]] = None
# Maximum height of the menu before scrolling
max_menu_height: Var[int]
max_menu_height: Optional[Var[int]] = None
# Default placement of the menu in relation to the control.
# 'auto' will flip when there isn't enough space below the control.
# options: "bottom" | "auto" | "top"
menu_placement: Var[str]
menu_placement: Optional[Var[str]] = None
# The CSS position value of the menu,
# when "fixed" extra layout management is required
# options: "absolute" | "fixed"
menu_position: Var[str]
menu_position: Optional[Var[str]] = None
# Whether to block scroll events when the menu is open
menu_should_block_scroll: Var[bool]
menu_should_block_scroll: Optional[Var[bool]] = None
# Whether the menu should be scrolled into view when it opens
menu_should_scroll_into_view: Var[bool]
menu_should_scroll_into_view: Optional[Var[bool]] = None
# Name of the HTML Input (optional - without this, no input will be rendered)
name: Var[str]
name: Optional[Var[str]] = None
# Allows control of whether the menu is opened when the Select is focused
open_menu_on_focus: Var[bool]
open_menu_on_focus: Optional[Var[bool]] = None
# Allows control of whether the menu is opened when the Select is clicked
open_menu_on_click: Var[bool]
open_menu_on_click: Optional[Var[bool]] = None
# Array of options that populate the select menu
options: Var[List[Dict]]
options: Optional[Var[List[Dict]]] = None
# Number of options to jump in menu when page{up|down} keys are used
page_size: Var[int]
page_size: Optional[Var[int]] = None
# Placeholder for the select value
placeholder: Var[Optional[str]]
placeholder: Optional[Var[Optional[str]]] = None
# Marks the value-holding input as required for form validation
required: Var[bool]
required: Optional[Var[bool]] = None
# [chakra]
# If you choose to stick with the default selectedOptionStyle="color",
@ -239,7 +239,7 @@ class Select(Component):
# If you would like to use a specific color for the background that's not a part of your theme,
# use the chakraStyles prop to customize it.
# default: "blue"
selected_option_color_scheme: Var[str]
selected_option_color_scheme: Optional[Var[str]] = None
# [chakra]
# The default option "color" will style a selected option
@ -253,28 +253,28 @@ class Select(Component):
# if hide_selected_options=False is also passed.
# options: "color" | "check"
# default: "color"
selected_option_style: Var[str]
selected_option_style: Optional[Var[str]] = None
# [chakra]
# The size of the component.
# options: "sm" | "md" | "lg"
# default: "md"
size: Var[str]
size: Optional[Var[str]] = None
# Sets the tabIndex attribute on the input
tab_index: Var[int]
tab_index: Optional[Var[int]] = None
# Select the currently focused option when the user presses tab
tab_selects_value: Var[bool]
tab_selects_value: Optional[Var[bool]] = None
# [chakra]
# Variant of multi-select tags
# options: "subtle" | "solid" | "outline"
# default: "subtle"
tag_variant: Var[str]
tag_variant: Optional[Var[str]] = None
# Remove all non-essential styles
unstyled: Var[bool]
unstyled: Optional[Var[bool]] = None
# [chakra]
# If this prop is passed,
@ -287,7 +287,7 @@ class Select(Component):
# However, as this button only appears when isMulti is passed,
# using this style could make more sense for a single select.
# default: False
use_basic_style: Var[bool]
use_basic_style: Optional[Var[bool]] = None
# [chakra]
# The variant of the Select. If no variant is passed,
@ -295,7 +295,7 @@ class Select(Component):
# If your component theme for Input is not modified, it will be outline.
# options: "outline" | "filled" | "flushed" | "unstyled"
# default: "outline"
variant: Var[str]
variant: Optional[Var[str]] = None
# How the options should be displayed in the menu.
menu_position: Var[str] = "fixed" # type: ignore

View File

@ -1,7 +1,6 @@
"""A number input component."""
from numbers import Number
from typing import Any, Dict
from typing import Any, Dict, Optional
from reflex.components.chakra import (
ChakraComponent,
@ -19,61 +18,61 @@ class NumberInput(ChakraComponent):
tag = "NumberInput"
# State var to bind the input.
value: Var[Number]
value: Optional[Var[Number]] = None
# If true, the input's value will change based on mouse wheel.
allow_mouse_wheel: Var[bool]
allow_mouse_wheel: Optional[Var[bool]] = None
# This controls the value update when you blur out of the input. - If true and the value is greater than max, the value will be reset to max - Else, the value remains the same.
clamped_value_on_blur: Var[bool]
clamped_value_on_blur: Optional[Var[bool]] = None
# The initial value of the counter. Should be less than max and greater than min
default_value: Var[Number]
default_value: Optional[Var[Number]] = None
# The border color when the input is invalid.
error_border_color: Var[str]
error_border_color: Optional[Var[str]] = None
# The border color when the input is focused.
focus_border_color: Var[str]
focus_border_color: Optional[Var[str]] = None
# If true, the input will be focused as you increment or decrement the value with the stepper
focus_input_on_change: Var[bool]
focus_input_on_change: Optional[Var[bool]] = None
# Hints at the type of data that might be entered by the user. It also determines the type of keyboard shown to the user on mobile devices ("text" | "search" | "none" | "tel" | "url" | "email" | "numeric" | "decimal")
# input_mode: Var[LiteralInputNumberMode]
# input_mode: Optional[Var[LiteralInputNumberMode]] = None
# Whether the input should be disabled.
is_disabled: Var[bool]
is_disabled: Optional[Var[bool]] = None
# If true, the input will have `aria-invalid` set to true
is_invalid: Var[bool]
is_invalid: Optional[Var[bool]] = None
# If true, the input will be in readonly mode
is_read_only: Var[bool]
is_read_only: Optional[Var[bool]] = None
# Whether the input is required
is_required: Var[bool]
is_required: Optional[Var[bool]] = None
# Whether the pressed key should be allowed in the input. The default behavior is to allow DOM floating point characters defined by /^[Ee0-9+\-.]$/
is_valid_character: Var[str]
is_valid_character: Optional[Var[str]] = None
# This controls the value update behavior in general. - If true and you use the stepper or up/down arrow keys, the value will not exceed the max or go lower than min - If false, the value will be allowed to go out of range.
keep_within_range: Var[bool]
keep_within_range: Optional[Var[bool]] = None
# The maximum value of the counter
max_: Var[Number]
max_: Optional[Var[Number]] = None
# The minimum value of the counter
min_: Var[Number]
min_: Optional[Var[Number]] = None
# "outline" | "filled" | "flushed" | "unstyled"
variant: Var[LiteralInputVariant]
variant: Optional[Var[LiteralInputVariant]] = None
# "lg" | "md" | "sm" | "xs"
size: Var[LiteralButtonSize]
size: Optional[Var[LiteralButtonSize]] = None
# The name of the form field
name: Var[str]
name: Optional[Var[str]] = None
def get_event_triggers(self) -> Dict[str, Any]:
"""Get the event triggers that pass the component's value to the handler.

View File

@ -18,49 +18,49 @@ class PinInput(ChakraComponent):
tag = "PinInput"
# State var to bind the the input.
value: Var[str]
value: Optional[Var[str]] = None
# If true, the pin input receives focus on mount
auto_focus: Var[bool]
auto_focus: Optional[Var[bool]] = None
# The default value of the pin input
default_value: Var[str]
default_value: Optional[Var[str]] = None
# The border color when the input is invalid.
error_border_color: Var[str]
error_border_color: Optional[Var[str]] = None
# The border color when the input is focused.
focus_border_color: Var[str]
focus_border_color: Optional[Var[str]] = None
# The top-level id string that will be applied to the input fields. The index of the input will be appended to this top-level id.
id_: Var[str]
id_: Optional[Var[str]] = None
# The length of the number input.
length: Var[int]
length: Optional[Var[int]] = None
# If true, the pin input component is put in the disabled state
is_disabled: Var[bool]
is_disabled: Optional[Var[bool]] = None
# If true, the pin input component is put in the invalid state
is_invalid: Var[bool]
is_invalid: Optional[Var[bool]] = None
# If true, focus will move automatically to the next input once filled
manage_focus: Var[bool]
manage_focus: Optional[Var[bool]] = None
# If true, the input's value will be masked just like `type=password`
mask: Var[bool]
mask: Optional[Var[bool]] = None
# The placeholder for the pin input
placeholder: Var[str]
placeholder: Optional[Var[str]] = None
# The type of values the pin-input should allow ("number" | "alphanumeric").
type_: Var[str]
type_: Optional[Var[str]] = None
# "outline" | "flushed" | "filled" | "unstyled"
variant: Var[LiteralInputVariant]
variant: Optional[Var[LiteralInputVariant]] = None
# The name of the form field
name: Var[str]
name: Optional[Var[str]] = None
def _get_imports(self) -> ImportDict:
"""Include PinInputField explicitly because it may not be a child component at compile time.
@ -171,7 +171,7 @@ class PinInputField(ChakraComponent):
index: Optional[Var[int]] = None
# The name of the form field
name: Var[str]
name: Optional[Var[str]] = None
@classmethod
def for_length(cls, length: Var | int, **props) -> Var:

View File

@ -1,7 +1,5 @@
"""A radio component."""
from typing import Any, Dict, List, Union
from typing import Any, Dict, List, Optional, Union
from reflex.components.chakra import ChakraComponent
from reflex.components.chakra.typography.text import Text
@ -18,13 +16,13 @@ class RadioGroup(ChakraComponent):
tag = "RadioGroup"
# State var to bind the the input.
value: Var[Any]
value: Optional[Var[Any]] = None
# The default value.
default_value: Var[Any]
default_value: Optional[Var[Any]] = None
# The name of the form field
name: Var[str]
name: Optional[Var[str]] = None
def get_event_triggers(self) -> Dict[str, Union[Var, Any]]:
"""Get the event triggers that pass the component's value to the handler.
@ -65,31 +63,31 @@ class Radio(Text):
tag = "Radio"
# Value of radio.
value: Var[Any]
value: Optional[Var[Any]] = None
# The default value.
default_value: Var[Any]
default_value: Optional[Var[Any]] = None
# The color scheme.
color_scheme: Var[str]
color_scheme: Optional[Var[str]] = None
# If true, the radio will be initially checked.
default_checked: Var[bool]
default_checked: Optional[Var[bool]] = None
# If true, the radio will be checked. You'll need to pass onChange to update its value (since it is now controlled)
is_checked: Var[bool]
is_checked: Optional[Var[bool]] = None
# If true, the radio will be disabled.
is_disabled: Var[bool]
is_disabled: Optional[Var[bool]] = None
# If true, the radio button will be invalid. This also sets `aria-invalid` to true.
is_invalid: Var[bool]
is_invalid: Optional[Var[bool]] = None
# If true, the radio will be read-only
is_read_only: Var[bool]
is_read_only: Optional[Var[bool]] = None
# If true, the radio button will be required. This also sets `aria-required` to true.
is_required: Var[bool]
is_required: Optional[Var[bool]] = None
@classmethod
def create(cls, *children, **props) -> Component:

View File

@ -16,37 +16,37 @@ class RangeSlider(ChakraComponent):
tag = "RangeSlider"
# State var to bind the the input.
value: Var[List[int]]
value: Optional[Var[List[int]]] = None
# The default values.
default_value: Var[List[int]]
default_value: Optional[Var[List[int]]] = None
# The writing mode ("ltr" | "rtl")
direction: Var[LiteralChakraDirection]
direction: Optional[Var[LiteralChakraDirection]] = None
# If false, the slider handle will not capture focus when value changes.
focus_thumb_on_change: Var[bool]
focus_thumb_on_change: Optional[Var[bool]] = None
# If true, the slider will be disabled
is_disabled: Var[bool]
is_disabled: Optional[Var[bool]] = None
# If true, the slider will be in `read-only` state.
is_read_only: Var[bool]
is_read_only: Optional[Var[bool]] = None
# If true, the value will be incremented or decremented in reverse.
is_reversed: Var[bool]
is_reversed: Optional[Var[bool]] = None
# The minimum value of the slider.
min_: Var[int]
min_: Optional[Var[int]] = None
# The maximum value of the slider.
max_: Var[int]
max_: Optional[Var[int]] = None
# The minimum distance between slider thumbs. Useful for preventing the thumbs from being too close together.
min_steps_between_thumbs: Var[int]
min_steps_between_thumbs: Optional[Var[int]] = None
# The name of the form field
name: Var[str]
name: Optional[Var[str]] = None
def get_event_triggers(self) -> dict[str, Union[Var, Any]]:
"""Get the event triggers that pass the component's value to the handler.
@ -136,7 +136,7 @@ class RangeSliderThumb(ChakraComponent):
tag = "RangeSliderThumb"
# The position of the thumb.
index: Var[int]
index: Optional[Var[int]] = None
def _get_ref_hook(self) -> Optional[str]:
# hook is None because RangeSlider is handling it.

View File

@ -1,6 +1,5 @@
"""A select component."""
from typing import Any, Dict, List, Union
from typing import Any, Dict, List, Optional, Union
from reflex.components.chakra import ChakraComponent, LiteralInputVariant
from reflex.components.chakra.typography.text import Text
@ -17,37 +16,37 @@ class Select(ChakraComponent):
tag = "Select"
# State var to bind the select.
value: Var[str]
value: Optional[Var[str]] = None
# The default value of the select.
default_value: Var[str]
default_value: Optional[Var[str]] = None
# The placeholder text.
placeholder: Var[str]
placeholder: Optional[Var[str]] = None
# The border color when the select is invalid.
error_border_color: Var[str]
error_border_color: Optional[Var[str]] = None
# The border color when the select is focused.
focus_border_color: Var[str]
focus_border_color: Optional[Var[str]] = None
# If true, the select will be disabled.
is_disabled: Var[bool]
is_disabled: Optional[Var[bool]] = None
# If true, the form control will be invalid. This has 2 side effects: - The FormLabel and FormErrorIcon will have `data-invalid` set to true - The form element (e.g, Input) will have `aria-invalid` set to true
is_invalid: Var[bool]
is_invalid: Optional[Var[bool]] = None
# If true, the form control will be required. This has 2 side effects: - The FormLabel will show a required indicator - The form element (e.g, Input) will have `aria-required` set to true
is_required: Var[bool]
is_required: Optional[Var[bool]] = None
# "outline" | "filled" | "flushed" | "unstyled"
variant: Var[LiteralInputVariant]
variant: Optional[Var[LiteralInputVariant]] = None
# The size of the select.
size: Var[str]
size: Optional[Var[str]] = None
# The name of the form field
name: Var[str]
name: Optional[Var[str]] = None
def get_event_triggers(self) -> Dict[str, Union[Var, Any]]:
"""Get the event triggers that pass the component's value to the handler.
@ -90,7 +89,7 @@ class Option(Text):
tag = "option"
value: Var[Any]
value: Optional[Var[Any]] = None
@classmethod
def create(cls, *children, **props) -> Component:

View File

@ -1,7 +1,7 @@
"""A slider component."""
from __future__ import annotations
from typing import Any, Literal, Union
from typing import Any, Literal, Optional, Union
from reflex.components.chakra import ChakraComponent, LiteralChakraDirection
from reflex.components.component import Component
@ -17,58 +17,58 @@ class Slider(ChakraComponent):
tag = "Slider"
# State var to bind the input.
value: Var[int]
value: Optional[Var[int]] = None
# The color scheme.
color_scheme: Var[str]
color_scheme: Optional[Var[str]] = None
# The placeholder text.
default_value: Var[int]
default_value: Optional[Var[int]] = None
# The writing mode ("ltr" | "rtl")
direction: Var[LiteralChakraDirection]
direction: Optional[Var[LiteralChakraDirection]] = None
# If false, the slider handle will not capture focus when value changes.
focus_thumb_on_change: Var[bool]
focus_thumb_on_change: Optional[Var[bool]] = None
# If true, the slider will be disabled
is_disabled: Var[bool]
is_disabled: Optional[Var[bool]] = None
# If true, the slider will be in `read-only` state.
is_read_only: Var[bool]
is_read_only: Optional[Var[bool]] = None
# If true, the value will be incremented or decremented in reverse.
is_reversed: Var[bool]
is_reversed: Optional[Var[bool]] = None
# The minimum value of the slider.
min_: Var[int]
min_: Optional[Var[int]] = None
# The maximum value of the slider.
max_: Var[int]
max_: Optional[Var[int]] = None
# The step in which increments/decrements have to be made
step: Var[int]
step: Optional[Var[int]] = None
# The minimum distance between slider thumbs. Useful for preventing the thumbs from being too close together.
min_steps_between_thumbs: Var[int]
min_steps_between_thumbs: Optional[Var[int]] = None
# Oreintation of the slider vertical | horizontal.
orientation: Var[LiteralLayout]
orientation: Optional[Var[LiteralLayout]] = None
# Minimum height of the slider.
min_h: Var[str]
min_h: Optional[Var[str]] = None
# Minimum width of the slider.
min_w: Var[str]
min_w: Optional[Var[str]] = None
# Maximum height of the slider.
max_h: Var[str]
max_h: Optional[Var[str]] = None
# Maximum width of the slider.
max_w: Var[str]
max_w: Optional[Var[str]] = None
# The name of the form field
name: Var[str]
name: Optional[Var[str]] = None
def get_event_triggers(self) -> dict[str, Union[Var, Any]]:
"""Get the event triggers that pass the component's value to the handler.
@ -124,7 +124,7 @@ class SliderThumb(ChakraComponent):
tag = "SliderThumb"
# The size of the thumb.
box_size: Var[str]
box_size: Optional[Var[str]] = None
class SliderMark(ChakraComponent):

View File

@ -1,7 +1,7 @@
"""A switch component."""
from __future__ import annotations
from typing import Any, Union
from typing import Any, Optional, Union
from reflex.components.chakra import ChakraComponent, LiteralColorScheme
from reflex.constants import EventTriggers
@ -14,37 +14,37 @@ class Switch(ChakraComponent):
tag = "Switch"
# If true, the switch will be checked. You'll need to set an on_change event handler to update its value (since it is now controlled)
is_checked: Var[bool]
is_checked: Optional[Var[bool]] = None
# If true, the switch will be disabled
is_disabled: Var[bool]
is_disabled: Optional[Var[bool]] = None
# If true and is_disabled prop is set, the switch will remain tabbable but not interactive.
is_focusable: Var[bool]
is_focusable: Optional[Var[bool]] = None
# If true, the switch is marked as invalid. Changes style of unchecked state.
is_invalid: Var[bool]
is_invalid: Optional[Var[bool]] = None
# If true, the switch will be readonly
is_read_only: Var[bool]
is_read_only: Optional[Var[bool]] = None
# If true, the switch will be required
is_required: Var[bool]
is_required: Optional[Var[bool]] = None
# The name of the input field in a switch (Useful for form submission).
name: Var[str]
name: Optional[Var[str]] = None
# The value of the input field when checked (use is_checked prop for a bool)
value: Var[str] = Var.create(True) # type: ignore
# The spacing between the switch and its label text (0.5rem)
spacing: Var[str]
spacing: Optional[Var[str]] = None
# The placeholder text.
placeholder: Var[str]
placeholder: Optional[Var[str]] = None
# The color scheme of the switch (e.g. "blue", "green", "red", etc.)
color_scheme: Var[LiteralColorScheme]
color_scheme: Optional[Var[LiteralColorScheme]] = None
def get_event_triggers(self) -> dict[str, Union[Var, Any]]:
"""Get the event triggers that pass the component's value to the handler.

View File

@ -1,7 +1,7 @@
"""A textarea component."""
from __future__ import annotations
from typing import Any, Union
from typing import Any, Optional, Union
from reflex.components.chakra import ChakraComponent, LiteralInputVariant
from reflex.components.component import Component
@ -16,37 +16,37 @@ class TextArea(ChakraComponent):
tag = "Textarea"
# State var to bind the input.
value: Var[str]
value: Optional[Var[str]] = None
# The default value of the textarea.
default_value: Var[str]
default_value: Optional[Var[str]] = None
# The placeholder text.
placeholder: Var[str]
placeholder: Optional[Var[str]] = None
# The border color when the input is invalid.
error_border_color: Var[str]
error_border_color: Optional[Var[str]] = None
# The border color when the input is focused.
focus_border_color: Var[str]
focus_border_color: Optional[Var[str]] = None
# If true, the form control will be disabled.
is_disabled: Var[bool]
is_disabled: Optional[Var[bool]] = None
# If true, the form control will be invalid.
is_invalid: Var[bool]
is_invalid: Optional[Var[bool]] = None
# If true, the form control will be read-only.
is_read_only: Var[bool]
is_read_only: Optional[Var[bool]] = None
# If true, the form control will be required.
is_required: Var[bool]
is_required: Optional[Var[bool]] = None
# "outline" | "filled" | "flushed" | "unstyled"
variant: Var[LiteralInputVariant]
variant: Optional[Var[LiteralInputVariant]] = None
# The name of the form field
name: Var[str]
name: Optional[Var[str]] = None
def get_event_triggers(self) -> dict[str, Union[Var, Any]]:
"""Get the event triggers that pass the component's value to the handler.

View File

@ -1,4 +1,5 @@
"""A AspectRatio component."""
from typing import Optional
from reflex.components.chakra import ChakraComponent
from reflex.vars import Var
@ -10,4 +11,4 @@ class AspectRatio(ChakraComponent):
tag = "AspectRatio"
# The aspect ratio of the Box
ratio: Var[float]
ratio: Optional[Var[float]] = None

View File

@ -1,4 +1,5 @@
"""A box component that can contain other components."""
from typing import Optional
from reflex.components.chakra import ChakraComponent
from reflex.components.tags import Tag
@ -11,13 +12,13 @@ class Box(ChakraComponent):
tag = "Box"
# The type element to render. You can specify an image, video, or any other HTML element such as iframe.
element: Var[str]
element: Optional[Var[str]] = None
# The source of the content.
src: Var[str]
src: Optional[Var[str]] = None
# The alt text of the content.
alt: Var[str]
alt: Optional[Var[str]] = None
def _render(self) -> Tag:
return (

View File

@ -1,5 +1,4 @@
"""Chakra Card component."""
from typing import Optional
from reflex.components.chakra import (
@ -36,30 +35,30 @@ class Card(ChakraComponent):
tag = "Card"
# [required] The flex alignment of the card
align: Var[str]
align: Optional[Var[str]] = None
# [required] The flex direction of the card
direction: Var[str]
direction: Optional[Var[str]] = None
# [required] The flex distribution of the card
justify: Var[str]
justify: Optional[Var[str]] = None
# The visual color appearance of the component.
# options: "whiteAlpha" | "blackAlpha" | "gray" | "red" | "orange" | "yellow" |
# "green" | "teal" | "blue" | "cyan" | "purple" | "pink" | "linkedin" |
# "facebook" | "messenger" | "whatsapp" | "twitter" | "telegram"
# default: "gray"
color_scheme: Var[LiteralColorScheme]
color_scheme: Optional[Var[LiteralColorScheme]] = None
# The size of the Card
# options: "sm" | "md" | "lg"
# default: "md"
size: Var[LiteralTagSize]
size: Optional[Var[LiteralTagSize]] = None
# The variant of the Card
# options: "elevated" | "outline" | "filled" | "unstyled"
# default: "elevated"
variant: Var[LiteralCardVariant]
variant: Optional[Var[LiteralCardVariant]] = None
@classmethod
def create(

View File

@ -1,4 +1,5 @@
"""A flexbox container."""
from typing import Optional
from reflex.components.chakra import ChakraComponent
from reflex.vars import Var
@ -10,4 +11,4 @@ class Container(ChakraComponent):
tag = "Container"
# If true, container will center its children regardless of their width.
center_content: Var[bool]
center_content: Optional[Var[bool]] = None

View File

@ -1,6 +1,5 @@
"""A reflexive container component."""
from typing import List, Union
from typing import List, Optional, Union
from reflex.components.chakra import ChakraComponent
from reflex.vars import Var
@ -12,22 +11,22 @@ class Flex(ChakraComponent):
tag = "Flex"
# How to align items in the flex.
align: Var[str]
align: Optional[Var[str]] = None
# Shorthand for flexBasis style prop
basis: Var[str]
basis: Optional[Var[str]] = None
# Shorthand for flexDirection style prop
direction: Var[Union[str, List[str]]]
direction: Optional[Var[Union[str, List[str]]]] = None
# Shorthand for flexGrow style prop
grow: Var[str]
grow: Optional[Var[str]] = None
# The way to justify the items.
justify: Var[str]
justify: Optional[Var[str]] = None
# Shorthand for flexWrap style prop
wrap: Var[Union[str, List[str]]]
wrap: Optional[Var[Union[str, List[str]]]] = None
# Shorthand for flexShrink style prop
shrink: Var[str]
shrink: Optional[Var[str]] = None

View File

@ -1,6 +1,5 @@
"""Container to stack elements with spacing."""
from typing import List
from typing import List, Optional
from reflex.components.chakra import ChakraComponent
from reflex.vars import Var
@ -13,32 +12,32 @@ class Grid(ChakraComponent):
# Shorthand prop for gridAutoColumns to provide automatic column sizing based on content.
# Learn more _[here](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-auto-columns)_
auto_columns: Var[str]
auto_columns: Optional[Var[str]] = None
# Shorthand prop for gridAutoFlow to specify exactly how
# auto-placed items get flowed into the grid.
# Learn more _[here](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-auto-flow)_
auto_flow: Var[str]
auto_flow: Optional[Var[str]] = None
# Shorthand prop for gridAutoRows.
# Learn more _[here](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-auto-rows)_
auto_rows: Var[str]
auto_rows: Optional[Var[str]] = None
# Shorthand prop for gridColumn.
# Learn more _[here](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-column)_
column: Var[str]
column: Optional[Var[str]] = None
# Shorthand prop for gridRow.
# Learn more _[here](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-row)_
row: Var[str]
row: Optional[Var[str]] = None
# Shorthand prop for gridTemplateColumns.
# Learn more _[here](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-template-columns)_
template_columns: Var[str]
template_columns: Optional[Var[str]] = None
# Shorthand prop for gridTemplateRows.
# Learn more _[here](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-template-rows)_
template_rows: Var[str]
template_rows: Optional[Var[str]] = None
class GridItem(ChakraComponent):
@ -48,27 +47,27 @@ class GridItem(ChakraComponent):
# Shorthand prop for gridArea
# Learn more _[here](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-area)_
area: Var[str]
area: Optional[Var[str]] = None
# Shorthand prop for gridColumnEnd
# Learn more _[here](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-column-end)_
col_end: Var[str]
col_end: Optional[Var[str]] = None
# The column number the grid item should start.
col_start: Var[int]
col_start: Optional[Var[int]] = None
# The number of columns the grid item should span.
col_span: Var[int]
col_span: Optional[Var[int]] = None
# Shorthand prop for gridRowEnd
# Learn more _[here](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-row-end)_
row_end: Var[str]
row_end: Optional[Var[str]] = None
# The row number the grid item should start.
row_start: Var[int]
row_start: Optional[Var[int]] = None
# The number of rows the grid item should span.
row_span: Var[int]
row_span: Optional[Var[int]] = None
class ResponsiveGrid(ChakraComponent):
@ -78,48 +77,48 @@ class ResponsiveGrid(ChakraComponent):
# Shorthand prop for gridAutoColumns to provide automatic column sizing based on content.
# Learn more _[here](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-auto-columns)_
auto_columns: Var[str]
auto_columns: Optional[Var[str]] = None
# Shorthand prop for gridAutoFlow to specify exactly how
# auto-placed items get flowed into the grid.
# Learn more _[here](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-auto-flow)_
auto_flow: Var[str]
auto_flow: Optional[Var[str]] = None
# Shorthand prop for gridAutoRows.
# Learn more _[here](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-auto-rows)_
auto_rows: Var[str]
auto_rows: Optional[Var[str]] = None
# Shorthand prop for gridColumn.
# Learn more _[here](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-column)_
column: Var[str]
column: Optional[Var[str]] = None
# Shorthand prop for gridRow.
# Learn more _[here](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-row)_
row: Var[str]
row: Optional[Var[str]] = None
# A list that defines the number of columns for each breakpoint.
columns: Var[List[int]]
columns: Optional[Var[List[int]]] = None
# The width at which child elements will break into columns. Pass a number for pixel values or a string for any other valid CSS length.
min_child_width: Var[str]
min_child_width: Optional[Var[str]] = None
# The gap between the grid items
spacing: Var[str]
spacing: Optional[Var[str]] = None
# The column gap between the grid items
spacing_x: Var[str]
spacing_x: Optional[Var[str]] = None
# The row gap between the grid items
spacing_y: Var[str]
spacing_y: Optional[Var[str]] = None
# Shorthand prop for gridTemplateAreas
# Learn more _[here](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-template-areas)_
template_areas: Var[str]
template_areas: Optional[Var[str]] = None
# Shorthand prop for gridTemplateColumns.
# Learn more _[here](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-template-columns)_
template_columns: Var[str]
template_columns: Optional[Var[str]] = None
# Shorthand prop for gridTemplateRows.
# Learn more _[here](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-template-rows)_
template_rows: Var[str]
template_rows: Optional[Var[str]] = None

View File

@ -1,6 +1,5 @@
"""Container to stack elements with spacing."""
from typing import List, Union
from typing import List, Optional, Union
from reflex.components.chakra import ChakraComponent, LiteralStackDirection
from reflex.vars import Var
@ -12,28 +11,28 @@ class Stack(ChakraComponent):
tag = "Stack"
# Shorthand for alignItems style prop
align_items: Var[str]
align_items: Optional[Var[str]] = None
# The direction to stack the items.
direction: Var[Union[LiteralStackDirection, List[str]]]
direction: Optional[Var[Union[LiteralStackDirection, List[str]]]] = None
# If true the items will be stacked horizontally.
is_inline: Var[bool]
is_inline: Optional[Var[bool]] = None
# Shorthand for justifyContent style prop
justify_content: Var[str]
justify_content: Optional[Var[str]] = None
# If true, the children will be wrapped in a Box, and the Box will take the spacing props
should_wrap_children: Var[bool]
should_wrap_children: Optional[Var[bool]] = None
# The space between each stack item
spacing: Var[str]
spacing: Optional[Var[str]] = None
# Shorthand for flexWrap style prop
wrap: Var[str]
wrap: Optional[Var[str]] = None
# Alignment of contents.
justify: Var[str]
justify: Optional[Var[str]] = None
class Hstack(Stack):

View File

@ -1,4 +1,5 @@
"""Container to stack elements with spacing."""
from typing import Optional
from reflex.components.chakra import ChakraComponent
from reflex.components.component import Component
@ -11,25 +12,25 @@ class Wrap(ChakraComponent):
tag = "Wrap"
# How to align the items.
align: Var[str]
align: Optional[Var[str]] = None
# The flex direction of the wrap.
direction: Var[str]
direction: Optional[Var[str]] = None
# How to justify the items.
justify: Var[str]
justify: Optional[Var[str]] = None
# Whether to wrap children in `rx.wrap_item`.
should_wrap_children: Var[bool]
should_wrap_children: Optional[Var[bool]] = None
# The spacing between the items.
spacing: Var[str]
spacing: Optional[Var[str]] = None
# The horizontal spacing between the items.
spacing_x: Var[str]
spacing_x: Optional[Var[str]] = None
# The vertical spacing between the items.
spacing_y: Var[str]
spacing_y: Optional[Var[str]] = None
@classmethod
def create(cls, *children, items=None, **props) -> Component:

View File

@ -1,7 +1,7 @@
"""Avatar components."""
from __future__ import annotations
from typing import Any, Union
from typing import Any, Optional, Union
from reflex.components.chakra import ChakraComponent, LiteralAvatarSize
from reflex.vars import Var
@ -13,28 +13,28 @@ class Avatar(ChakraComponent):
tag = "Avatar"
# The default avatar used as fallback when name, and src is not specified.
icon: Var[str]
icon: Optional[Var[str]] = None
# The label of the icon.
icon_label: Var[str]
icon_label: Optional[Var[str]] = None
# If true, opt out of the avatar's fallback logic and renders the img at all times.
ignore_fallback: Var[bool]
ignore_fallback: Optional[Var[bool]] = None
# The name of the person in the avatar.
name: Var[str]
name: Optional[Var[str]] = None
# If true, the Avatar will show a border around it. Best for a group of avatars.
show_border: Var[bool]
show_border: Optional[Var[bool]] = None
# The image url of the Avatar.
src: Var[str]
src: Optional[Var[str]] = None
# List of sources to use for different screen resolutions.
src_set: Var[str]
src_set: Optional[Var[str]] = None
# "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "full"
size: Var[LiteralAvatarSize]
size: Optional[Var[LiteralAvatarSize]] = None
def get_event_triggers(self) -> dict[str, Union[Var, Any]]:
"""Get the event triggers for the component.
@ -60,7 +60,7 @@ class AvatarGroup(ChakraComponent):
tag = "AvatarGroup"
# The maximum number of visible avatars.
max_: Var[int]
max_: Optional[Var[int]] = None
# The space between the avatars in the group.
spacing: Var[int]
spacing: Optional[Var[int]] = None

View File

@ -14,40 +14,40 @@ class Image(ChakraComponent):
tag = "Image"
alias = "ChakraImage"
# How to align the image within its bounds. It maps to css `object-position` property.
align: Var[str]
align: Optional[Var[str]] = None
# Fallback Reflex component to show if image is loading or image fails.
fallback: Optional[Component] = None
# Fallback image src to show if image is loading or image fails.
fallback_src: Var[str]
fallback_src: Optional[Var[str]] = None
# How the image to fit within its bounds. It maps to css `object-fit` property.
fit: Var[str]
fit: Optional[Var[str]] = None
# The native HTML height attribute to the passed to the img.
html_height: Var[str]
html_height: Optional[Var[str]] = None
# The native HTML width attribute to the passed to the img.
html_width: Var[str]
html_width: Optional[Var[str]] = None
# If true, opt out of the fallbackSrc logic and use as img.
ignore_fallback: Var[bool]
ignore_fallback: Optional[Var[bool]] = None
# "eager" | "lazy"
loading: Var[LiteralImageLoading]
loading: Optional[Var[LiteralImageLoading]] = None
# The path/url to the image or PIL image object.
src: Var[Any]
src: Optional[Var[Any]] = None
# The alt text of the image.
alt: Var[str]
alt: Optional[Var[str]] = None
# Provide multiple sources for an image, allowing the browser
# to select the most appropriate source based on factors like
# screen resolution and device capabilities.
# Learn more _[here](https://developer.mozilla.org/en-US/docs/Learn/HTML/Multimedia_and_embedding/Responsive_images)_
src_set: Var[str]
src_set: Optional[Var[str]] = None
def get_event_triggers(self) -> dict[str, Union[Var, Any]]:
"""Get the event triggers for the component.

View File

@ -1,4 +1,5 @@
"""Breadcrumb components."""
from typing import Optional
from reflex.components.chakra import ChakraComponent
from reflex.components.chakra.navigation.link import Link
@ -13,10 +14,10 @@ class Breadcrumb(ChakraComponent):
tag = "Breadcrumb"
# The visual separator between each breadcrumb item
separator: Var[str]
separator: Optional[Var[str]] = None
# The left and right margin applied to the separator
separator_margin: Var[str]
separator_margin: Optional[Var[str]] = None
@classmethod
def create(cls, *children, items=None, **props) -> Component:
@ -54,16 +55,16 @@ class BreadcrumbItem(ChakraComponent):
tag = "BreadcrumbItem"
# Is the current page of the breadcrumb.
is_current_page: Var[bool]
is_current_page: Optional[Var[bool]] = None
# Is the last child of the breadcrumb.
is_last_child: Var[bool]
is_last_child: Optional[Var[bool]] = None
# The visual separator between each breadcrumb item
separator: Var[str]
separator: Optional[Var[str]] = None
# The left and right margin applied to the separator
spacing: Var[str]
spacing: Optional[Var[str]] = None
@classmethod
def create(cls, *children, label=None, href=None, **props):
@ -95,4 +96,4 @@ class BreadcrumbLink(Link):
tag = "BreadcrumbLink"
# Is the current page of the breadcrumb.
is_current_page: Var[bool]
is_current_page: Optional[Var[bool]] = None

View File

@ -1,5 +1,5 @@
"""A link component."""
from typing import Optional
from reflex.components.chakra import ChakraComponent
from reflex.components.component import Component
@ -16,19 +16,19 @@ class Link(ChakraComponent):
tag = "Link"
# The rel.
rel: Var[str]
rel: Optional[Var[str]] = None
# The page to link to.
href: Var[str]
href: Optional[Var[str]] = None
# The text to display.
text: Var[str]
text: Optional[Var[str]] = None
# What the link renders to.
as_: Var[str] = BaseVar.create(value="{NextLink}", _var_is_local=False) # type: ignore
# If true, the link will open in new tab.
is_external: Var[bool]
is_external: Optional[Var[bool]] = None
def _get_imports(self) -> imports.ImportDict:
return {**super()._get_imports(), **next_link._get_imports()}

View File

@ -1,4 +1,5 @@
"""Link overlay components."""
from typing import Optional
from reflex.components.chakra import ChakraComponent
from reflex.vars import Var
@ -10,10 +11,10 @@ class LinkOverlay(ChakraComponent):
tag = "LinkOverlay"
# If true, the link will open in new tab
is_external: Var[bool]
is_external: Optional[Var[bool]] = None
# Href of the link overlay.
href: Var[str]
href: Optional[Var[str]] = None
class LinkBox(ChakraComponent):

View File

@ -1,5 +1,4 @@
"""A component to indicate progress through a multi-step process."""
from typing import List, Literal, Optional, Tuple
from reflex.components.chakra import ChakraComponent, LiteralColorScheme
@ -12,19 +11,19 @@ class Stepper(ChakraComponent):
tag = "Stepper"
orientation: Var[Literal["vertical", "horizontal"]]
orientation: Optional[Var[Literal["vertical", "horizontal"]]] = None
# The color scheme to use for the stepper; default is blue.
colorScheme: Var[LiteralColorScheme]
colorScheme: Optional[Var[LiteralColorScheme]] = None
# Chakra provides a useSteps hook to control the stepper.
# Instead, use an integer state value to set progress in the stepper.
# The index of the current step.
index: Var[int]
index: Optional[Var[int]] = None
# The size of the steps in the stepper.
size: Var[str]
size: Optional[Var[str]] = None
@classmethod
def create(
@ -98,11 +97,11 @@ class StepStatus(ChakraComponent):
# active, complete, and incomplete should also be able to accept StepIcon or StepNumber components
# currently, these props only support strings
active: Var[str]
active: Optional[Var[str]] = None
complete: Var[str]
complete: Optional[Var[str]] = None
incomplete: Var[str]
incomplete: Optional[Var[str]] = None
tag = "StepStatus"

View File

@ -1,7 +1,7 @@
"""Alert dialog components."""
from __future__ import annotations
from typing import Any, Union
from typing import Any, Optional, Union
from reflex.components.chakra import ChakraComponent, LiteralAlertDialogSize
from reflex.components.chakra.media.icon import Icon
@ -15,43 +15,43 @@ class AlertDialog(ChakraComponent):
tag = "AlertDialog"
# If true, the modal will be open.
is_open: Var[bool]
is_open: Optional[Var[bool]] = None
# The least destructive element to focus when the dialog opens.
least_destructive_ref: Var[str]
least_destructive_ref: Optional[Var[str]] = None
# Handle zoom/pinch gestures on iOS devices when scroll locking is enabled. Defaults to false.
allow_pinch_zoom: Var[bool]
allow_pinch_zoom: Optional[Var[bool]] = None
# If true, the modal will autofocus the first enabled and interactive element within the ModalContent
auto_focus: Var[bool]
auto_focus: Optional[Var[bool]] = None
# If true, scrolling will be disabled on the body when the modal opens.
block_scroll_on_mount: Var[bool]
block_scroll_on_mount: Optional[Var[bool]] = None
# If true, the modal will close when the Esc key is pressed
close_on_esc: Var[bool]
close_on_esc: Optional[Var[bool]] = None
# If true, the modal will close when the overlay is clicked
close_on_overlay_click: Var[bool]
close_on_overlay_click: Optional[Var[bool]] = None
# If true, the modal will be centered on screen.
is_centered: Var[bool]
is_centered: Optional[Var[bool]] = None
# Enables aggressive focus capturing within iframes. If true, keep focus in the lock, no matter where lock is active. If false, allows focus to move outside of iframe.
lock_focus_across_frames: Var[bool]
lock_focus_across_frames: Optional[Var[bool]] = None
# If true, a `padding-right` will be applied to the body element that's equal to the width of the scrollbar. This can help prevent some unpleasant flickering effect and content adjustment when the modal opens
preserve_scroll_bar_gap: Var[bool]
preserve_scroll_bar_gap: Optional[Var[bool]] = None
# If true, the modal will return focus to the element that triggered it when it closes.
return_focus_on_close: Var[bool]
return_focus_on_close: Optional[Var[bool]] = None
# "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl" | "5xl" | "6xl" | "full"
size: Var[LiteralAlertDialogSize]
size: Optional[Var[LiteralAlertDialogSize]] = None
# If true, the siblings of the modal will have `aria-hidden` set to true so that screen readers can only see the modal. This is commonly known as making the other elements **inert**
use_inert: Var[bool]
use_inert: Optional[Var[bool]] = None
def get_event_triggers(self) -> dict[str, Union[Var, Any]]:
"""Get the event triggers for the component.

View File

@ -1,7 +1,7 @@
"""Container to stack elements with spacing."""
from __future__ import annotations
from typing import Any, Union
from typing import Any, Optional, Union
from reflex.components.chakra import (
ChakraComponent,
@ -19,55 +19,55 @@ class Drawer(ChakraComponent):
tag = "Drawer"
# If true, the modal will be open.
is_open: Var[bool]
is_open: Optional[Var[bool]] = None
# Handle zoom/pinch gestures on iOS devices when scroll locking is enabled. Defaults to false.
allow_pinch_zoom: Var[bool]
allow_pinch_zoom: Optional[Var[bool]] = None
# If true, the modal will autofocus the first enabled and interactive element within the ModalContent
auto_focus: Var[bool]
auto_focus: Optional[Var[bool]] = None
# If true, scrolling will be disabled on the body when the modal opens.
block_scroll_on_mount: Var[bool]
block_scroll_on_mount: Optional[Var[bool]] = None
# If true, the modal will close when the Esc key is pressed
close_on_esc: Var[bool]
close_on_esc: Optional[Var[bool]] = None
# If true, the modal will close when the overlay is clicked
close_on_overlay_click: Var[bool]
close_on_overlay_click: Optional[Var[bool]] = None
# If true, the modal will be centered on screen.
is_centered: Var[bool]
is_centered: Optional[Var[bool]] = None
# If true and drawer's placement is top or bottom, the drawer will occupy the viewport height (100vh)
is_full_height: Var[bool]
is_full_height: Optional[Var[bool]] = None
# Enables aggressive focus capturing within iframes. - If true: keep focus in the lock, no matter where lock is active - If false: allows focus to move outside of iframe
lock_focus_across_frames: Var[bool]
lock_focus_across_frames: Optional[Var[bool]] = None
# The placement of the drawer
placement: Var[str]
placement: Optional[Var[str]] = None
# If true, a `padding-right` will be applied to the body element that's equal to the width of the scrollbar. This can help prevent some unpleasant flickering effect and content adjustment when the modal opens
preserve_scroll_bar_gap: Var[bool]
preserve_scroll_bar_gap: Optional[Var[bool]] = None
# If true, the modal will return focus to the element that triggered it when it closes.
return_focus_on_close: Var[bool]
return_focus_on_close: Optional[Var[bool]] = None
# "xs" | "sm" | "md" | "lg" | "xl" | "full"
size: Var[LiteralDrawerSize]
size: Optional[Var[LiteralDrawerSize]] = None
# A11y: If true, the siblings of the modal will have `aria-hidden` set to true so that screen readers can only see the modal. This is commonly known as making the other elements **inert**
use_inert: Var[bool]
use_inert: Optional[Var[bool]] = None
# Variant of drawer
variant: Var[str]
variant: Optional[Var[str]] = None
# Color scheme of the Drawer
# Options:
# "whiteAlpha" | "blackAlpha" | "gray" | "red" | "orange" | "yellow" | "green" | "teal" | "blue" | "cyan"
# | "purple" | "pink" | "linkedin" | "facebook" | "messenger" | "whatsapp" | "twitter" | "telegram"
color_scheme: Var[LiteralColorScheme]
color_scheme: Optional[Var[LiteralColorScheme]] = None
def get_event_triggers(self) -> dict[str, Union[Var, Any]]:
"""Get the event triggers for the component.

View File

@ -20,52 +20,52 @@ class Menu(ChakraComponent):
tag = "Menu"
# The padding required to prevent the arrow from reaching the very edge of the popper.
arrow_padding: Var[int]
arrow_padding: Optional[Var[int]] = None
# If true, the first enabled menu item will receive focus and be selected when the menu opens.
auto_select: Var[bool]
auto_select: Optional[Var[bool]] = None
# The boundary area for the popper. Used within the preventOverflow modifier
boundary: Var[str]
boundary: Optional[Var[str]] = None
# If true, the menu will close when you click outside the menu list
close_on_blur: Var[bool]
close_on_blur: Optional[Var[bool]] = None
# If true, the menu will close when a menu item is clicked
close_on_select: Var[bool]
close_on_select: Optional[Var[bool]] = None
# If by default the menu is open.
default_is_open: Var[bool]
default_is_open: Optional[Var[bool]] = None
# If rtl, popper placement positions will be flipped i.e. 'top-right' will become 'top-left' and vice-verse ("ltr" | "rtl")
direction: Var[LiteralChakraDirection]
direction: Optional[Var[LiteralChakraDirection]] = None
# If true, the popper will change its placement and flip when it's about to overflow its boundary area.
flip: Var[bool]
flip: Optional[Var[bool]] = None
# The distance or margin between the reference and popper. It is used internally to create an offset modifier. NB: If you define offset prop, it'll override the gutter.
gutter: Var[int]
gutter: Optional[Var[int]] = None
# Performance 🚀: If true, the MenuItem rendering will be deferred until the menu is open.
is_lazy: Var[bool]
is_lazy: Optional[Var[bool]] = None
# Performance 🚀: The lazy behavior of menu's content when not visible. Only works when `isLazy={true}` - "unmount": The menu's content is always unmounted when not open. - "keepMounted": The menu's content initially unmounted, but stays mounted when menu is open.
lazy_behavior: Var[str]
lazy_behavior: Optional[Var[str]] = None
# Determines if the menu is open or not.
is_open: Var[bool]
is_open: Optional[Var[bool]] = None
# If true, the popper will match the width of the reference at all times. It's useful for autocomplete, `date-picker` and select patterns.
match_width: Var[bool]
match_width: Optional[Var[bool]] = None
# The placement of the popper relative to its reference.
placement: Var[str]
placement: Optional[Var[str]] = None
# If true, will prevent the popper from being cut off and ensure it's visible within the boundary area.
prevent_overflow: Var[bool]
prevent_overflow: Optional[Var[bool]] = None
# The CSS positioning strategy to use. ("fixed" | "absolute")
strategy: Var[LiteralMenuStrategy]
strategy: Optional[Var[LiteralMenuStrategy]] = None
def get_event_triggers(self) -> dict[str, Union[Var, Any]]:
"""Get the event triggers for the component.
@ -118,13 +118,13 @@ class MenuButton(ChakraComponent):
tag = "MenuButton"
# The variant of the menu button.
variant: Var[str]
variant: Optional[Var[str]] = None
# Components that are not allowed as children.
_invalid_children: List[str] = ["Button", "MenuButton"]
# The tag to use for the menu button.
as_: Var[str]
as_: Optional[Var[str]] = None
class MenuList(ChakraComponent):
@ -160,19 +160,19 @@ class MenuItem(ChakraComponent):
tag = "MenuItem"
# Overrides the parent menu's closeOnSelect prop.
close_on_select: Var[bool]
close_on_select: Optional[Var[bool]] = None
# Right-aligned label text content, useful for displaying hotkeys.
command: Var[str]
command: Optional[Var[str]] = None
# The spacing between the command and menu item's label.
command_spacing: Var[int]
command_spacing: Optional[Var[int]] = None
# If true, the menuitem will be disabled.
is_disabled: Var[bool]
is_disabled: Optional[Var[bool]] = None
# If true and the menuitem is disabled, it'll remain keyboard-focusable
is_focusable: Var[bool]
is_focusable: Optional[Var[bool]] = None
class MenuItemOption(ChakraComponent):
@ -181,28 +181,28 @@ class MenuItemOption(ChakraComponent):
tag = "MenuItemOption"
# Overrides the parent menu's closeOnSelect prop.
close_on_select: Var[bool]
close_on_select: Optional[Var[bool]] = None
# Right-aligned label text content, useful for displaying hotkeys.
command: Var[str]
command: Optional[Var[str]] = None
# The spacing between the command and menu item's label.
command_spacing: Var[int]
command_spacing: Optional[Var[int]] = None
# Determines if menu item is checked.
is_checked: Var[bool]
is_checked: Optional[Var[bool]] = None
# If true, the menuitem will be disabled.
is_disabled: Var[bool]
is_disabled: Optional[Var[bool]] = None
# If true and the menuitem is disabled, it'll remain keyboard-focusable
is_focusable: Var[bool]
is_focusable: Optional[Var[bool]] = None
# "checkbox" | "radio"
type_: Var[LiteralMenuOption]
type_: Optional[Var[LiteralMenuOption]] = None
# Value of the menu item.
value: Var[str]
value: Optional[Var[str]] = None
class MenuGroup(ChakraComponent):
@ -217,10 +217,10 @@ class MenuOptionGroup(ChakraComponent):
tag = "MenuOptionGroup"
# "checkbox" | "radio"
type_: Var[LiteralMenuOption]
type_: Optional[Var[LiteralMenuOption]] = None
# Value of the option group.
value: Var[str]
value: Optional[Var[str]] = None
class MenuDivider(ChakraComponent):

View File

@ -17,43 +17,43 @@ class Modal(ChakraComponent):
tag = "Modal"
# If true, the modal will be open.
is_open: Var[bool]
is_open: Optional[Var[bool]] = None
# Handle zoom/pinch gestures on iOS devices when scroll locking is enabled. Defaults to false.
allow_pinch_zoom: Var[bool]
allow_pinch_zoom: Optional[Var[bool]] = None
# If true, the modal will autofocus the first enabled and interactive element within the ModalContent
auto_focus: Var[bool]
auto_focus: Optional[Var[bool]] = None
# If true, scrolling will be disabled on the body when the modal opens.
block_scroll_on_mount: Var[bool]
block_scroll_on_mount: Optional[Var[bool]] = None
# If true, the modal will close when the Esc key is pressed
close_on_esc: Var[bool]
close_on_esc: Optional[Var[bool]] = None
# If true, the modal will close when the overlay is clicked
close_on_overlay_click: Var[bool]
close_on_overlay_click: Optional[Var[bool]] = None
# If true, the modal will be centered on screen.
is_centered: Var[bool]
is_centered: Optional[Var[bool]] = None
# Enables aggressive focus capturing within iframes. - If true: keep focus in the lock, no matter where lock is active - If false: allows focus to move outside of iframe
lock_focus_across_frames: Var[bool]
lock_focus_across_frames: Optional[Var[bool]] = None
# The transition that should be used for the modal
motion_preset: Var[str]
motion_preset: Optional[Var[str]] = None
# If true, a `padding-right` will be applied to the body element that's equal to the width of the scrollbar. This can help prevent some unpleasant flickering effect and content adjustment when the modal opens
preserve_scroll_bar_gap: Var[bool]
preserve_scroll_bar_gap: Optional[Var[bool]] = None
# If true, the modal will return focus to the element that triggered it when it closes.
return_focus_on_close: Var[bool]
return_focus_on_close: Optional[Var[bool]] = None
# "xs" | "sm" | "md" | "lg" | "xl" | "full"
size: Var[ModalSizes]
size: Optional[Var[ModalSizes]] = None
# A11y: If true, the siblings of the modal will have `aria-hidden` set to true so that screen readers can only see the modal. This is commonly known as making the other elements **inert**
use_inert: Var[bool]
use_inert: Optional[Var[bool]] = None
def get_event_triggers(self) -> dict[str, Union[Var, Any]]:
"""Get the event triggers for the component.

View File

@ -1,7 +1,7 @@
"""Popover components."""
from __future__ import annotations
from typing import Any, Union
from typing import Any, Optional, Union
from reflex.components.chakra import (
ChakraComponent,
@ -19,67 +19,67 @@ class Popover(ChakraComponent):
tag = "Popover"
# The padding required to prevent the arrow from reaching the very edge of the popper.
arrow_padding: Var[int]
arrow_padding: Optional[Var[int]] = None
# The `box-shadow` of the popover arrow
arrow_shadow_color: Var[str]
arrow_shadow_color: Optional[Var[str]] = None
# The size of the popover arrow
arrow_size: Var[int]
arrow_size: Optional[Var[int]] = None
# If true, focus will be transferred to the first interactive element when the popover opens
auto_focus: Var[bool]
auto_focus: Optional[Var[bool]] = None
# The boundary area for the popper. Used within the preventOverflow modifier
boundary: Var[str]
boundary: Optional[Var[str]] = None
# If true, the popover will close when you blur out it by clicking outside or tabbing out
close_on_blur: Var[bool]
close_on_blur: Optional[Var[bool]] = None
# If true, the popover will close when you hit the Esc key
close_on_esc: Var[bool]
close_on_esc: Optional[Var[bool]] = None
# If true, the popover will be initially opened.
default_is_open: Var[bool]
default_is_open: Optional[Var[bool]] = None
# Theme direction ltr or rtl. Popper's placement will be set accordingly
direction: Var[LiteralChakraDirection]
direction: Optional[Var[LiteralChakraDirection]] = None
# If true, the popper will change its placement and flip when it's about to overflow its boundary area.
flip: Var[bool]
flip: Optional[Var[bool]] = None
# The distance or margin between the reference and popper. It is used internally to create an offset modifier. NB: If you define offset prop, it'll override the gutter.
gutter: Var[int]
gutter: Optional[Var[int]] = None
# The html id attribute of the popover. If not provided, we generate a unique id. This id is also used to auto-generate the `aria-labelledby` and `aria-describedby` attributes that points to the PopoverHeader and PopoverBody
id_: Var[str]
id_: Optional[Var[str]] = None
# Performance 🚀: If true, the PopoverContent rendering will be deferred until the popover is open.
is_lazy: Var[bool]
is_lazy: Optional[Var[bool]] = None
# Performance 🚀: The lazy behavior of popover's content when not visible. Only works when `isLazy={true}` - "unmount": The popover's content is always unmounted when not open. - "keepMounted": The popover's content initially unmounted, but stays mounted when popover is open.
lazy_behavior: Var[str]
lazy_behavior: Optional[Var[str]] = None
# If true, the popover will be opened in controlled mode.
is_open: Var[bool]
is_open: Optional[Var[bool]] = None
# If true, the popper will match the width of the reference at all times. It's useful for autocomplete, `date-picker` and select patterns.
match_width: Var[bool]
match_width: Optional[Var[bool]] = None
# The placement of the popover. It's used internally by Popper.js.
placement: Var[str]
placement: Optional[Var[str]] = None
# If true, will prevent the popper from being cut off and ensure it's visible within the boundary area.
prevent_overflow: Var[bool]
prevent_overflow: Optional[Var[bool]] = None
# If true, focus will be returned to the element that triggers the popover when it closes
return_focus_on_close: Var[bool]
return_focus_on_close: Optional[Var[bool]] = None
# The CSS positioning strategy to use. ("fixed" | "absolute")
strategy: Var[LiteralMenuStrategy]
strategy: Optional[Var[LiteralMenuStrategy]] = None
# The interaction that triggers the popover. hover - means the popover will open when you hover with mouse or focus with keyboard on the popover trigger click - means the popover will open on click or press Enter to Space on keyboard ("click" | "hover")
trigger: Var[LiteralPopOverTrigger]
trigger: Optional[Var[LiteralPopOverTrigger]] = None
def get_event_triggers(self) -> dict[str, Union[Var, Any]]:
"""Get the event triggers for the component.

View File

@ -1,7 +1,7 @@
"""Tooltip components."""
from __future__ import annotations
from typing import Any, Union
from typing import Any, Optional, Union
from reflex.components.chakra import ChakraComponent, LiteralChakraDirection
from reflex.vars import Var
@ -13,55 +13,55 @@ class Tooltip(ChakraComponent):
tag = "Tooltip"
# The padding required to prevent the arrow from reaching the very edge of the popper.
arrow_padding: Var[int]
arrow_padding: Optional[Var[int]] = None
# The color of the arrow shadow.
arrow_shadow_color: Var[str]
arrow_shadow_color: Optional[Var[str]] = None
# Size of the arrow.
arrow_size: Var[int]
arrow_size: Optional[Var[int]] = None
# Delay (in ms) before hiding the tooltip
delay: Var[int]
delay: Optional[Var[int]] = None
# If true, the tooltip will hide on click
close_on_click: Var[bool]
close_on_click: Optional[Var[bool]] = None
# If true, the tooltip will hide on pressing Esc key
close_on_esc: Var[bool]
close_on_esc: Optional[Var[bool]] = None
# If true, the tooltip will hide while the mouse is down
close_on_mouse_down: Var[bool]
close_on_mouse_down: Optional[Var[bool]] = None
# If true, the tooltip will be initially shown
default_is_open: Var[bool]
default_is_open: Optional[Var[bool]] = None
# Theme direction ltr or rtl. Popper's placement will be set accordingly
direction: Var[LiteralChakraDirection]
direction: Optional[Var[LiteralChakraDirection]] = None
# The distance or margin between the reference and popper. It is used internally to create an offset modifier. NB: If you define offset prop, it'll override the gutter.
gutter: Var[int]
gutter: Optional[Var[int]] = None
# If true, the tooltip will show an arrow tip
has_arrow: Var[bool]
has_arrow: Optional[Var[bool]] = None
# If true, the tooltip with be disabled.
is_disabled: Var[bool]
is_disabled: Optional[Var[bool]] = None
# If true, the tooltip will be open.
is_open: Var[bool]
is_open: Optional[Var[bool]] = None
# The label of the tooltip
label: Var[str]
label: Optional[Var[str]] = None
# Delay (in ms) before showing the tooltip
open_delay: Var[int]
open_delay: Optional[Var[int]] = None
# The placement of the popper relative to its reference.
placement: Var[str]
placement: Optional[Var[str]] = None
# If true, the tooltip will wrap its children in a `<span/>` with `tabIndex=0`
should_wrap_children: Var[bool]
should_wrap_children: Optional[Var[bool]] = None
def get_event_triggers(self) -> dict[str, Union[Var, Any]]:
"""Get the event triggers for the component.

View File

@ -1,5 +1,5 @@
"""A heading component."""
from typing import Optional
from reflex.components.chakra import ChakraComponent, LiteralHeadingSize
from reflex.vars import Var
@ -11,7 +11,7 @@ class Heading(ChakraComponent):
tag = "Heading"
# Override the tag. The default tag is `<h2>`.
as_: Var[str]
as_: Optional[Var[str]] = None
# "4xl" | "3xl" | "2xl" | "xl" | "lg" | "md" | "sm" | "xs"
size: Var[LiteralHeadingSize]
size: Optional[Var[LiteralHeadingSize]] = None

View File

@ -1,6 +1,5 @@
"""A highlight component."""
from typing import Dict, List
from typing import Dict, List, Optional
from reflex.components.chakra import ChakraComponent
from reflex.components.tags import Tag
@ -13,7 +12,7 @@ class Highlight(ChakraComponent):
tag = "Highlight"
# A query for the text to highlight. Can be a string or a list of strings.
query: Var[List[str]]
query: Optional[Var[List[str]]] = None
# The style of the content.
# Note: styles and style are different prop.

View File

@ -1,6 +1,8 @@
"""A text component."""
from __future__ import annotations
from typing import Optional
from reflex.components.chakra import ChakraComponent
from reflex.vars import Var
@ -11,7 +13,7 @@ class Text(ChakraComponent):
tag = "Text"
# Override the tag. The default tag is `<p>`.
as_: Var[str]
as_: Optional[Var[str]] = None
# Truncate text after a specific number of lines. It will render an ellipsis when the text exceeds the width of the viewport or max_width prop.
no_of_lines: Var[int]
no_of_lines: Optional[Var[int]] = None

View File

@ -1,5 +1,4 @@
"""Base component definitions."""
from __future__ import annotations
import copy

View File

@ -21,7 +21,7 @@ class Cond(MemoizationLeaf):
"""Render one of two components based on a condition."""
# The cond to determine which component to render.
cond: Var[Any]
cond: Optional[Var[Any]] = None
# The component to render if the cond is true.
comp1: BaseComponent = None # type: ignore

View File

@ -1,7 +1,7 @@
"""Wrapper around react-debounce-input."""
from __future__ import annotations
from typing import Any, Type
from typing import Any, Optional, Type
from reflex.components.component import Component
from reflex.constants import EventTriggers
@ -22,25 +22,25 @@ class DebounceInput(Component):
tag = "DebounceInput"
# Minimum input characters before triggering the on_change event
min_length: Var[int]
min_length: Optional[Var[int]] = None
# Time to wait between end of input and triggering on_change
debounce_timeout: Var[int] = DEFAULT_DEBOUNCE_TIMEOUT # type: ignore
# If true, notify when Enter key is pressed
force_notify_by_enter: Var[bool]
force_notify_by_enter: Optional[Var[bool]] = None
# If true, notify when form control loses focus
force_notify_on_blur: Var[bool]
force_notify_on_blur: Optional[Var[bool]] = None
# If provided, create a fully-controlled input
value: Var[str]
value: Optional[Var[str]] = None
# The ref to attach to the created input
input_ref: Var[str]
input_ref: Optional[Var[str]] = None
# The element to wrap
element: Var[Type[Component]]
element: Optional[Var[Type[Component]]] = None
@classmethod
def create(cls, *children: Component, **props: Any) -> Component:

View File

@ -18,7 +18,7 @@ class Foreach(Component):
_memoization_mode = MemoizationMode(recursive=False)
# The iterable to create components from.
iterable: Var[Iterable]
iterable: Optional[Var[Iterable]] = None
# A function from the render args to the component.
render_fn: Callable = Fragment.create

View File

@ -1,5 +1,5 @@
"""A html component."""
from typing import Dict
from typing import Dict, Optional
from reflex.components.el.elements.typography import Div
from reflex.vars import Var
@ -13,7 +13,7 @@ class Html(Div):
"""
# The HTML to render.
dangerouslySetInnerHTML: Var[Dict[str, str]]
dangerouslySetInnerHTML: Optional[Var[Dict[str, str]]] = None
@classmethod
def create(cls, *children, **props):

View File

@ -1,5 +1,4 @@
"""rx.match."""
import textwrap
from typing import Any, Dict, List, Optional, Tuple, Union
@ -17,7 +16,7 @@ class Match(MemoizationLeaf):
"""Match cases based on a condition."""
# The condition to determine which case to match.
cond: Var[Any]
cond: Optional[Var[Any]] = None
# The list of match cases to be matched.
match_cases: List[Any] = []

View File

@ -173,31 +173,31 @@ class Upload(MemoizationLeaf):
# The list of accepted file types. This should be a dictionary of MIME types as keys and array of file formats as
# values.
# supported MIME types: https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
accept: Var[Optional[Dict[str, List]]]
accept: Optional[Var[Optional[Dict[str, List]]]] = None
# Whether the dropzone is disabled.
disabled: Var[bool]
disabled: Optional[Var[bool]] = None
# The maximum number of files that can be uploaded.
max_files: Var[int]
max_files: Optional[Var[int]] = None
# The maximum file size (bytes) that can be uploaded.
max_size: Var[int]
max_size: Optional[Var[int]] = None
# The minimum file size (bytes) that can be uploaded.
min_size: Var[int]
min_size: Optional[Var[int]] = None
# Whether to allow multiple files to be uploaded.
multiple: Var[bool] = True # type: ignore
# Whether to disable click to upload.
no_click: Var[bool]
no_click: Optional[Var[bool]] = None
# Whether to disable drag and drop.
no_drag: Var[bool]
no_drag: Optional[Var[bool]] = None
# Whether to disable using the space/enter keys to upload.
no_keyboard: Var[bool]
no_keyboard: Optional[Var[bool]] = None
# Marked True when any Upload component is created.
is_used: ClassVar[bool] = False

View File

@ -361,22 +361,22 @@ class CodeBlock(Component):
language: Var[LiteralCodeLanguage] = "python" # type: ignore
# The code to display.
code: Var[str]
code: Optional[Var[str]] = None
# If this is enabled line numbers will be shown next to the code block.
show_line_numbers: Var[bool]
show_line_numbers: Optional[Var[bool]] = None
# The starting line number to use.
starting_line_number: Var[int]
starting_line_number: Optional[Var[int]] = None
# Whether to wrap long lines.
wrap_long_lines: Var[bool]
wrap_long_lines: Optional[Var[bool]] = None
# A custom style for the code block.
custom_style: Dict[str, str] = {}
# Props passed down to the code tag.
code_tag_props: Var[Dict[str, str]]
code_tag_props: Optional[Var[Dict[str, str]]] = None
def _get_imports(self) -> imports.ImportDict:
merged_imports = super()._get_imports()

View File

@ -116,94 +116,94 @@ class DataEditor(NoSSRComponent):
]
# Number of rows.
rows: Var[int]
rows: Optional[Var[int]] = None
# Headers of the columns for the data grid.
columns: Var[List[Dict[str, Any]]]
columns: Optional[Var[List[Dict[str, Any]]]] = None
# The data.
data: Var[List[List[Any]]]
data: Optional[Var[List[List[Any]]]] = None
# The name of the callback used to find the data to display.
get_cell_content: Var[str]
get_cell_content: Optional[Var[str]] = None
# Allow selection for copying.
get_cell_for_selection: Var[bool]
get_cell_for_selection: Optional[Var[bool]] = None
# Allow paste.
on_paste: Var[bool]
on_paste: Optional[Var[bool]] = None
# Controls the drawing of the focus ring.
draw_focus_ring: Var[bool]
draw_focus_ring: Optional[Var[bool]] = None
# Enables or disables the overlay shadow when scrolling horizontally.
fixed_shadow_x: Var[bool]
fixed_shadow_x: Optional[Var[bool]] = None
# Enables or disables the overlay shadow when scrolling vertically.
fixed_shadow_y: Var[bool]
fixed_shadow_y: Optional[Var[bool]] = None
# The number of columns which should remain in place when scrolling horizontally. Doesn't include rowMarkers.
freeze_columns: Var[int]
freeze_columns: Optional[Var[int]] = None
# Controls the header of the group header row.
group_header_height: Var[int]
group_header_height: Optional[Var[int]] = None
# Controls the height of the header row.
header_height: Var[int]
header_height: Optional[Var[int]] = None
# Additional header icons:
# header_icons: Var[Any] # (TODO: must be a map of name: svg)
# The maximum width a column can be automatically sized to.
max_column_auto_width: Var[int]
max_column_auto_width: Optional[Var[int]] = None
# The maximum width a column can be resized to.
max_column_width: Var[int]
max_column_width: Optional[Var[int]] = None
# The minimum width a column can be resized to.
min_column_width: Var[int]
min_column_width: Optional[Var[int]] = None
# Determins the height of each row.
row_height: Var[int]
row_height: Optional[Var[int]] = None
# Kind of row markers.
row_markers: Var[LiteralRowMarker]
row_markers: Optional[Var[LiteralRowMarker]] = None
# Changes the starting index for row markers.
row_marker_start_index: Var[int]
row_marker_start_index: Optional[Var[int]] = None
# Sets the width of row markers in pixels, if unset row markers will automatically size.
row_marker_width: Var[int]
row_marker_width: Optional[Var[int]] = None
# Enable horizontal smooth scrolling.
smooth_scroll_x: Var[bool]
smooth_scroll_x: Optional[Var[bool]] = None
# Enable vertical smooth scrolling.
smooth_scroll_y: Var[bool]
smooth_scroll_y: Optional[Var[bool]] = None
# Controls the drawing of the left hand vertical border of a column. If set to a boolean value it controls all borders.
vertical_border: Var[bool] # TODO: support a mapping (dict[int, bool])
# Allow columns selections. ("none", "single", "multi")
column_select: Var[Literal["none", "single", "multi"]]
column_select: Optional[Var[Literal["none", "single", "multi"]]] = None
# Prevent diagonal scrolling.
prevent_diagonal_scrolling: Var[bool]
prevent_diagonal_scrolling: Optional[Var[bool]] = None
# Allow to scroll past the limit of the actual content on the horizontal axis.
overscroll_x: Var[int]
overscroll_x: Optional[Var[int]] = None
# Allow to scroll past the limit of the actual content on the vertical axis.
overscroll_y: Var[int]
overscroll_y: Optional[Var[int]] = None
# Initial scroll offset on the horizontal axis.
scroll_offset_x: Var[int]
scroll_offset_x: Optional[Var[int]] = None
# Initial scroll offset on the vertical axis.
scroll_offset_y: Var[int]
scroll_offset_y: Optional[Var[int]] = None
# global theme
theme: Var[Union[DataEditorTheme, Dict]]
theme: Optional[Var[Union[DataEditorTheme, Dict]]] = None
def _get_imports(self):
return imports.merge_imports(

View File

@ -1,4 +1,4 @@
from typing import Union, Optional
from typing import Optional, Union
from reflex.components.el.element import Element
from reflex.vars import Var as Var

View File

@ -1,5 +1,5 @@
"""Element classes. This is an auto-generated file. Do not edit. See ../generate.py."""
from typing import Any, Dict, Union
from typing import Any, Dict, Optional, Union
from reflex.components.el.element import Element
from reflex.constants.event import EventTriggers
@ -14,37 +14,37 @@ class Button(BaseHTML):
tag = "button"
# Automatically focuses the button when the page loads
auto_focus: Var[Union[str, int, bool]]
auto_focus: Optional[Var[Union[str, int, bool]]] = None
# Disables the button
disabled: Var[bool]
disabled: Optional[Var[bool]] = None
# Associates the button with a form (by id)
form: Var[Union[str, int, bool]]
form: Optional[Var[Union[str, int, bool]]] = None
# URL to send the form data to (for type="submit" buttons)
form_action: Var[Union[str, int, bool]]
form_action: Optional[Var[Union[str, int, bool]]] = None
# How the form data should be encoded when submitting to the server (for type="submit" buttons)
form_enc_type: Var[Union[str, int, bool]]
form_enc_type: Optional[Var[Union[str, int, bool]]] = None
# HTTP method to use for sending form data (for type="submit" buttons)
form_method: Var[Union[str, int, bool]]
form_method: Optional[Var[Union[str, int, bool]]] = None
# Bypasses form validation when submitting (for type="submit" buttons)
form_no_validate: Var[Union[str, int, bool]]
form_no_validate: Optional[Var[Union[str, int, bool]]] = None
# Specifies where to display the response after submitting the form (for type="submit" buttons)
form_target: Var[Union[str, int, bool]]
form_target: Optional[Var[Union[str, int, bool]]] = None
# Name of the button, used when sending form data
name: Var[Union[str, int, bool]]
name: Optional[Var[Union[str, int, bool]]] = None
# Type of the button (submit, reset, or button)
type: Var[Union[str, int, bool]]
type: Optional[Var[Union[str, int, bool]]] = None
# Value of the button, used when sending form data
value: Var[Union[str, int, bool]]
value: Optional[Var[Union[str, int, bool]]] = None
class Datalist(BaseHTML):
@ -60,13 +60,13 @@ class Fieldset(Element):
tag = "fieldset"
# Disables all the form control descendants of the fieldset
disabled: Var[Union[str, int, bool]]
disabled: Optional[Var[Union[str, int, bool]]] = None
# Associates the fieldset with a form (by id)
form: Var[Union[str, int, bool]]
form: Optional[Var[Union[str, int, bool]]] = None
# Name of the fieldset, used for scripting
name: Var[Union[str, int, bool]]
name: Optional[Var[Union[str, int, bool]]] = None
class Form(BaseHTML):
@ -75,31 +75,31 @@ class Form(BaseHTML):
tag = "form"
# MIME types the server accepts for file upload
accept: Var[Union[str, int, bool]]
accept: Optional[Var[Union[str, int, bool]]] = None
# Character encodings to be used for form submission
accept_charset: Var[Union[str, int, bool]]
accept_charset: Optional[Var[Union[str, int, bool]]] = None
# URL where the form's data should be submitted
action: Var[Union[str, int, bool]]
action: Optional[Var[Union[str, int, bool]]] = None
# Whether the form should have autocomplete enabled
auto_complete: Var[Union[str, int, bool]]
auto_complete: Optional[Var[Union[str, int, bool]]] = None
# Encoding type for the form data when submitted
enc_type: Var[Union[str, int, bool]]
enc_type: Optional[Var[Union[str, int, bool]]] = None
# HTTP method to use for form submission
method: Var[Union[str, int, bool]]
method: Optional[Var[Union[str, int, bool]]] = None
# Name of the form
name: Var[Union[str, int, bool]]
name: Optional[Var[Union[str, int, bool]]] = None
# Indicates that the form should not be validated on submit
no_validate: Var[Union[str, int, bool]]
no_validate: Optional[Var[Union[str, int, bool]]] = None
# Where to display the response after submitting the form
target: Var[Union[str, int, bool]]
target: Optional[Var[Union[str, int, bool]]] = None
class Input(BaseHTML):
@ -108,103 +108,103 @@ class Input(BaseHTML):
tag = "input"
# Accepted types of files when the input is file type
accept: Var[Union[str, int, bool]]
accept: Optional[Var[Union[str, int, bool]]] = None
# Alternate text for input type="image"
alt: Var[Union[str, int, bool]]
alt: Optional[Var[Union[str, int, bool]]] = None
# Whether the input should have autocomplete enabled
auto_complete: Var[Union[str, int, bool]]
auto_complete: Optional[Var[Union[str, int, bool]]] = None
# Automatically focuses the input when the page loads
auto_focus: Var[Union[str, int, bool]]
auto_focus: Optional[Var[Union[str, int, bool]]] = None
# Captures media from the user (camera or microphone)
capture: Var[Union[str, int, bool]]
capture: Optional[Var[Union[str, int, bool]]] = None
# Indicates whether the input is checked (for checkboxes and radio buttons)
checked: Var[Union[str, int, bool]]
checked: Optional[Var[Union[str, int, bool]]] = None
# The initial value (for checkboxes and radio buttons)
default_checked: Var[bool]
default_checked: Optional[Var[bool]] = None
# The initial value for a text field
default_value: Var[str]
default_value: Optional[Var[str]] = None
# Name part of the input to submit in 'dir' and 'name' pair when form is submitted
dirname: Var[Union[str, int, bool]]
dirname: Optional[Var[Union[str, int, bool]]] = None
# Disables the input
disabled: Var[Union[str, int, bool]]
disabled: Optional[Var[Union[str, int, bool]]] = None
# Associates the input with a form (by id)
form: Var[Union[str, int, bool]]
form: Optional[Var[Union[str, int, bool]]] = None
# URL to send the form data to (for type="submit" buttons)
form_action: Var[Union[str, int, bool]]
form_action: Optional[Var[Union[str, int, bool]]] = None
# How the form data should be encoded when submitting to the server (for type="submit" buttons)
form_enc_type: Var[Union[str, int, bool]]
form_enc_type: Optional[Var[Union[str, int, bool]]] = None
# HTTP method to use for sending form data (for type="submit" buttons)
form_method: Var[Union[str, int, bool]]
form_method: Optional[Var[Union[str, int, bool]]] = None
# Bypasses form validation when submitting (for type="submit" buttons)
form_no_validate: Var[Union[str, int, bool]]
form_no_validate: Optional[Var[Union[str, int, bool]]] = None
# Specifies where to display the response after submitting the form (for type="submit" buttons)
form_target: Var[Union[str, int, bool]]
form_target: Optional[Var[Union[str, int, bool]]] = None
# References a datalist for suggested options
list: Var[Union[str, int, bool]]
list: Optional[Var[Union[str, int, bool]]] = None
# Specifies the maximum value for the input
max: Var[Union[str, int, bool]]
max: Optional[Var[Union[str, int, bool]]] = None
# Specifies the maximum number of characters allowed in the input
max_length: Var[Union[str, int, bool]]
max_length: Optional[Var[Union[str, int, bool]]] = None
# Specifies the minimum number of characters required in the input
min_length: Var[Union[str, int, bool]]
min_length: Optional[Var[Union[str, int, bool]]] = None
# Specifies the minimum value for the input
min: Var[Union[str, int, bool]]
min: Optional[Var[Union[str, int, bool]]] = None
# Indicates whether multiple values can be entered in an input of the type email or file
multiple: Var[Union[str, int, bool]]
multiple: Optional[Var[Union[str, int, bool]]] = None
# Name of the input, used when sending form data
name: Var[Union[str, int, bool]]
name: Optional[Var[Union[str, int, bool]]] = None
# Regex pattern the input's value must match to be valid
pattern: Var[Union[str, int, bool]]
pattern: Optional[Var[Union[str, int, bool]]] = None
# Placeholder text in the input
placeholder: Var[Union[str, int, bool]]
placeholder: Optional[Var[Union[str, int, bool]]] = None
# Indicates whether the input is read-only
read_only: Var[Union[str, int, bool]]
read_only: Optional[Var[Union[str, int, bool]]] = None
# Indicates that the input is required
required: Var[Union[str, int, bool]]
required: Optional[Var[Union[str, int, bool]]] = None
# Specifies the visible width of a text control
size: Var[Union[str, int, bool]]
size: Optional[Var[Union[str, int, bool]]] = None
# URL for image inputs
src: Var[Union[str, int, bool]]
src: Optional[Var[Union[str, int, bool]]] = None
# Specifies the legal number intervals for an input
step: Var[Union[str, int, bool]]
step: Optional[Var[Union[str, int, bool]]] = None
# Specifies the type of input
type: Var[Union[str, int, bool]]
type: Optional[Var[Union[str, int, bool]]] = None
# Name of the image map used with the input
use_map: Var[Union[str, int, bool]]
use_map: Optional[Var[Union[str, int, bool]]] = None
# Value of the input
value: Var[Union[str, int, bool]]
value: Optional[Var[Union[str, int, bool]]] = None
def get_event_triggers(self) -> Dict[str, Any]:
"""Get the event triggers that pass the component's value to the handler.
@ -228,10 +228,10 @@ class Label(BaseHTML):
tag = "label"
# ID of a form control with which the label is associated
html_for: Var[Union[str, int, bool]]
html_for: Optional[Var[Union[str, int, bool]]] = None
# Associates the label with a form (by id)
form: Var[Union[str, int, bool]]
form: Optional[Var[Union[str, int, bool]]] = None
class Legend(BaseHTML):
@ -247,25 +247,25 @@ class Meter(BaseHTML):
tag = "meter"
# Associates the meter with a form (by id)
form: Var[Union[str, int, bool]]
form: Optional[Var[Union[str, int, bool]]] = None
# High limit of range (above this is considered high value)
high: Var[Union[str, int, bool]]
high: Optional[Var[Union[str, int, bool]]] = None
# Low limit of range (below this is considered low value)
low: Var[Union[str, int, bool]]
low: Optional[Var[Union[str, int, bool]]] = None
# Maximum value of the range
max: Var[Union[str, int, bool]]
max: Optional[Var[Union[str, int, bool]]] = None
# Minimum value of the range
min: Var[Union[str, int, bool]]
min: Optional[Var[Union[str, int, bool]]] = None
# Optimum value in the range
optimum: Var[Union[str, int, bool]]
optimum: Optional[Var[Union[str, int, bool]]] = None
# Current value of the meter
value: Var[Union[str, int, bool]]
value: Optional[Var[Union[str, int, bool]]] = None
class Optgroup(BaseHTML):
@ -274,10 +274,10 @@ class Optgroup(BaseHTML):
tag = "optgroup"
# Disables the optgroup
disabled: Var[Union[str, int, bool]]
disabled: Optional[Var[Union[str, int, bool]]] = None
# Label for the optgroup
label: Var[Union[str, int, bool]]
label: Optional[Var[Union[str, int, bool]]] = None
class Option(BaseHTML):
@ -286,16 +286,16 @@ class Option(BaseHTML):
tag = "option"
# Disables the option
disabled: Var[Union[str, int, bool]]
disabled: Optional[Var[Union[str, int, bool]]] = None
# Label for the option, if the text is not the label
label: Var[Union[str, int, bool]]
label: Optional[Var[Union[str, int, bool]]] = None
# Indicates that the option is initially selected
selected: Var[Union[str, int, bool]]
selected: Optional[Var[Union[str, int, bool]]] = None
# Value to be sent as form data
value: Var[Union[str, int, bool]]
value: Optional[Var[Union[str, int, bool]]] = None
class Output(BaseHTML):
@ -304,13 +304,13 @@ class Output(BaseHTML):
tag = "output"
# Associates the output with one or more elements (by their IDs)
html_for: Var[Union[str, int, bool]]
html_for: Optional[Var[Union[str, int, bool]]] = None
# Associates the output with a form (by id)
form: Var[Union[str, int, bool]]
form: Optional[Var[Union[str, int, bool]]] = None
# Name of the output element for form submission
name: Var[Union[str, int, bool]]
name: Optional[Var[Union[str, int, bool]]] = None
class Progress(BaseHTML):
@ -319,13 +319,13 @@ class Progress(BaseHTML):
tag = "progress"
# Associates the progress element with a form (by id)
form: Var[Union[str, int, bool]]
form: Optional[Var[Union[str, int, bool]]] = None
# Maximum value of the progress indicator
max: Var[Union[str, int, bool]]
max: Optional[Var[Union[str, int, bool]]] = None
# Current value of the progress indicator
value: Var[Union[str, int, bool]]
value: Optional[Var[Union[str, int, bool]]] = None
class Select(BaseHTML):
@ -334,28 +334,28 @@ class Select(BaseHTML):
tag = "select"
# Whether the form control should have autocomplete enabled
auto_complete: Var[Union[str, int, bool]]
auto_complete: Optional[Var[Union[str, int, bool]]] = None
# Automatically focuses the select when the page loads
auto_focus: Var[Union[str, int, bool]]
auto_focus: Optional[Var[Union[str, int, bool]]] = None
# Disables the select control
disabled: Var[Union[str, int, bool]]
disabled: Optional[Var[Union[str, int, bool]]] = None
# Associates the select with a form (by id)
form: Var[Union[str, int, bool]]
form: Optional[Var[Union[str, int, bool]]] = None
# Indicates that multiple options can be selected
multiple: Var[Union[str, int, bool]]
multiple: Optional[Var[Union[str, int, bool]]] = None
# Name of the select, used when submitting the form
name: Var[Union[str, int, bool]]
name: Optional[Var[Union[str, int, bool]]] = None
# Indicates that the select control must have a selected option
required: Var[Union[str, int, bool]]
required: Optional[Var[Union[str, int, bool]]] = None
# Number of visible options in a drop-down list
size: Var[Union[str, int, bool]]
size: Optional[Var[Union[str, int, bool]]] = None
def get_event_triggers(self) -> Dict[str, Any]:
"""Get the event triggers that pass the component's value to the handler.
@ -375,49 +375,49 @@ class Textarea(BaseHTML):
tag = "textarea"
# Whether the form control should have autocomplete enabled
auto_complete: Var[Union[str, int, bool]]
auto_complete: Optional[Var[Union[str, int, bool]]] = None
# Automatically focuses the textarea when the page loads
auto_focus: Var[Union[str, int, bool]]
auto_focus: Optional[Var[Union[str, int, bool]]] = None
# Visible width of the text control, in average character widths
cols: Var[Union[str, int, bool]]
cols: Optional[Var[Union[str, int, bool]]] = None
# Name part of the textarea to submit in 'dir' and 'name' pair when form is submitted
dirname: Var[Union[str, int, bool]]
dirname: Optional[Var[Union[str, int, bool]]] = None
# Disables the textarea
disabled: Var[Union[str, int, bool]]
disabled: Optional[Var[Union[str, int, bool]]] = None
# Associates the textarea with a form (by id)
form: Var[Union[str, int, bool]]
form: Optional[Var[Union[str, int, bool]]] = None
# Maximum number of characters allowed in the textarea
max_length: Var[Union[str, int, bool]]
max_length: Optional[Var[Union[str, int, bool]]] = None
# Minimum number of characters required in the textarea
min_length: Var[Union[str, int, bool]]
min_length: Optional[Var[Union[str, int, bool]]] = None
# Name of the textarea, used when submitting the form
name: Var[Union[str, int, bool]]
name: Optional[Var[Union[str, int, bool]]] = None
# Placeholder text in the textarea
placeholder: Var[Union[str, int, bool]]
placeholder: Optional[Var[Union[str, int, bool]]] = None
# Indicates whether the textarea is read-only
read_only: Var[Union[str, int, bool]]
read_only: Optional[Var[Union[str, int, bool]]] = None
# Indicates that the textarea is required
required: Var[Union[str, int, bool]]
required: Optional[Var[Union[str, int, bool]]] = None
# Visible number of lines in the text control
rows: Var[Union[str, int, bool]]
rows: Optional[Var[Union[str, int, bool]]] = None
# The controlled value of the textarea, read only unless used with on_change
value: Var[Union[str, int, bool]]
value: Optional[Var[Union[str, int, bool]]] = None
# How the text in the textarea is to be wrapped when submitting the form
wrap: Var[Union[str, int, bool]]
wrap: Optional[Var[Union[str, int, bool]]] = None
def get_event_triggers(self) -> Dict[str, Any]:
"""Get the event triggers that pass the component's value to the handler.

View File

@ -1,5 +1,5 @@
"""Element classes. This is an auto-generated file. Do not edit. See ../generate.py."""
from typing import Union
from typing import Optional, Union
from reflex.vars import Var
@ -12,31 +12,31 @@ class A(BaseHTML): # Inherits common attributes from BaseMeta
tag = "a"
# Specifies that the target (the file specified in the href attribute) will be downloaded when a user clicks on the hyperlink.
download: Var[Union[str, int, bool]]
download: Optional[Var[Union[str, int, bool]]] = None
# Specifies the URL of the page the link goes to
href: Var[Union[str, int, bool]]
href: Optional[Var[Union[str, int, bool]]] = None
# Specifies the language of the linked document
href_lang: Var[Union[str, int, bool]]
href_lang: Optional[Var[Union[str, int, bool]]] = None
# Specifies what media/device the linked document is optimized for
media: Var[Union[str, int, bool]]
media: Optional[Var[Union[str, int, bool]]] = None
# Specifies which referrer is sent when fetching the resource
ping: Var[Union[str, int, bool]]
ping: Optional[Var[Union[str, int, bool]]] = None
# Specifies the relationship between the current document and the linked document
referrer_policy: Var[Union[str, int, bool]]
referrer_policy: Optional[Var[Union[str, int, bool]]] = None
# Specifies the relationship between the linked document and the current document
rel: Var[Union[str, int, bool]]
rel: Optional[Var[Union[str, int, bool]]] = None
# Specifies the shape of the area
shape: Var[Union[str, int, bool]]
shape: Optional[Var[Union[str, int, bool]]] = None
# Specifies where to open the linked document
target: Var[Union[str, int, bool]]
target: Optional[Var[Union[str, int, bool]]] = None
class Abbr(BaseHTML):
@ -87,7 +87,7 @@ class Data(BaseHTML):
tag = "data"
# Specifies the machine-readable translation of the data element.
value: Var[Union[str, int, bool]]
value: Optional[Var[Union[str, int, bool]]] = None
class Dfn(BaseHTML):
@ -126,7 +126,7 @@ class Q(BaseHTML):
tag = "q"
# Specifies the source URL of the quote.
cite: Var[Union[str, int, bool]]
cite: Optional[Var[Union[str, int, bool]]] = None
class Rp(BaseHTML):
@ -195,7 +195,7 @@ class Time(BaseHTML):
tag = "time"
# Specifies the date and/or time of the element.
date_time: Var[Union[str, int, bool]]
date_time: Optional[Var[Union[str, int, bool]]] = None
class U(BaseHTML):

View File

@ -1,5 +1,5 @@
"""Element classes. This is an auto-generated file. Do not edit. See ../generate.py."""
from typing import Any, Union
from typing import Any, Optional, Union
from reflex.vars import Var as Var
@ -12,37 +12,37 @@ class Area(BaseHTML):
tag = "area"
# Alternate text for the area, used for accessibility
alt: Var[Union[str, int, bool]]
alt: Optional[Var[Union[str, int, bool]]] = None
# Coordinates to define the shape of the area
coords: Var[Union[str, int, bool]]
coords: Optional[Var[Union[str, int, bool]]] = None
# Specifies that the target will be downloaded when clicked
download: Var[Union[str, int, bool]]
download: Optional[Var[Union[str, int, bool]]] = None
# Hyperlink reference for the area
href: Var[Union[str, int, bool]]
href: Optional[Var[Union[str, int, bool]]] = None
# Language of the linked resource
href_lang: Var[Union[str, int, bool]]
href_lang: Optional[Var[Union[str, int, bool]]] = None
# Specifies what media/device the linked resource is optimized for
media: Var[Union[str, int, bool]]
media: Optional[Var[Union[str, int, bool]]] = None
# A list of URLs to be notified if the user follows the hyperlink
ping: Var[Union[str, int, bool]]
ping: Optional[Var[Union[str, int, bool]]] = None
# Specifies which referrer information to send with the link
referrer_policy: Var[Union[str, int, bool]]
referrer_policy: Optional[Var[Union[str, int, bool]]] = None
# Specifies the relationship of the target object to the link object
rel: Var[Union[str, int, bool]]
rel: Optional[Var[Union[str, int, bool]]] = None
# Defines the shape of the area (rectangle, circle, polygon)
shape: Var[Union[str, int, bool]]
shape: Optional[Var[Union[str, int, bool]]] = None
# Specifies where to open the linked document
target: Var[Union[str, int, bool]]
target: Optional[Var[Union[str, int, bool]]] = None
class Audio(BaseHTML):
@ -51,28 +51,28 @@ class Audio(BaseHTML):
tag = "audio"
# Specifies that the audio will start playing as soon as it is ready
auto_play: Var[Union[str, int, bool]]
auto_play: Optional[Var[Union[str, int, bool]]] = None
# Represents the time range of the buffered media
buffered: Var[Union[str, int, bool]]
buffered: Optional[Var[Union[str, int, bool]]] = None
# Displays the standard audio controls
controls: Var[Union[str, int, bool]]
controls: Optional[Var[Union[str, int, bool]]] = None
# Configures the CORS requests for the element
cross_origin: Var[Union[str, int, bool]]
cross_origin: Optional[Var[Union[str, int, bool]]] = None
# Specifies that the audio will loop
loop: Var[Union[str, int, bool]]
loop: Optional[Var[Union[str, int, bool]]] = None
# Indicates whether the audio is muted by default
muted: Var[Union[str, int, bool]]
muted: Optional[Var[Union[str, int, bool]]] = None
# Specifies how the audio file should be preloaded
preload: Var[Union[str, int, bool]]
preload: Optional[Var[Union[str, int, bool]]] = None
# URL of the audio to play
src: Var[Union[str, int, bool]]
src: Optional[Var[Union[str, int, bool]]] = None
class Img(BaseHTML):
@ -81,40 +81,40 @@ class Img(BaseHTML):
tag = "img"
# Image alignment with respect to its surrounding elements
align: Var[Union[str, int, bool]]
align: Optional[Var[Union[str, int, bool]]] = None
# Alternative text for the image
alt: Var[Union[str, int, bool]]
alt: Optional[Var[Union[str, int, bool]]] = None
# Configures the CORS requests for the image
cross_origin: Var[Union[str, int, bool]]
cross_origin: Optional[Var[Union[str, int, bool]]] = None
# How the image should be decoded
decoding: Var[Union[str, int, bool]]
decoding: Optional[Var[Union[str, int, bool]]] = None
# Specifies an intrinsic size for the image
intrinsicsize: Var[Union[str, int, bool]]
intrinsicsize: Optional[Var[Union[str, int, bool]]] = None
# Whether the image is a server-side image map
ismap: Var[Union[str, int, bool]]
ismap: Optional[Var[Union[str, int, bool]]] = None
# Specifies the loading behavior of the image
loading: Var[Union[str, int, bool]]
loading: Optional[Var[Union[str, int, bool]]] = None
# Referrer policy for the image
referrer_policy: Var[Union[str, int, bool]]
referrer_policy: Optional[Var[Union[str, int, bool]]] = None
# Sizes of the image for different layouts
sizes: Var[Union[str, int, bool]]
sizes: Optional[Var[Union[str, int, bool]]] = None
# URL of the image to display
src: Var[Any]
src: Optional[Var[Any]] = None
# A set of source sizes and URLs for responsive images
src_set: Var[Union[str, int, bool]]
src_set: Optional[Var[Union[str, int, bool]]] = None
# The name of the map to use with the image
use_map: Var[Union[str, int, bool]]
use_map: Optional[Var[Union[str, int, bool]]] = None
class Map(BaseHTML):
@ -123,7 +123,7 @@ class Map(BaseHTML):
tag = "map"
# Name of the map, referenced by the 'usemap' attribute in 'img' and 'object' elements
name: Var[Union[str, int, bool]]
name: Optional[Var[Union[str, int, bool]]] = None
class Track(BaseHTML):
@ -132,19 +132,19 @@ class Track(BaseHTML):
tag = "track"
# Indicates that the track should be enabled unless the user's preferences indicate otherwise
default: Var[Union[str, int, bool]]
default: Optional[Var[Union[str, int, bool]]] = None
# Specifies the kind of text track
kind: Var[Union[str, int, bool]]
kind: Optional[Var[Union[str, int, bool]]] = None
# Title of the text track, used by the browser when listing available text tracks
label: Var[Union[str, int, bool]]
label: Optional[Var[Union[str, int, bool]]] = None
# URL of the track file
src: Var[Union[str, int, bool]]
src: Optional[Var[Union[str, int, bool]]] = None
# Language of the track text data
src_lang: Var[Union[str, int, bool]]
src_lang: Optional[Var[Union[str, int, bool]]] = None
class Video(BaseHTML):
@ -153,34 +153,34 @@ class Video(BaseHTML):
tag = "video"
# Specifies that the video will start playing as soon as it is ready
auto_play: Var[Union[str, int, bool]]
auto_play: Optional[Var[Union[str, int, bool]]] = None
# Represents the time range of the buffered media
buffered: Var[Union[str, int, bool]]
buffered: Optional[Var[Union[str, int, bool]]] = None
# Displays the standard video controls
controls: Var[Union[str, int, bool]]
controls: Optional[Var[Union[str, int, bool]]] = None
# Configures the CORS requests for the video
cross_origin: Var[Union[str, int, bool]]
cross_origin: Optional[Var[Union[str, int, bool]]] = None
# Specifies that the video will loop
loop: Var[Union[str, int, bool]]
loop: Optional[Var[Union[str, int, bool]]] = None
# Indicates whether the video is muted by default
muted: Var[Union[str, int, bool]]
muted: Optional[Var[Union[str, int, bool]]] = None
# Indicates that the video should play 'inline', inside its element's playback area
plays_inline: Var[Union[str, int, bool]]
plays_inline: Optional[Var[Union[str, int, bool]]] = None
# URL of an image to show while the video is downloading, or until the user hits the play button
poster: Var[Union[str, int, bool]]
poster: Optional[Var[Union[str, int, bool]]] = None
# Specifies how the video file should be preloaded
preload: Var[Union[str, int, bool]]
preload: Optional[Var[Union[str, int, bool]]] = None
# URL of the video to play
src: Var[Union[str, int, bool]]
src: Optional[Var[Union[str, int, bool]]] = None
class Embed(BaseHTML):
@ -189,10 +189,10 @@ class Embed(BaseHTML):
tag = "embed"
# URL of the embedded content
src: Var[Union[str, int, bool]]
src: Optional[Var[Union[str, int, bool]]] = None
# Media type of the embedded content
type: Var[Union[str, int, bool]]
type: Optional[Var[Union[str, int, bool]]] = None
class Iframe(BaseHTML):
@ -201,31 +201,31 @@ class Iframe(BaseHTML):
tag = "iframe"
# Alignment of the iframe within the page or surrounding elements
align: Var[Union[str, int, bool]]
align: Optional[Var[Union[str, int, bool]]] = None
# Permissions policy for the iframe
allow: Var[Union[str, int, bool]]
allow: Optional[Var[Union[str, int, bool]]] = None
# Content Security Policy to apply to the iframe's content
csp: Var[Union[str, int, bool]]
csp: Optional[Var[Union[str, int, bool]]] = None
# Specifies the loading behavior of the iframe
loading: Var[Union[str, int, bool]]
loading: Optional[Var[Union[str, int, bool]]] = None
# Name of the iframe, used as a target for hyperlinks and forms
name: Var[Union[str, int, bool]]
name: Optional[Var[Union[str, int, bool]]] = None
# Referrer policy for the iframe
referrer_policy: Var[Union[str, int, bool]]
referrer_policy: Optional[Var[Union[str, int, bool]]] = None
# Security restrictions for the content in the iframe
sandbox: Var[Union[str, int, bool]]
sandbox: Optional[Var[Union[str, int, bool]]] = None
# URL of the document to display in the iframe
src: Var[Union[str, int, bool]]
src: Optional[Var[Union[str, int, bool]]] = None
# HTML content to embed directly within the iframe
src_doc: Var[Union[str, int, bool]]
src_doc: Optional[Var[Union[str, int, bool]]] = None
class Object(BaseHTML):
@ -234,19 +234,19 @@ class Object(BaseHTML):
tag = "object"
# URL of the data to be used by the object
data: Var[Union[str, int, bool]]
data: Optional[Var[Union[str, int, bool]]] = None
# Associates the object with a form element
form: Var[Union[str, int, bool]]
form: Optional[Var[Union[str, int, bool]]] = None
# Name of the object, used for scripting or as a target for forms and links
name: Var[Union[str, int, bool]]
name: Optional[Var[Union[str, int, bool]]] = None
# Media type of the data specified in the data attribute
type: Var[Union[str, int, bool]]
type: Optional[Var[Union[str, int, bool]]] = None
# Name of an image map to use with the object
use_map: Var[Union[str, int, bool]]
use_map: Optional[Var[Union[str, int, bool]]] = None
class Picture(BaseHTML):
@ -269,19 +269,19 @@ class Source(BaseHTML):
tag = "source"
# Media query indicating what device the linked resource is optimized for
media: Var[Union[str, int, bool]]
media: Optional[Var[Union[str, int, bool]]] = None
# Sizes of the source for different layouts
sizes: Var[Union[str, int, bool]]
sizes: Optional[Var[Union[str, int, bool]]] = None
# URL of the media file or an image for the element to use
src: Var[Union[str, int, bool]]
src: Optional[Var[Union[str, int, bool]]] = None
# A set of source sizes and URLs for responsive images
src_set: Var[Union[str, int, bool]]
src_set: Optional[Var[Union[str, int, bool]]] = None
# Media type of the source
type: Var[Union[str, int, bool]]
type: Optional[Var[Union[str, int, bool]]] = None
class Svg(BaseHTML):
@ -296,4 +296,4 @@ class Path(BaseHTML):
tag = "path"
# Defines the shape of the path
d: Var[Union[str, int, bool]]
d: Optional[Var[Union[str, int, bool]]] = None

View File

@ -1,5 +1,5 @@
"""Element classes. This is an auto-generated file. Do not edit. See ../generate.py."""
from typing import Union
from typing import Optional, Union
from reflex.components.el.element import Element
from reflex.vars import Var as Var
@ -13,8 +13,8 @@ class Base(BaseHTML): # noqa: E742
tag = "base"
tag = "base"
href: Var[Union[str, int, bool]]
target: Var[Union[str, int, bool]]
href: Optional[Var[Union[str, int, bool]]] = None
target: Optional[Var[Union[str, int, bool]]] = None
class Head(BaseHTML): # noqa: E742
@ -28,25 +28,25 @@ class Link(BaseHTML): # noqa: E742
tag = "link"
cross_origin: Var[Union[str, int, bool]]
href: Var[Union[str, int, bool]]
href_lang: Var[Union[str, int, bool]]
integrity: Var[Union[str, int, bool]]
media: Var[Union[str, int, bool]]
referrer_policy: Var[Union[str, int, bool]]
rel: Var[Union[str, int, bool]]
sizes: Var[Union[str, int, bool]]
type: Var[Union[str, int, bool]]
cross_origin: Optional[Var[Union[str, int, bool]]] = None
href: Optional[Var[Union[str, int, bool]]] = None
href_lang: Optional[Var[Union[str, int, bool]]] = None
integrity: Optional[Var[Union[str, int, bool]]] = None
media: Optional[Var[Union[str, int, bool]]] = None
referrer_policy: Optional[Var[Union[str, int, bool]]] = None
rel: Optional[Var[Union[str, int, bool]]] = None
sizes: Optional[Var[Union[str, int, bool]]] = None
type: Optional[Var[Union[str, int, bool]]] = None
class Meta(BaseHTML): # Inherits common attributes from BaseHTML
"""Display the meta element."""
tag = "meta"
char_set: Var[Union[str, int, bool]]
content: Var[Union[str, int, bool]]
http_equiv: Var[Union[str, int, bool]]
name: Var[Union[str, int, bool]]
char_set: Optional[Var[Union[str, int, bool]]] = None
content: Optional[Var[Union[str, int, bool]]] = None
http_equiv: Optional[Var[Union[str, int, bool]]] = None
name: Optional[Var[Union[str, int, bool]]] = None
class Title(Element): # noqa: E742

View File

@ -1,5 +1,5 @@
"""Element classes. This is an auto-generated file. Do not edit. See ../generate.py."""
from typing import Union
from typing import Optional, Union
from reflex.vars import Var as Var
@ -12,7 +12,7 @@ class Details(BaseHTML):
tag = "details"
# Indicates whether the details will be visible (expanded) to the user
open: Var[Union[str, int, bool]]
open: Optional[Var[Union[str, int, bool]]] = None
class Dialog(BaseHTML):
@ -21,7 +21,7 @@ class Dialog(BaseHTML):
tag = "dialog"
# Indicates whether the dialog is active and can be interacted with
open: Var[Union[str, int, bool]]
open: Optional[Var[Union[str, int, bool]]] = None
class Summary(BaseHTML):
@ -58,4 +58,4 @@ class Html(BaseHTML):
tag = "html"
# Specifies the URL of the document's cache manifest (obsolete in HTML5)
manifest: Var[Union[str, int, bool]]
manifest: Optional[Var[Union[str, int, bool]]] = None

View File

@ -1,5 +1,5 @@
"""Element classes. This is an auto-generated file. Do not edit. See ../generate.py."""
from typing import Union
from typing import Optional, Union
from reflex.vars import Var as Var
@ -25,28 +25,28 @@ class Script(BaseHTML):
tag = "script"
# Indicates that the script should be executed asynchronously
async_: Var[Union[str, int, bool]]
async_: Optional[Var[Union[str, int, bool]]] = None
# Character encoding of the external script
char_set: Var[Union[str, int, bool]]
char_set: Optional[Var[Union[str, int, bool]]] = None
# Configures the CORS requests for the script
cross_origin: Var[Union[str, int, bool]]
cross_origin: Optional[Var[Union[str, int, bool]]] = None
# Indicates that the script should be executed after the page has finished parsing
defer: Var[Union[str, int, bool]]
defer: Optional[Var[Union[str, int, bool]]] = None
# Security feature allowing browsers to verify what they fetch
integrity: Var[Union[str, int, bool]]
integrity: Optional[Var[Union[str, int, bool]]] = None
# Specifies the scripting language used in the type attribute
language: Var[Union[str, int, bool]]
language: Optional[Var[Union[str, int, bool]]] = None
# Specifies which referrer information to send when fetching the script
referrer_policy: Var[Union[str, int, bool]]
referrer_policy: Optional[Var[Union[str, int, bool]]] = None
# URL of an external script
src: Var[Union[str, int, bool]]
src: Optional[Var[Union[str, int, bool]]] = None
# Specifies the MIME type of the script
type: Var[Union[str, int, bool]]
type: Optional[Var[Union[str, int, bool]]] = None

View File

@ -1,5 +1,5 @@
"""Element classes. This is an auto-generated file. Do not edit. See ../generate.py."""
from typing import Union
from typing import Optional, Union
from reflex.vars import Var as Var
@ -12,7 +12,7 @@ class Caption(BaseHTML):
tag = "caption"
# Alignment of the caption
align: Var[Union[str, int, bool]]
align: Optional[Var[Union[str, int, bool]]] = None
class Col(BaseHTML):
@ -21,10 +21,10 @@ class Col(BaseHTML):
tag = "col"
# Alignment of the content within the column
align: Var[Union[str, int, bool]]
align: Optional[Var[Union[str, int, bool]]] = None
# Number of columns the col element spans
span: Var[Union[str, int, bool]]
span: Optional[Var[Union[str, int, bool]]] = None
class Colgroup(BaseHTML):
@ -33,10 +33,10 @@ class Colgroup(BaseHTML):
tag = "colgroup"
# Alignment of the content within the column group
align: Var[Union[str, int, bool]]
align: Optional[Var[Union[str, int, bool]]] = None
# Number of columns the colgroup element spans
span: Var[Union[str, int, bool]]
span: Optional[Var[Union[str, int, bool]]] = None
class Table(BaseHTML):
@ -45,10 +45,10 @@ class Table(BaseHTML):
tag = "table"
# Alignment of the table
align: Var[Union[str, int, bool]]
align: Optional[Var[Union[str, int, bool]]] = None
# Provides a summary of the table's purpose and structure
summary: Var[Union[str, int, bool]]
summary: Optional[Var[Union[str, int, bool]]] = None
class Tbody(BaseHTML):
@ -57,7 +57,7 @@ class Tbody(BaseHTML):
tag = "tbody"
# Alignment of the content within the table body
align: Var[Union[str, int, bool]]
align: Optional[Var[Union[str, int, bool]]] = None
class Td(BaseHTML):
@ -66,16 +66,16 @@ class Td(BaseHTML):
tag = "td"
# Alignment of the content within the table cell
align: Var[Union[str, int, bool]]
align: Optional[Var[Union[str, int, bool]]] = None
# Number of columns a cell should span
col_span: Var[Union[str, int, bool]]
col_span: Optional[Var[Union[str, int, bool]]] = None
# IDs of the headers associated with this cell
headers: Var[Union[str, int, bool]]
headers: Optional[Var[Union[str, int, bool]]] = None
# Number of rows a cell should span
row_span: Var[Union[str, int, bool]]
row_span: Optional[Var[Union[str, int, bool]]] = None
class Tfoot(BaseHTML):
@ -84,7 +84,7 @@ class Tfoot(BaseHTML):
tag = "tfoot"
# Alignment of the content within the table footer
align: Var[Union[str, int, bool]]
align: Optional[Var[Union[str, int, bool]]] = None
class Th(BaseHTML):
@ -93,19 +93,19 @@ class Th(BaseHTML):
tag = "th"
# Alignment of the content within the table header cell
align: Var[Union[str, int, bool]]
align: Optional[Var[Union[str, int, bool]]] = None
# Number of columns a header cell should span
col_span: Var[Union[str, int, bool]]
col_span: Optional[Var[Union[str, int, bool]]] = None
# IDs of the headers associated with this header cell
headers: Var[Union[str, int, bool]]
headers: Optional[Var[Union[str, int, bool]]] = None
# Number of rows a header cell should span
row_span: Var[Union[str, int, bool]]
row_span: Optional[Var[Union[str, int, bool]]] = None
# Scope of the header cell (row, col, rowgroup, colgroup)
scope: Var[Union[str, int, bool]]
scope: Optional[Var[Union[str, int, bool]]] = None
class Thead(BaseHTML):
@ -114,7 +114,7 @@ class Thead(BaseHTML):
tag = "thead"
# Alignment of the content within the table header
align: Var[Union[str, int, bool]]
align: Optional[Var[Union[str, int, bool]]] = None
class Tr(BaseHTML):
@ -123,4 +123,4 @@ class Tr(BaseHTML):
tag = "tr"
# Alignment of the content within the table row
align: Var[Union[str, int, bool]]
align: Optional[Var[Union[str, int, bool]]] = None

View File

@ -1,5 +1,5 @@
"""Element classes. This is an auto-generated file. Do not edit. See ../generate.py."""
from typing import Union
from typing import Optional, Union
from reflex.vars import Var as Var
@ -12,7 +12,7 @@ class Blockquote(BaseHTML):
tag = "blockquote"
# Define the title of a work.
cite: Var[Union[str, int, bool]]
cite: Optional[Var[Union[str, int, bool]]] = None
class Dd(BaseHTML):
@ -51,7 +51,7 @@ class Hr(BaseHTML):
tag = "hr"
# Used to specify the alignment of text content of The Element. this attribute is used in all elements.
align: Var[Union[str, int, bool]]
align: Optional[Var[Union[str, int, bool]]] = None
class Li(BaseHTML):
@ -66,7 +66,7 @@ class Menu(BaseHTML):
tag = "menu"
# Specifies that the menu element is a context menu.
type: Var[Union[str, int, bool]]
type: Optional[Var[Union[str, int, bool]]] = None
class Ol(BaseHTML):
@ -75,13 +75,13 @@ class Ol(BaseHTML):
tag = "ol"
# Reverses the order of the list.
reversed: Var[Union[str, int, bool]]
reversed: Optional[Var[Union[str, int, bool]]] = None
# Specifies the start value of the first list item in an ordered list.
start: Var[Union[str, int, bool]]
start: Optional[Var[Union[str, int, bool]]] = None
# Specifies the kind of marker to use in the list (letters or numbers).
type: Var[Union[str, int, bool]]
type: Optional[Var[Union[str, int, bool]]] = None
class P(BaseHTML):
@ -108,10 +108,10 @@ class Ins(BaseHTML):
tag = "ins"
# Specifies the URL of the document that explains the reason why the text was inserted/changed.
cite: Var[Union[str, int, bool]]
cite: Optional[Var[Union[str, int, bool]]] = None
# Specifies the date and time of when the text was inserted/changed.
date_time: Var[Union[str, int, bool]]
date_time: Optional[Var[Union[str, int, bool]]] = None
class Del(BaseHTML):
@ -120,7 +120,7 @@ class Del(BaseHTML):
tag = "del"
# Specifies the URL of the document that explains the reason why the text was deleted.
cite: Var[Union[str, int, bool]]
cite: Optional[Var[Union[str, int, bool]]] = None
# Specifies the date and time of when the text was deleted.
date_time: Var[Union[str, int, bool]]
date_time: Optional[Var[Union[str, int, bool]]] = None

View File

@ -1,8 +1,7 @@
"""Table components."""
from __future__ import annotations
from typing import Any, Dict, List, Union
from typing import Any, Dict, List, Optional, Union
from reflex.components.component import Component
from reflex.components.tags import Tag
@ -31,19 +30,19 @@ class DataTable(Gridjs):
# The list of columns to display. Required if data is a list and should not be provided
# if the data field is a dataframe
columns: Var[List]
columns: Optional[Var[List]] = None
# Enable a search bar.
search: Var[bool]
search: Optional[Var[bool]] = None
# Enable sorting on columns.
sort: Var[bool]
sort: Optional[Var[bool]] = None
# Enable resizable columns.
resizable: Var[bool]
resizable: Optional[Var[bool]] = None
# Enable pagination.
pagination: Var[Union[bool, Dict]]
pagination: Optional[Var[Union[bool, Dict]]] = None
@classmethod
def create(cls, *children, **props):

View File

@ -1,5 +1,4 @@
"""Moment component for humanized date rendering."""
from typing import Any, Dict, List, Optional
from reflex.base import Base
@ -31,64 +30,64 @@ class Moment(NoSSRComponent):
lib_dependencies: List[str] = ["moment"]
# How often the date update (how often time update / 0 to disable).
interval: Var[int]
interval: Optional[Var[int]] = None
# Formats the date according to the given format string.
format: Var[str]
format: Optional[Var[str]] = None
# When formatting duration time, the largest-magnitude tokens are automatically trimmed when they have no value.
trim: Var[bool]
trim: Optional[Var[bool]] = None
# Use the parse attribute to tell moment how to parse the given date when non-standard.
parse: Var[str]
parse: Optional[Var[str]] = None
# Add a delta to the base date (keys are "years", "quarters", "months", "weeks", "days", "hours", "minutes", "seconds")
add: Var[MomentDelta]
add: Optional[Var[MomentDelta]] = None
# Subtract a delta to the base date (keys are "years", "quarters", "months", "weeks", "days", "hours", "minutes", "seconds")
subtract: Var[MomentDelta]
subtract: Optional[Var[MomentDelta]] = None
# Displays the date as the time from now, e.g. "5 minutes ago".
from_now: Var[bool]
from_now: Optional[Var[bool]] = None
# Setting fromNowDuring will display the relative time as with fromNow but just during its value in milliseconds, after that format will be used instead.
from_now_during: Var[int]
from_now_during: Optional[Var[int]] = None
# Similar to fromNow, but gives the opposite interval.
to_now: Var[bool]
to_now: Optional[Var[bool]] = None
# Adds a title attribute to the element with the complete date.
with_title: Var[bool]
with_title: Optional[Var[bool]] = None
# How the title date is formatted when using the withTitle attribute.
title_format: Var[str]
title_format: Optional[Var[str]] = None
# Show the different between this date and the rendered child.
diff: Var[str]
diff: Optional[Var[str]] = None
# Display the diff as decimal.
decimal: Var[bool]
decimal: Optional[Var[bool]] = None
# Display the diff in given unit.
unit: Var[str]
unit: Optional[Var[str]] = None
# Shows the duration (elapsed time) between two dates. duration property should be behind date property time-wise.
duration: Var[str]
duration: Optional[Var[str]] = None
# The date to display (also work if passed as children).
date: Var[str]
date: Optional[Var[str]] = None
# Shows the duration (elapsed time) between now and the provided datetime.
duration_from_now: Var[bool]
duration_from_now: Optional[Var[bool]] = None
# Tells Moment to parse the given date value as a unix timestamp.
unix: Var[bool]
unix: Optional[Var[bool]] = None
# Outputs the result in local time.
local: Var[bool]
local: Optional[Var[bool]] = None
# Display the date in the given timezone.
tz: Var[str]
tz: Optional[Var[str]] = None
def _get_imports(self) -> imports.ImportDict:
merged_imports = super()._get_imports()

View File

@ -1,5 +1,4 @@
"""Image component from next/image."""
from typing import Any, Dict, Literal, Optional, Union
from reflex.utils import types
@ -16,43 +15,43 @@ class Image(NextComponent):
is_default = True
# This can be either an absolute external URL, or an internal path
src: Var[Any]
src: Optional[Var[Any]] = None
# Represents the rendered width in pixels, so it will affect how large the image appears.
width: Var[Any]
width: Optional[Var[Any]] = None
# Represents the rendered height in pixels, so it will affect how large the image appears.
height: Var[Any]
height: Optional[Var[Any]] = None
# Used to describe the image for screen readers and search engines.
alt: Var[str]
alt: Optional[Var[str]] = None
# A custom function used to resolve image URLs.
loader: Var[Any]
loader: Optional[Var[Any]] = None
# A boolean that causes the image to fill the parent element, which is useful when the width and height are unknown. Default to True
fill: Var[bool]
fill: Optional[Var[bool]] = None
# A string, similar to a media query, that provides information about how wide the image will be at different breakpoints.
sizes: Var[str]
sizes: Optional[Var[str]] = None
# The quality of the optimized image, an integer between 1 and 100, where 100 is the best quality and therefore largest file size. Defaults to 75.
quality: Var[int]
quality: Optional[Var[int]] = None
# When true, the image will be considered high priority and preload. Lazy loading is automatically disabled for images using priority.
priority: Var[bool]
priority: Optional[Var[bool]] = None
# A placeholder to use while the image is loading. Possible values are blur, empty, or data:image/.... Defaults to empty.
placeholder: Var[str]
placeholder: Optional[Var[str]] = None
# Allows passing CSS styles to the underlying image element.
# style: Var[Any]
# style: Optional[Var[Any]] = None
# The loading behavior of the image. Defaults to lazy. Can hurt performance, recommended to use `priority` instead.
loading: Var[Literal["lazy", "eager"]]
loading: Optional[Var[Literal["lazy", "eager"]]] = None
# A Data URL to be used as a placeholder image before the src image successfully loads. Only takes effect when combined with placeholder="blur".
blurDataURL: Var[str]
blurDataURL: Optional[Var[str]] = None
def get_event_triggers(self) -> Dict[str, Any]:
"""The event triggers of the component.

View File

@ -1,5 +1,4 @@
"""Wrapping of the next-video component."""
from typing import Optional
from reflex.components.component import Component
@ -15,7 +14,7 @@ class Video(NextComponent):
library = "next-video"
is_default = True
# the URL
src: Var[str]
src: Optional[Var[str]] = None
as_: Optional[Component]

View File

@ -1,6 +1,5 @@
"""Component for displaying a plotly graph."""
from typing import Any, Dict, List
from typing import Any, Dict, List, Optional
from reflex.components.component import NoSSRComponent
from reflex.vars import Var
@ -27,19 +26,19 @@ class Plotly(PlotlyLib):
is_default = True
# The figure to display. This can be a plotly figure or a plotly data json.
data: Var[Figure]
data: Optional[Var[Figure]] = None
# The layout of the graph.
layout: Var[Dict]
layout: Optional[Var[Dict]] = None
# The config of the graph.
config: Var[Dict]
config: Optional[Var[Dict]] = None
# The width of the graph.
width: Var[str]
width: Optional[Var[str]] = None
# The height of the graph.
height: Var[str]
height: Optional[Var[str]] = None
# If true, the graph will resize when the window is resized.
use_resize_handler: Var[bool]
use_resize_handler: Optional[Var[bool]] = None

View File

@ -1,5 +1,4 @@
"""Radix accordion components."""
from __future__ import annotations
from typing import Any, Dict, List, Literal, Optional, Union
@ -311,25 +310,25 @@ class AccordionRoot(AccordionComponent):
alias = "RadixAccordionRoot"
# The type of accordion (single or multiple).
type: Var[LiteralAccordionType]
type: Optional[Var[LiteralAccordionType]] = None
# The value of the item to expand.
value: Var[Optional[Union[str, List[str]]]]
value: Optional[Var[Optional[Union[str, List[str]]]]] = None
# The default value of the item to expand.
default_value: Var[Optional[Union[str, List[str]]]]
default_value: Optional[Var[Optional[Union[str, List[str]]]]] = None
# Whether or not the accordion is collapsible.
collapsible: Var[bool]
collapsible: Optional[Var[bool]] = None
# Whether or not the accordion is disabled.
disabled: Var[bool]
disabled: Optional[Var[bool]] = None
# The reading direction of the accordion when applicable.
dir: Var[LiteralAccordionDir]
dir: Optional[Var[LiteralAccordionDir]] = None
# The orientation of the accordion.
orientation: Var[LiteralAccordionOrientation]
orientation: Optional[Var[LiteralAccordionOrientation]] = None
# The variant of the accordion.
variant: Var[LiteralAccordionRootVariant] = "classic" # type: ignore
@ -475,10 +474,10 @@ class AccordionItem(AccordionComponent):
alias = "RadixAccordionItem"
# A unique identifier for the item.
value: Var[str]
value: Optional[Var[str]] = None
# When true, prevents the user from interacting with the item.
disabled: Var[bool]
disabled: Optional[Var[bool]] = None
_valid_children: List[str] = [
"AccordionHeader",

View File

@ -1,5 +1,5 @@
"""The base component for Radix primitives."""
from typing import List
from typing import List, Optional
from reflex.components.component import Component
from reflex.components.tags.tag import Tag
@ -11,7 +11,7 @@ class RadixPrimitiveComponent(Component):
"""Basic component for radix Primitives."""
# Change the default rendered element for the one passed as a child.
as_child: Var[bool]
as_child: Optional[Var[bool]] = None
lib_dependencies: List[str] = ["@emotion/react@^11.11.1"]

View File

@ -32,31 +32,31 @@ class DrawerRoot(DrawerComponent):
alias = "Vaul" + tag
# Whether the drawer is open or not.
open: Var[bool]
open: Optional[Var[bool]] = None
# Enable background scaling, it requires an element with [vaul-drawer-wrapper] data attribute to scale its background.
should_scale_background: Var[bool]
should_scale_background: Optional[Var[bool]] = None
# Number between 0 and 1 that determines when the drawer should be closed.
close_threshold: Var[float]
close_threshold: Optional[Var[float]] = None
# Array of numbers from 0 to 100 that corresponds to % of the screen a given snap point should take up. Should go from least visible. Also Accept px values, which doesn't take screen height into account.
snap_points: Optional[List[Union[str, float]]]
# Index of a snapPoint from which the overlay fade should be applied. Defaults to the last snap point.
fade_from_index: Var[int]
fade_from_index: Optional[Var[int]] = None
# Duration for which the drawer is not draggable after scrolling content inside of the drawer. Defaults to 500ms
scroll_lock_timeout: Var[int]
scroll_lock_timeout: Optional[Var[int]] = None
# When `False`, it allows to interact with elements outside of the drawer without closing it. Defaults to `True`.
modal: Var[bool]
modal: Optional[Var[bool]] = None
# Direction of the drawer. Defaults to `"bottom"`
direction: Var[LiteralDirectionType]
direction: Optional[Var[LiteralDirectionType]] = None
# When `True`, it prevents scroll restoration. Defaults to `True`.
preventScrollRestoration: Var[bool]
preventScrollRestoration: Optional[Var[bool]] = None
def get_event_triggers(self) -> Dict[str, Any]:
"""Get the event triggers that pass the component's value to the handler.

View File

@ -1,9 +1,8 @@
"""Radix form component."""
from __future__ import annotations
from hashlib import md5
from typing import Any, Dict, Iterator, Literal
from typing import Any, Dict, Iterator, Literal, Optional
from jinja2 import Environment
@ -54,7 +53,7 @@ class FormRoot(FormComponent):
reset_on_submit: Var[bool] = False # type: ignore
# The name used to make this form's submit handler function unique.
handle_submit_unique_name: Var[str]
handle_submit_unique_name: Optional[Var[str]] = None
def get_event_triggers(self) -> Dict[str, Any]:
"""Event triggers for radix form root.
@ -173,10 +172,10 @@ class FormField(FormComponent):
alias = "RadixFormField"
# The name of the form field, that is passed down to the control and used to match with validation messages.
name: Var[str]
name: Optional[Var[str]] = None
# Flag to mark the form field as invalid, for server side validation.
server_invalid: Var[bool]
server_invalid: Optional[Var[bool]] = None
def _apply_theme(self, theme: Component):
return {
@ -258,13 +257,13 @@ class FormMessage(FormComponent):
alias = "RadixFormMessage"
# Used to target a specific field by name when rendering outside of a Field part.
name: Var[str]
name: Optional[Var[str]] = None
# Used to indicate on which condition the message should be visible.
match: Var[LiteralMatcher]
match: Optional[Var[LiteralMatcher]] = None
# Forces the message to be shown. This is useful when using server-side validation.
force_match: Var[bool]
force_match: Optional[Var[bool]] = None
def _apply_theme(self, theme: Component):
return {

View File

@ -1,5 +1,4 @@
"""Progress."""
from __future__ import annotations
from typing import Optional
@ -26,7 +25,7 @@ class ProgressRoot(ProgressComponent):
alias = "RadixProgressRoot"
# Override theme radius for progress bar: "none" | "small" | "medium" | "large" | "full"
radius: Var[LiteralRadius]
radius: Optional[Var[LiteralRadius]] = None
def _apply_theme(self, theme: Component):
if self.radius is not None:
@ -57,13 +56,13 @@ class ProgressIndicator(ProgressComponent):
alias = "RadixProgressIndicator"
# The current progress value.
value: Var[Optional[int]]
value: Optional[Var[Optional[int]]] = None
# The maximum progress value.
max: Var[Optional[int]]
max: Optional[Var[Optional[int]]] = None
# The color scheme of the progress indicator.
color_scheme: Var[LiteralAccentColor]
color_scheme: Optional[Var[LiteralAccentColor]] = None
def _apply_theme(self, theme: Component):
if self.color_scheme is not None:
@ -92,13 +91,13 @@ class Progress(ProgressRoot):
"""The high-level Progress component."""
# Override theme color for progress bar indicator
color_scheme: Var[LiteralAccentColor]
color_scheme: Optional[Var[LiteralAccentColor]] = None
# The current progress value.
value: Var[Optional[int]]
value: Optional[Var[Optional[int]]] = None
# The maximum progress value.
max: Var[Optional[int]]
max: Optional[Var[Optional[int]]] = None
@classmethod
def create(cls, **props) -> Component:

View File

@ -1,8 +1,7 @@
"""Radix slider components."""
from __future__ import annotations
from typing import Any, Dict, List, Literal
from typing import Any, Dict, List, Literal, Optional
from reflex.components.component import Component, ComponentNamespace
from reflex.components.radix.primitives.base import RadixPrimitiveComponentWithClassName
@ -25,27 +24,27 @@ class SliderRoot(SliderComponent):
tag = "Root"
alias = "RadixSliderRoot"
default_value: Var[List[int]]
default_value: Optional[Var[List[int]]] = None
value: Var[List[int]]
value: Optional[Var[List[int]]] = None
name: Var[str]
name: Optional[Var[str]] = None
disabled: Var[bool]
disabled: Optional[Var[bool]] = None
orientation: Var[LiteralSliderOrientation]
orientation: Optional[Var[LiteralSliderOrientation]] = None
dir: Var[LiteralSliderDir]
dir: Optional[Var[LiteralSliderDir]] = None
inverted: Var[bool]
inverted: Optional[Var[bool]] = None
min: Var[int]
min: Optional[Var[int]] = None
max: Var[int]
max: Optional[Var[int]] = None
step: Var[int]
step: Optional[Var[int]] = None
min_steps_between_thumbs: Var[int]
min_steps_between_thumbs: Optional[Var[int]] = None
def get_event_triggers(self) -> Dict[str, Any]:
"""Event triggers for radix slider primitive.

View File

@ -1,5 +1,4 @@
"""Base classes for radix-themes components."""
from __future__ import annotations
from typing import Any, Dict, Literal, Optional, Union
@ -52,25 +51,25 @@ class CommonMarginProps(Component):
"""Many radix-themes elements accept shorthand margin props."""
# Margin: "0" - "9"
m: Var[LiteralSpacing]
m: Optional[Var[LiteralSpacing]] = None
# Margin horizontal: "0" - "9"
mx: Var[LiteralSpacing]
mx: Optional[Var[LiteralSpacing]] = None
# Margin vertical: "0" - "9"
my: Var[LiteralSpacing]
my: Optional[Var[LiteralSpacing]] = None
# Margin top: "0" - "9"
mt: Var[LiteralSpacing]
mt: Optional[Var[LiteralSpacing]] = None
# Margin right: "0" - "9"
mr: Var[LiteralSpacing]
mr: Optional[Var[LiteralSpacing]] = None
# Margin bottom: "0" - "9"
mb: Var[LiteralSpacing]
mb: Optional[Var[LiteralSpacing]] = None
# Margin left: "0" - "9"
ml: Var[LiteralSpacing]
ml: Optional[Var[LiteralSpacing]] = None
class RadixThemesComponent(Component):
@ -215,7 +214,7 @@ class ThemePanel(RadixThemesComponent):
tag = "ThemePanel"
# Whether the panel is open. Defaults to False.
default_open: Var[bool]
default_open: Optional[Var[bool]] = None
class RadixThemesColorModeProvider(Component):

View File

@ -1,5 +1,5 @@
"""Interactive components provided by @radix-ui/themes."""
from typing import Any, Dict, Literal
from typing import Any, Dict, Literal, Optional
from reflex import el
from reflex.components.component import ComponentNamespace
@ -17,7 +17,7 @@ class AlertDialogRoot(RadixThemesComponent):
tag = "AlertDialog.Root"
# The controlled open state of the dialog.
open: Var[bool]
open: Optional[Var[bool]] = None
def get_event_triggers(self) -> Dict[str, Any]:
"""Get the events triggers signatures for the component.
@ -43,10 +43,10 @@ class AlertDialogContent(el.Div, RadixThemesComponent):
tag = "AlertDialog.Content"
# The size of the content.
size: Var[LiteralContentSize]
size: Optional[Var[LiteralContentSize]] = None
# Whether to force mount the content on open.
force_mount: Var[bool]
force_mount: Optional[Var[bool]] = None
def get_event_triggers(self) -> Dict[str, Any]:
"""Get the events triggers signatures for the component.

View File

@ -1,5 +1,5 @@
"""Interactive components provided by @radix-ui/themes."""
from typing import Union
from typing import Optional, Union
from reflex.vars import Var
@ -12,7 +12,7 @@ class AspectRatio(RadixThemesComponent):
tag = "AspectRatio"
# The ratio of the width to the height of the element
ratio: Var[Union[float, int]]
ratio: Optional[Var[Union[float, int]]] = None
aspect_ratio = AspectRatio.create

View File

@ -1,6 +1,5 @@
"""Interactive components provided by @radix-ui/themes."""
from typing import Literal
from typing import Literal, Optional
from reflex.vars import Var
@ -19,25 +18,25 @@ class Avatar(RadixThemesComponent):
tag = "Avatar"
# The variant of the avatar
variant: Var[Literal["solid", "soft"]]
variant: Optional[Var[Literal["solid", "soft"]]] = None
# The size of the avatar: "1" - "9"
size: Var[LiteralSize]
size: Optional[Var[LiteralSize]] = None
# Color theme of the avatar
color_scheme: Var[LiteralAccentColor]
color_scheme: Optional[Var[LiteralAccentColor]] = None
# Whether to render the avatar with higher contrast color against background
high_contrast: Var[bool]
high_contrast: Optional[Var[bool]] = None
# Override theme radius for avatar: "none" | "small" | "medium" | "large" | "full"
radius: Var[LiteralRadius]
radius: Optional[Var[LiteralRadius]] = None
# The src of the avatar image
src: Var[str]
src: Optional[Var[str]] = None
# The rendered fallback text
fallback: Var[str]
fallback: Optional[Var[str]] = None
avatar = Avatar.create

View File

@ -1,5 +1,5 @@
"""Interactive components provided by @radix-ui/themes."""
from typing import Literal
from typing import Literal, Optional
from reflex import el
from reflex.vars import Var
@ -17,19 +17,19 @@ class Badge(el.Span, RadixThemesComponent):
tag = "Badge"
# The variant of the badge
variant: Var[Literal["solid", "soft", "surface", "outline"]]
variant: Optional[Var[Literal["solid", "soft", "surface", "outline"]]] = None
# The size of the badge
size: Var[Literal["1", "2"]]
size: Optional[Var[Literal["1", "2"]]] = None
# Color theme of the badge
color_scheme: Var[LiteralAccentColor]
color_scheme: Optional[Var[LiteralAccentColor]] = None
# Whether to render the badge with higher contrast color against background
high_contrast: Var[bool]
high_contrast: Optional[Var[bool]] = None
# Override theme radius for badge: "none" | "small" | "medium" | "large" | "full"
radius: Var[LiteralRadius]
radius: Optional[Var[LiteralRadius]] = None
badge = Badge.create

View File

@ -1,5 +1,5 @@
"""Interactive components provided by @radix-ui/themes."""
from typing import Literal
from typing import Literal, Optional
from reflex import el
from reflex.vars import Var
@ -20,22 +20,22 @@ class Button(el.Button, RadixThemesComponent):
tag = "Button"
# Change the default rendered element for the one passed as a child, merging their props and behavior.
as_child: Var[bool]
as_child: Optional[Var[bool]] = None
# Button size "1" - "4"
size: Var[LiteralButtonSize]
size: Optional[Var[LiteralButtonSize]] = None
# Variant of button: "solid" | "soft" | "outline" | "ghost"
variant: Var[LiteralVariant]
variant: Optional[Var[LiteralVariant]] = None
# Override theme color for button
color_scheme: Var[LiteralAccentColor]
color_scheme: Optional[Var[LiteralAccentColor]] = None
# Whether to render the button with higher contrast color against background
high_contrast: Var[bool]
high_contrast: Optional[Var[bool]] = None
# Override theme radius for button: "none" | "small" | "medium" | "large" | "full"
radius: Var[LiteralRadius]
radius: Optional[Var[LiteralRadius]] = None
button = Button.create

View File

@ -1,6 +1,5 @@
"""Interactive components provided by @radix-ui/themes."""
from typing import Literal, Union
from typing import Literal, Optional, Union
import reflex as rx
from reflex import el
@ -22,19 +21,19 @@ class CalloutRoot(el.Div, RadixThemesComponent):
tag = "Callout.Root"
# Change the default rendered element for the one passed as a child, merging their props and behavior.
as_child: Var[bool]
as_child: Optional[Var[bool]] = None
# Size "1" - "3"
size: Var[Literal["1", "2", "3"]]
size: Optional[Var[Literal["1", "2", "3"]]] = None
# Variant of button: "soft" | "surface" | "outline"
variant: Var[CalloutVariant]
variant: Optional[Var[CalloutVariant]] = None
# Override theme color for button
color_scheme: Var[LiteralAccentColor]
color_scheme: Optional[Var[LiteralAccentColor]] = None
# Whether to render the button with higher contrast color against background
high_contrast: Var[bool]
high_contrast: Optional[Var[bool]] = None
class CalloutIcon(el.Div, RadixThemesComponent):
@ -53,10 +52,10 @@ class Callout(CalloutRoot):
"""A short message to attract user's attention."""
# The text of the callout.
text: Var[str]
text: Optional[Var[str]] = None
# The icon of the callout.
icon: Var[str]
icon: Optional[Var[str]] = None
@classmethod
def create(cls, text: Union[str, Var[str]], **props) -> Component:

View File

@ -1,5 +1,5 @@
"""Interactive components provided by @radix-ui/themes."""
from typing import Literal
from typing import Literal, Optional
from reflex import el
from reflex.vars import Var
@ -15,13 +15,13 @@ class Card(el.Div, RadixThemesComponent):
tag = "Card"
# Change the default rendered element for the one passed as a child, merging their props and behavior.
as_child: Var[bool]
as_child: Optional[Var[bool]] = None
# Card size: "1" - "5"
size: Var[Literal["1", "2", "3", "4", "5"]]
size: Optional[Var[Literal["1", "2", "3", "4", "5"]]] = None
# Variant of Card: "solid" | "soft" | "outline" | "ghost"
variant: Var[Literal["surface", "classic", "ghost"]]
variant: Optional[Var[Literal["surface", "classic", "ghost"]]] = None
card = Card.create

View File

@ -1,6 +1,5 @@
"""Interactive components provided by @radix-ui/themes."""
from typing import Any, Dict, Literal
from typing import Any, Dict, Literal, Optional
from reflex.components.component import Component, ComponentNamespace
from reflex.components.radix.themes.layout.flex import Flex
@ -24,37 +23,37 @@ class Checkbox(RadixThemesComponent):
tag = "Checkbox"
# Change the default rendered element for the one passed as a child, merging their props and behavior.
as_child: Var[bool]
as_child: Optional[Var[bool]] = None
# Checkbox size "1" - "3"
size: Var[LiteralCheckboxSize]
size: Optional[Var[LiteralCheckboxSize]] = None
# Variant of checkbox: "classic" | "surface" | "soft"
variant: Var[LiteralCheckboxVariant]
variant: Optional[Var[LiteralCheckboxVariant]] = None
# Override theme color for checkbox
color_scheme: Var[LiteralAccentColor]
color_scheme: Optional[Var[LiteralAccentColor]] = None
# Whether to render the checkbox with higher contrast color against background
high_contrast: Var[bool]
high_contrast: Optional[Var[bool]] = None
# Whether the checkbox is checked by default
default_checked: Var[bool]
default_checked: Optional[Var[bool]] = None
# Whether the checkbox is checked
checked: Var[bool]
checked: Optional[Var[bool]] = None
# Whether the checkbox is disabled
disabled: Var[bool]
disabled: Optional[Var[bool]] = None
# Whether the checkbox is required
required: Var[bool]
required: Optional[Var[bool]] = None
# The name of the checkbox control when submitting the form.
name: Var[str]
name: Optional[Var[str]] = None
# The value of the checkbox control when submitting the form.
value: Var[str]
value: Optional[Var[str]] = None
# Props to rename
_rename_props = {"onChange": "onCheckedChange"}
@ -77,43 +76,43 @@ class HighLevelCheckbox(RadixThemesComponent):
tag = "Checkbox"
# The text label for the checkbox.
text: Var[str]
text: Optional[Var[str]] = None
# The gap between the checkbox and the label.
spacing: Var[LiteralSpacing]
spacing: Optional[Var[LiteralSpacing]] = None
# The size of the checkbox "1" - "3".
size: Var[LiteralCheckboxSize]
size: Optional[Var[LiteralCheckboxSize]] = None
# Change the default rendered element for the one passed as a child, merging their props and behavior.
as_child: Var[bool]
as_child: Optional[Var[bool]] = None
# Variant of checkbox: "classic" | "surface" | "soft"
variant: Var[LiteralCheckboxVariant]
variant: Optional[Var[LiteralCheckboxVariant]] = None
# Override theme color for checkbox
color_scheme: Var[LiteralAccentColor]
color_scheme: Optional[Var[LiteralAccentColor]] = None
# Whether to render the checkbox with higher contrast color against background
high_contrast: Var[bool]
high_contrast: Optional[Var[bool]] = None
# Whether the checkbox is checked by default
default_checked: Var[bool]
default_checked: Optional[Var[bool]] = None
# Whether the checkbox is checked
checked: Var[bool]
checked: Optional[Var[bool]] = None
# Whether the checkbox is disabled
disabled: Var[bool]
disabled: Optional[Var[bool]] = None
# Whether the checkbox is required
required: Var[bool]
required: Optional[Var[bool]] = None
# The name of the checkbox control when submitting the form.
name: Var[str]
name: Optional[Var[str]] = None
# The value of the checkbox control when submitting the form.
value: Var[str]
value: Optional[Var[str]] = None
# Props to rename
_rename_props = {"onChange": "onCheckedChange"}

View File

@ -1,5 +1,5 @@
"""Interactive components provided by @radix-ui/themes."""
from typing import Any, Dict, List, Literal
from typing import Any, Dict, List, Literal, Optional
from reflex.components.component import ComponentNamespace
from reflex.constants import EventTriggers
@ -17,7 +17,7 @@ class ContextMenuRoot(RadixThemesComponent):
tag = "ContextMenu.Root"
# The modality of the context menu. When set to true, interaction with outside elements will be disabled and only menu content will be visible to screen readers.
modal: Var[bool]
modal: Optional[Var[bool]] = None
_invalid_children: List[str] = ["ContextMenuItem"]
@ -39,7 +39,7 @@ class ContextMenuTrigger(RadixThemesComponent):
tag = "ContextMenu.Trigger"
# Whether the trigger is disabled
disabled: Var[bool]
disabled: Optional[Var[bool]] = None
_valid_parents: List[str] = ["ContextMenuRoot"]
@ -52,22 +52,22 @@ class ContextMenuContent(RadixThemesComponent):
tag = "ContextMenu.Content"
# Button size "1" - "4"
size: Var[Literal["1", "2"]]
size: Optional[Var[Literal["1", "2"]]] = None
# Variant of button: "solid" | "soft" | "outline" | "ghost"
variant: Var[Literal["solid", "soft"]]
variant: Optional[Var[Literal["solid", "soft"]]] = None
# Override theme color for button
color_scheme: Var[LiteralAccentColor]
color_scheme: Optional[Var[LiteralAccentColor]] = None
# Whether to render the button with higher contrast color against background
high_contrast: Var[bool]
high_contrast: Optional[Var[bool]] = None
# The vertical distance in pixels from the anchor.
align_offset: Var[int]
align_offset: Optional[Var[int]] = None
# When true, overrides the side and aligns preferences to prevent collisions with boundary edges.
avoid_collisions: Var[bool]
avoid_collisions: Optional[Var[bool]] = None
def get_event_triggers(self) -> Dict[str, Any]:
"""Get the events triggers signatures for the component.
@ -97,7 +97,7 @@ class ContextMenuSubTrigger(RadixThemesComponent):
tag = "ContextMenu.SubTrigger"
# Whether the trigger is disabled
disabled: Var[bool]
disabled: Optional[Var[bool]] = None
_valid_parents: List[str] = ["ContextMenuContent", "ContextMenuSub"]
@ -108,7 +108,7 @@ class ContextMenuSubContent(RadixThemesComponent):
tag = "ContextMenu.SubContent"
# When true, keyboard navigation will loop from last item to first, and vice versa.
loop: Var[bool]
loop: Optional[Var[bool]] = None
_valid_parents: List[str] = ["ContextMenuSub"]
@ -133,10 +133,10 @@ class ContextMenuItem(RadixThemesComponent):
tag = "ContextMenu.Item"
# Override theme color for button
color_scheme: Var[LiteralAccentColor]
color_scheme: Optional[Var[LiteralAccentColor]] = None
# Shortcut to render a menu item as a link
shortcut: Var[str]
shortcut: Optional[Var[str]] = None
_valid_parents: List[str] = ["ContextMenuContent", "ContextMenuSubContent"]

View File

@ -1,6 +1,5 @@
"""Interactive components provided by @radix-ui/themes."""
from typing import Any, Dict, Literal
from typing import Any, Dict, Literal, Optional
from reflex import el
from reflex.components.component import ComponentNamespace
@ -18,7 +17,7 @@ class DialogRoot(RadixThemesComponent):
tag = "Dialog.Root"
# The controlled open state of the dialog.
open: Var[bool]
open: Optional[Var[bool]] = None
def get_event_triggers(self) -> Dict[str, Any]:
"""Get the events triggers signatures for the component.
@ -50,7 +49,7 @@ class DialogContent(el.Div, RadixThemesComponent):
tag = "Dialog.Content"
# DialogContent size "1" - "4"
size: Var[Literal["1", "2", "3", "4"]]
size: Optional[Var[Literal["1", "2", "3", "4"]]] = None
def get_event_triggers(self) -> Dict[str, Any]:
"""Get the events triggers signatures for the component.

View File

@ -1,5 +1,5 @@
"""Interactive components provided by @radix-ui/themes."""
from typing import Any, Dict, List, Literal, Union
from typing import Any, Dict, List, Literal, Optional, Union
from reflex.components.component import ComponentNamespace
from reflex.constants import EventTriggers
@ -33,16 +33,16 @@ class DropdownMenuRoot(RadixThemesComponent):
tag = "DropdownMenu.Root"
# The open state of the dropdown menu when it is initially rendered. Use when you do not need to control its open state.
default_open: Var[bool]
default_open: Optional[Var[bool]] = None
# The controlled open state of the dropdown menu. Must be used in conjunction with onOpenChange.
open: Var[bool]
open: Optional[Var[bool]] = None
# The modality of the dropdown menu. When set to true, interaction with outside elements will be disabled and only menu content will be visible to screen readers. Defaults to True.
modal: Var[bool]
modal: Optional[Var[bool]] = None
# The reading direction of submenus when applicable. If omitted, inherits globally from DirectionProvider or assumes LTR (left-to-right) reading mode.
dir: Var[LiteralDirType]
dir: Optional[Var[LiteralDirType]] = None
_invalid_children: List[str] = ["DropdownMenuItem"]
@ -64,7 +64,7 @@ class DropdownMenuTrigger(RadixThemesComponent):
tag = "DropdownMenu.Trigger"
# Change the default rendered element for the one passed as a child, merging their props and behavior. Defaults to False.
as_child: Var[bool]
as_child: Optional[Var[bool]] = None
_valid_parents: List[str] = ["DropdownMenuRoot"]
@ -77,52 +77,52 @@ class DropdownMenuContent(RadixThemesComponent):
tag = "DropdownMenu.Content"
# Dropdown Menu Content size "1" - "2"
size: Var[LiteralSizeType]
size: Optional[Var[LiteralSizeType]] = None
# Variant of Dropdown Menu Content: "solid" | "soft"
variant: Var[LiteralVariantType]
variant: Optional[Var[LiteralVariantType]] = None
# Override theme color for Dropdown Menu Content
color_scheme: Var[LiteralAccentColor]
color_scheme: Optional[Var[LiteralAccentColor]] = None
# Renders the Dropdown Menu Content in higher contrast
high_contrast: Var[bool]
high_contrast: Optional[Var[bool]] = None
# Change the default rendered element for the one passed as a child, merging their props and behavior. Defaults to False.
as_child: Var[bool]
as_child: Optional[Var[bool]] = None
# When True, keyboard navigation will loop from last item to first, and vice versa. Defaults to False.
loop: Var[bool]
loop: Optional[Var[bool]] = None
# Used to force mounting when more control is needed. Useful when controlling animation with React animation libraries.
force_mount: Var[bool]
force_mount: Optional[Var[bool]] = None
# The preferred side of the trigger to render against when open. Will be reversed when collisions occur and `avoid_collisions` is enabled.The position of the tooltip. Defaults to "top".
side: Var[LiteralSideType]
side: Optional[Var[LiteralSideType]] = None
# The distance in pixels from the trigger. Defaults to 0.
side_offset: Var[Union[float, int]]
side_offset: Optional[Var[Union[float, int]]] = None
# The preferred alignment against the trigger. May change when collisions occur. Defaults to "center".
align: Var[LiteralAlignType]
align: Optional[Var[LiteralAlignType]] = None
# An offset in pixels from the "start" or "end" alignment options.
align_offset: Var[Union[float, int]]
align_offset: Optional[Var[Union[float, int]]] = None
# When true, overrides the side and align preferences to prevent collisions with boundary edges. Defaults to True.
avoid_collisions: Var[bool]
avoid_collisions: Optional[Var[bool]] = None
# 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 }. Defaults to 0.
collision_padding: Var[Union[float, int, Dict[str, Union[float, int]]]]
collision_padding: Optional[Var[Union[float, int, Dict[str, Union[float, int]]]]] = None
# The padding between the arrow and the edges of the content. If your content has border-radius, this will prevent it from overflowing the corners. Defaults to 0.
arrow_padding: Var[Union[float, int]]
arrow_padding: Optional[Var[Union[float, int]]] = None
# 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. Defaults to "partial".
sticky: Var[LiteralStickyType]
sticky: Optional[Var[LiteralStickyType]] = None
# Whether to hide the content when the trigger becomes fully occluded. Defaults to False.
hide_when_detached: Var[bool]
hide_when_detached: Optional[Var[bool]] = None
def get_event_triggers(self) -> Dict[str, Any]:
"""Get the events triggers signatures for the component.
@ -146,13 +146,13 @@ class DropdownMenuSubTrigger(RadixThemesComponent):
tag = "DropdownMenu.SubTrigger"
# Change the default rendered element for the one passed as a child, merging their props and behavior. Defaults to False.
as_child: Var[bool]
as_child: Optional[Var[bool]] = None
# When true, prevents the user from interacting with the item.
disabled: Var[bool]
disabled: Optional[Var[bool]] = None
# Optional text used for typeahead purposes. By default the typeahead behavior will use the .textContent of the item. Use this when the content is complex, or you have non-textual content inside.
text_value: Var[str]
text_value: Optional[Var[str]] = None
_valid_parents: List[str] = ["DropdownMenuContent", "DropdownMenuSub"]
@ -163,10 +163,10 @@ class DropdownMenuSub(RadixThemesComponent):
tag = "DropdownMenu.Sub"
# The controlled open state of the submenu. Must be used in conjunction with `on_open_change`.
open: Var[bool]
open: Optional[Var[bool]] = None
# The open state of the submenu when it is initially rendered. Use when you do not need to control its open state.
default_open: Var[bool]
default_open: Optional[Var[bool]] = None
def get_event_triggers(self) -> Dict[str, Any]:
"""Get the events triggers signatures for the component.
@ -186,34 +186,34 @@ class DropdownMenuSubContent(RadixThemesComponent):
tag = "DropdownMenu.SubContent"
# Change the default rendered element for the one passed as a child, merging their props and behavior. Defaults to False.
as_child: Var[bool]
as_child: Optional[Var[bool]] = None
# When True, keyboard navigation will loop from last item to first, and vice versa. Defaults to False.
loop: Var[bool]
loop: Optional[Var[bool]] = None
# Used to force mounting when more control is needed. Useful when controlling animation with React animation libraries.
force_mount: Var[bool]
force_mount: Optional[Var[bool]] = None
# The distance in pixels from the trigger. Defaults to 0.
side_offset: Var[Union[float, int]]
side_offset: Optional[Var[Union[float, int]]] = None
# An offset in pixels from the "start" or "end" alignment options.
align_offset: Var[Union[float, int]]
align_offset: Optional[Var[Union[float, int]]] = None
# When true, overrides the side and align preferences to prevent collisions with boundary edges. Defaults to True.
avoid_collisions: Var[bool]
avoid_collisions: Optional[Var[bool]] = None
# 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 }. Defaults to 0.
collision_padding: Var[Union[float, int, Dict[str, Union[float, int]]]]
collision_padding: Optional[Var[Union[float, int, Dict[str, Union[float, int]]]]] = None
# The padding between the arrow and the edges of the content. If your content has border-radius, this will prevent it from overflowing the corners. Defaults to 0.
arrow_padding: Var[Union[float, int]]
arrow_padding: Optional[Var[Union[float, int]]] = None
# 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. Defaults to "partial".
sticky: Var[LiteralStickyType]
sticky: Optional[Var[LiteralStickyType]] = None
# Whether to hide the content when the trigger becomes fully occluded. Defaults to False.
hide_when_detached: Var[bool]
hide_when_detached: Optional[Var[bool]] = None
_valid_parents: List[str] = ["DropdownMenuSub"]
@ -238,19 +238,19 @@ class DropdownMenuItem(RadixThemesComponent):
tag = "DropdownMenu.Item"
# Override theme color for Dropdown Menu Item
color_scheme: Var[LiteralAccentColor]
color_scheme: Optional[Var[LiteralAccentColor]] = None
# Shortcut to render a menu item as a link
shortcut: Var[str]
shortcut: Optional[Var[str]] = None
# Change the default rendered element for the one passed as a child, merging their props and behavior. Defaults to False.
as_child: Var[bool]
as_child: Optional[Var[bool]] = None
# When true, prevents the user from interacting with the item.
disabled: Var[bool]
disabled: Optional[Var[bool]] = None
# Optional text used for typeahead purposes. By default the typeahead behavior will use the .textContent of the item. Use this when the content is complex, or you have non-textual content inside.
text_value: Var[str]
text_value: Optional[Var[str]] = None
_valid_parents: List[str] = ["DropdownMenuContent", "DropdownMenuSubContent"]

View File

@ -1,5 +1,5 @@
"""Interactive components provided by @radix-ui/themes."""
from typing import Any, Dict, Literal
from typing import Any, Dict, Literal, Optional
from reflex import el
from reflex.components.component import ComponentNamespace
@ -17,16 +17,16 @@ class HoverCardRoot(RadixThemesComponent):
tag = "HoverCard.Root"
# The open state of the hover card when it is initially rendered. Use when you do not need to control its open state.
default_open: Var[bool]
default_open: Optional[Var[bool]] = None
# The controlled open state of the hover card. Must be used in conjunction with onOpenChange.
open: Var[bool]
open: Optional[Var[bool]] = None
# The duration from when the mouse enters the trigger until the hover card opens.
open_delay: Var[int]
open_delay: Optional[Var[int]] = None
# The duration from when the mouse leaves the trigger until the hover card closes.
close_delay: Var[int]
close_delay: Optional[Var[int]] = None
def get_event_triggers(self) -> Dict[str, Any]:
"""Get the events triggers signatures for the component.
@ -52,16 +52,16 @@ class HoverCardContent(el.Div, RadixThemesComponent):
tag = "HoverCard.Content"
# The preferred side of the trigger to render against when open. Will be reversed when collisions occur and avoidCollisions is enabled.
side: Var[Literal["top", "right", "bottom", "left"]]
side: Optional[Var[Literal["top", "right", "bottom", "left"]]] = None
# The distance in pixels from the trigger.
side_offset: Var[int]
side_offset: Optional[Var[int]] = None
# The preferred alignment against the trigger. May change when collisions occur.
align: Var[Literal["start", "center", "end"]]
align: Optional[Var[Literal["start", "center", "end"]]] = None
# Whether or not the hover card should avoid collisions with its trigger.
avoid_collisions: Var[bool]
avoid_collisions: Optional[Var[bool]] = None
class HoverCard(ComponentNamespace):

View File

@ -1,6 +1,5 @@
"""Interactive components provided by @radix-ui/themes."""
from typing import Literal
from typing import Literal, Optional
from reflex import el
from reflex.components.component import Component
@ -25,22 +24,22 @@ class IconButton(el.Button, RadixThemesComponent):
tag = "IconButton"
# Change the default rendered element for the one passed as a child, merging their props and behavior.
as_child: Var[bool]
as_child: Optional[Var[bool]] = None
# Button size "1" - "4"
size: Var[LiteralButtonSize]
size: Optional[Var[LiteralButtonSize]] = None
# Variant of button: "classic" | "solid" | "soft" | "surface" | "outline" | "ghost"
variant: Var[LiteralVariant]
variant: Optional[Var[LiteralVariant]] = None
# Override theme color for button
color_scheme: Var[LiteralAccentColor]
color_scheme: Optional[Var[LiteralAccentColor]] = None
# Whether to render the button with higher contrast color against background
high_contrast: Var[bool]
high_contrast: Optional[Var[bool]] = None
# Override theme radius for button: "none" | "small" | "medium" | "large" | "full"
radius: Var[LiteralRadius]
radius: Optional[Var[LiteralRadius]] = None
@classmethod
def create(cls, *children, **props) -> Component:

View File

@ -1,5 +1,5 @@
"""Interactive components provided by @radix-ui/themes."""
from typing import Literal, Union
from typing import Literal, Optional, Union
from reflex import el
from reflex.vars import Var
@ -17,31 +17,31 @@ class Inset(el.Div, RadixThemesComponent):
tag = "Inset"
# The side
side: Var[Literal["x", "y", "top", "bottom", "right", "left"]]
side: Optional[Var[Literal["x", "y", "top", "bottom", "right", "left"]]] = None
# How to clip the element's content: "border-box" | "padding-box"
clip: Var[Literal["border-box", "padding-box"]]
clip: Optional[Var[Literal["border-box", "padding-box"]]] = None
# Padding
p: Var[Union[int, str]]
p: Optional[Var[Union[int, str]]] = None
# Padding on the x axis
px: Var[Union[int, str]]
px: Optional[Var[Union[int, str]]] = None
# Padding on the y axis
py: Var[Union[int, str]]
py: Optional[Var[Union[int, str]]] = None
# Padding on the top
pt: Var[Union[int, str]]
pt: Optional[Var[Union[int, str]]] = None
# Padding on the right
pr: Var[Union[int, str]]
pr: Optional[Var[Union[int, str]]] = None
# Padding on the bottom
pb: Var[Union[int, str]]
pb: Optional[Var[Union[int, str]]] = None
# Padding on the left
pl: Var[Union[int, str]]
pl: Optional[Var[Union[int, str]]] = None
inset = Inset.create

View File

@ -1,5 +1,5 @@
"""Interactive components provided by @radix-ui/themes."""
from typing import Any, Dict, Literal
from typing import Any, Dict, Literal, Optional
from reflex import el
from reflex.components.component import ComponentNamespace
@ -17,10 +17,10 @@ class PopoverRoot(RadixThemesComponent):
tag = "Popover.Root"
# The controlled open state of the popover.
open: Var[bool]
open: Optional[Var[bool]] = None
# The modality of the popover. When set to true, interaction with outside elements will be disabled and only popover content will be visible to screen readers.
modal: Var[bool]
modal: Optional[Var[bool]] = None
def get_event_triggers(self) -> Dict[str, Any]:
"""Get the events triggers signatures for the component.
@ -46,22 +46,22 @@ class PopoverContent(el.Div, RadixThemesComponent):
tag = "Popover.Content"
# Size of the button: "1" | "2" | "3" | "4"
size: Var[Literal["1", "2", "3", "4"]]
size: Optional[Var[Literal["1", "2", "3", "4"]]] = None
# The preferred side of the anchor to render against when open. Will be reversed when collisions occur and avoidCollisions is enabled.
side: Var[Literal["top", "right", "bottom", "left"]]
side: Optional[Var[Literal["top", "right", "bottom", "left"]]] = None
# The distance in pixels from the anchor.
side_offset: Var[int]
side_offset: Optional[Var[int]] = None
# The preferred alignment against the anchor. May change when collisions occur.
align: Var[Literal["start", "center", "end"]]
align: Optional[Var[Literal["start", "center", "end"]]] = None
# The vertical distance in pixels from the anchor.
align_offset: Var[int]
align_offset: Optional[Var[int]] = None
# When true, overrides the side andalign preferences to prevent collisions with boundary edges.
avoid_collisions: Var[bool]
avoid_collisions: Optional[Var[bool]] = None
def get_event_triggers(self) -> Dict[str, Any]:
"""Get the events triggers signatures for the component.

View File

@ -1,5 +1,4 @@
"""Interactive components provided by @radix-ui/themes."""
from typing import Any, Dict, List, Literal, Optional, Union
import reflex as rx
@ -24,31 +23,31 @@ class RadioGroupRoot(RadixThemesComponent):
tag = "RadioGroup.Root"
# The size of the radio group: "1" | "2" | "3"
size: Var[Literal["1", "2", "3"]]
size: Optional[Var[Literal["1", "2", "3"]]] = None
# The variant of the radio group
variant: Var[Literal["classic", "surface", "soft"]]
variant: Optional[Var[Literal["classic", "surface", "soft"]]] = None
# The color of the radio group
color_scheme: Var[LiteralAccentColor]
color_scheme: Optional[Var[LiteralAccentColor]] = None
# Whether to render the radio group with higher contrast color against background
high_contrast: Var[bool]
high_contrast: Optional[Var[bool]] = None
# The controlled value of the radio item to check. Should be used in conjunction with on_change.
value: Var[str]
value: Optional[Var[str]] = None
# The initial value of checked radio item. Should be used in conjunction with on_change.
default_value: Var[str]
default_value: Optional[Var[str]] = None
# Whether the radio group is disabled
disabled: Var[bool]
disabled: Optional[Var[bool]] = None
# The name of the group. Submitted with its owning form as part of a name/value pair.
name: Var[str]
name: Optional[Var[str]] = None
# Whether the radio group is required
required: Var[bool]
required: Optional[Var[bool]] = None
# Props to rename
_rename_props = {"onChange": "onValueChange"}
@ -71,23 +70,23 @@ class RadioGroupItem(RadixThemesComponent):
tag = "RadioGroup.Item"
# The value of the radio item to check. Should be used in conjunction with on_change.
value: Var[str]
value: Optional[Var[str]] = None
# When true, prevents the user from interacting with the radio item.
disabled: Var[bool]
disabled: Optional[Var[bool]] = None
# When true, indicates that the user must check the radio item before the owning form can be submitted.
required: Var[bool]
required: Optional[Var[bool]] = None
class HighLevelRadioGroup(RadixThemesComponent):
"""High level wrapper for the RadioGroup component."""
# The items of the radio group.
items: Var[List[str]]
items: Optional[Var[List[str]]] = None
# The direction of the radio group.
direction: Var[LiteralFlexDirection]
direction: Optional[Var[LiteralFlexDirection]] = None
# The gap between the items of the radio group.
spacing: Var[LiteralSpacing] = Var.create_safe("2")
@ -96,28 +95,28 @@ class HighLevelRadioGroup(RadixThemesComponent):
size: Var[Literal["1", "2", "3"]] = Var.create_safe("2")
# The variant of the radio group
variant: Var[Literal["classic", "surface", "soft"]]
variant: Optional[Var[Literal["classic", "surface", "soft"]]] = None
# The color of the radio group
color_scheme: Var[LiteralAccentColor]
color_scheme: Optional[Var[LiteralAccentColor]] = None
# Whether to render the radio group with higher contrast color against background
high_contrast: Var[bool]
high_contrast: Optional[Var[bool]] = None
# The controlled value of the radio item to check. Should be used in conjunction with on_change.
value: Var[str]
value: Optional[Var[str]] = None
# The initial value of checked radio item. Should be used in conjunction with on_change.
default_value: Var[str]
default_value: Optional[Var[str]] = None
# Whether the radio group is disabled
disabled: Var[bool]
disabled: Optional[Var[bool]] = None
# The name of the group. Submitted with its owning form as part of a name/value pair.
name: Var[str]
name: Optional[Var[str]] = None
# Whether the radio group is required
required: Var[bool]
required: Optional[Var[bool]] = None
# Props to rename
_rename_props = {"onChange": "onValueChange"}

Some files were not shown because too many files have changed in this diff Show More