fix checkbox_group component (#3454)
This commit is contained in:
parent
ed05f57fc9
commit
b78fa6f210
@ -1,7 +1,7 @@
|
|||||||
"""Components for the CheckboxGroup component of Radix Themes."""
|
"""Components for the CheckboxGroup component of Radix Themes."""
|
||||||
|
|
||||||
from types import SimpleNamespace
|
from types import SimpleNamespace
|
||||||
from typing import Literal
|
from typing import List, Literal
|
||||||
|
|
||||||
from reflex.vars import Var
|
from reflex.vars import Var
|
||||||
|
|
||||||
@ -11,9 +11,9 @@ from ..base import LiteralAccentColor, RadixThemesComponent
|
|||||||
class CheckboxGroupRoot(RadixThemesComponent):
|
class CheckboxGroupRoot(RadixThemesComponent):
|
||||||
"""Root element for a CheckboxGroup component."""
|
"""Root element for a CheckboxGroup component."""
|
||||||
|
|
||||||
tag = "CheckboxGroup"
|
tag = "CheckboxGroup.Root"
|
||||||
|
|
||||||
#
|
# Use the size prop to control the checkbox size.
|
||||||
size: Var[Literal["1", "2", "3"]]
|
size: Var[Literal["1", "2", "3"]]
|
||||||
|
|
||||||
# Variant of button: "classic" | "surface" | "soft"
|
# Variant of button: "classic" | "surface" | "soft"
|
||||||
@ -25,12 +25,24 @@ class CheckboxGroupRoot(RadixThemesComponent):
|
|||||||
# Uses a higher contrast color for the component.
|
# Uses a higher contrast color for the component.
|
||||||
high_contrast: Var[bool]
|
high_contrast: Var[bool]
|
||||||
|
|
||||||
|
# determines which checkboxes, if any, are checked by default.
|
||||||
|
default_value: Var[List[str]]
|
||||||
|
|
||||||
|
# used to assign a name to the entire group of checkboxes
|
||||||
|
name: Var[str]
|
||||||
|
|
||||||
|
|
||||||
class CheckboxGroupItem(RadixThemesComponent):
|
class CheckboxGroupItem(RadixThemesComponent):
|
||||||
"""An item in the CheckboxGroup component."""
|
"""An item in the CheckboxGroup component."""
|
||||||
|
|
||||||
tag = "CheckboxGroup.Item"
|
tag = "CheckboxGroup.Item"
|
||||||
|
|
||||||
|
# specifies the value associated with a particular checkbox option.
|
||||||
|
value: Var[str]
|
||||||
|
|
||||||
|
# Use the native disabled attribute to create a disabled checkbox.
|
||||||
|
disabled: Var[bool]
|
||||||
|
|
||||||
|
|
||||||
class CheckboxGroup(SimpleNamespace):
|
class CheckboxGroup(SimpleNamespace):
|
||||||
"""CheckboxGroup components namespace."""
|
"""CheckboxGroup components namespace."""
|
||||||
|
@ -8,7 +8,7 @@ from reflex.vars import Var, BaseVar, ComputedVar
|
|||||||
from reflex.event import EventChain, EventHandler, EventSpec
|
from reflex.event import EventChain, EventHandler, EventSpec
|
||||||
from reflex.style import Style
|
from reflex.style import Style
|
||||||
from types import SimpleNamespace
|
from types import SimpleNamespace
|
||||||
from typing import Literal
|
from typing import List, Literal
|
||||||
from reflex.vars import Var
|
from reflex.vars import Var
|
||||||
from ..base import LiteralAccentColor, RadixThemesComponent
|
from ..base import LiteralAccentColor, RadixThemesComponent
|
||||||
|
|
||||||
@ -90,6 +90,8 @@ class CheckboxGroupRoot(RadixThemesComponent):
|
|||||||
]
|
]
|
||||||
] = None,
|
] = None,
|
||||||
high_contrast: Optional[Union[Var[bool], bool]] = None,
|
high_contrast: Optional[Union[Var[bool], bool]] = None,
|
||||||
|
default_value: Optional[Union[Var[List[str]], List[str]]] = None,
|
||||||
|
name: Optional[Union[Var[str], str]] = None,
|
||||||
style: Optional[Style] = None,
|
style: Optional[Style] = None,
|
||||||
key: Optional[Any] = None,
|
key: Optional[Any] = None,
|
||||||
id: Optional[Any] = None,
|
id: Optional[Any] = None,
|
||||||
@ -150,10 +152,12 @@ class CheckboxGroupRoot(RadixThemesComponent):
|
|||||||
|
|
||||||
Args:
|
Args:
|
||||||
*children: Child components.
|
*children: Child components.
|
||||||
size:
|
size: Use the size prop to control the checkbox size.
|
||||||
variant: Variant of button: "classic" | "surface" | "soft"
|
variant: Variant of button: "classic" | "surface" | "soft"
|
||||||
color_scheme: Override theme color for button
|
color_scheme: Override theme color for button
|
||||||
high_contrast: Uses a higher contrast color for the component.
|
high_contrast: Uses a higher contrast color for the component.
|
||||||
|
default_value: determines which checkboxes, if any, are checked by default.
|
||||||
|
name: used to assign a name to the entire group of checkboxes
|
||||||
style: The style of the component.
|
style: The style of the component.
|
||||||
key: A unique key for the component.
|
key: A unique key for the component.
|
||||||
id: The id for the component.
|
id: The id for the component.
|
||||||
@ -173,6 +177,8 @@ class CheckboxGroupItem(RadixThemesComponent):
|
|||||||
def create( # type: ignore
|
def create( # type: ignore
|
||||||
cls,
|
cls,
|
||||||
*children,
|
*children,
|
||||||
|
value: Optional[Union[Var[str], str]] = None,
|
||||||
|
disabled: Optional[Union[Var[bool], bool]] = None,
|
||||||
style: Optional[Style] = None,
|
style: Optional[Style] = None,
|
||||||
key: Optional[Any] = None,
|
key: Optional[Any] = None,
|
||||||
id: Optional[Any] = None,
|
id: Optional[Any] = None,
|
||||||
@ -233,6 +239,8 @@ class CheckboxGroupItem(RadixThemesComponent):
|
|||||||
|
|
||||||
Args:
|
Args:
|
||||||
*children: Child components.
|
*children: Child components.
|
||||||
|
value: specifies the value associated with a particular checkbox option.
|
||||||
|
disabled: Use the native disabled attribute to create a disabled checkbox.
|
||||||
style: The style of the component.
|
style: The style of the component.
|
||||||
key: A unique key for the component.
|
key: A unique key for the component.
|
||||||
id: The id for the component.
|
id: The id for the component.
|
||||||
|
Loading…
Reference in New Issue
Block a user