instruction stringlengths 0 1k | input stringlengths 1 1k | output stringlengths 10 6.51k |
|---|---|---|
"""Create the slider indicator component."""
props["data-slot"] = "slider-indicator"
cls.set_class_name(ClassNames.INDICATOR, props)
return super().create(*children, **props)
class SliderThumb(SliderBaseComponent):
"""The draggable part of the slider at the tip of the indicator. Renders a div element."""
tag = "Slider.Thumb"
# Accepts a function which returns a string value that provides a user-friendly name for the input associated with the thumb.
get_aria_label: Var[str]
# Accepts a function which returns a string value that provides a user-friendly name for the current value of the slider. This is important for screen reader users.
get_aria_value_text: Var[str]
# Whether the thumb should ignore user interaction.
disabled: Var[bool]
# The render prop
render_: Var[Component]
@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create the slider thumb component."""
|
cls.set_class_name(ClassNames.THUMB, props)
return super().create(*children, **props)
class HighLevelSlider(SliderRoot):
"""High-level wrapper for the Slider component."""
@classmethod
def create(cls, **props) -> BaseUIComponent:
"""Create a complete slider component.
Args:
**props: Additional properties to apply to the slider component.
Returns:
The slider component.
"""
return SliderRoot.create(
SliderControl.create(
SliderTrack.create(
SliderIndicator.create(),
SliderThumb.create(),
),
),
**props,
)
class Slider(ComponentNamespace):
"""Namespace for Slider components."""
root = staticmethod(SliderRoot.create)
value = staticmethod(SliderValue.create)
control = staticmethod(SliderControl.create)
track = staticmethod(SliderTrack.create)
indicator = | props["data-slot"] = "slider-thumb" |
DICATOR, props)
return super().create(*children, **props)
class SliderThumb(SliderBaseComponent):
"""The draggable part of the slider at the tip of the indicator. Renders a div element."""
tag = "Slider.Thumb"
# Accepts a function which returns a string value that provides a user-friendly name for the input associated with the thumb.
get_aria_label: Var[str]
# Accepts a function which returns a string value that provides a user-friendly name for the current value of the slider. This is important for screen reader users.
get_aria_value_text: Var[str]
# Whether the thumb should ignore user interaction.
disabled: Var[bool]
# The render prop
render_: Var[Component]
@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create the slider thumb component."""
props["data-slot"] = "slider-thumb"
cls.set_class_name(ClassNames.THUMB, props)
return super().create(*children, **props)
|
class Slider(ComponentNamespace):
"""Namespace for Slider components."""
root = staticmethod(SliderRoot.create)
value = staticmethod(SliderValue.create)
control = staticmethod(SliderControl.create)
track = staticmethod(SliderTrack.create)
indicator = staticmethod(SliderIndicator.create)
thumb = staticmethod(SliderThumb.create)
class_names = ClassNames
__call__ = staticmethod(HighLevelSlider.create)
slider = Slider()
| class HighLevelSlider(SliderRoot):
"""High-level wrapper for the Slider component."""
@classmethod
def create(cls, **props) -> BaseUIComponent:
"""Create a complete slider component.
Args:
**props: Additional properties to apply to the slider component.
Returns:
The slider component.
"""
return SliderRoot.create(
SliderControl.create(
SliderTrack.create(
SliderIndicator.create(),
SliderThumb.create(),
),
),
**props,
) |
"""The draggable part of the slider at the tip of the indicator. Renders a div element."""
tag = "Slider.Thumb"
# Accepts a function which returns a string value that provides a user-friendly name for the input associated with the thumb.
get_aria_label: Var[str]
# Accepts a function which returns a string value that provides a user-friendly name for the current value of the slider. This is important for screen reader users.
get_aria_value_text: Var[str]
# Whether the thumb should ignore user interaction.
disabled: Var[bool]
# The render prop
render_: Var[Component]
@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create the slider thumb component."""
props["data-slot"] = "slider-thumb"
cls.set_class_name(ClassNames.THUMB, props)
return super().create(*children, **props)
class HighLevelSlider(SliderRoot):
"""High-level wrapper for the Slider component."""
@classmethod
|
class Slider(ComponentNamespace):
"""Namespace for Slider components."""
root = staticmethod(SliderRoot.create)
value = staticmethod(SliderValue.create)
control = staticmethod(SliderControl.create)
track = staticmethod(SliderTrack.create)
indicator = staticmethod(SliderIndicator.create)
thumb = staticmethod(SliderThumb.create)
class_names = ClassNames
__call__ = staticmethod(HighLevelSlider.create)
slider = Slider()
| def create(cls, **props) -> BaseUIComponent:
"""Create a complete slider component.
Args:
**props: Additional properties to apply to the slider component.
Returns:
The slider component.
"""
return SliderRoot.create(
SliderControl.create(
SliderTrack.create(
SliderIndicator.create(),
SliderThumb.create(),
),
),
**props,
) |
hould ignore user interaction.
disabled: Var[bool]
# The render prop
render_: Var[Component]
@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create the slider thumb component."""
props["data-slot"] = "slider-thumb"
cls.set_class_name(ClassNames.THUMB, props)
return super().create(*children, **props)
class HighLevelSlider(SliderRoot):
"""High-level wrapper for the Slider component."""
@classmethod
def create(cls, **props) -> BaseUIComponent:
"""Create a complete slider component.
Args:
**props: Additional properties to apply to the slider component.
Returns:
The slider component.
"""
return SliderRoot.create(
SliderControl.create(
SliderTrack.create(
SliderIndicator.create(),
SliderThumb.create(),
),
),
**props,
)
|
slider = Slider()
| class Slider(ComponentNamespace):
"""Namespace for Slider components."""
root = staticmethod(SliderRoot.create)
value = staticmethod(SliderValue.create)
control = staticmethod(SliderControl.create)
track = staticmethod(SliderTrack.create)
indicator = staticmethod(SliderIndicator.create)
thumb = staticmethod(SliderThumb.create)
class_names = ClassNames
__call__ = staticmethod(HighLevelSlider.create) |
render_: Var[Component]
@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create the slider thumb component."""
props["data-slot"] = "slider-thumb"
cls.set_class_name(ClassNames.THUMB, props)
return super().create(*children, **props)
class HighLevelSlider(SliderRoot):
"""High-level wrapper for the Slider component."""
@classmethod
def create(cls, **props) -> BaseUIComponent:
"""Create a complete slider component.
Args:
**props: Additional properties to apply to the slider component.
Returns:
The slider component.
"""
return SliderRoot.create(
SliderControl.create(
SliderTrack.create(
SliderIndicator.create(),
SliderThumb.create(),
),
),
**props,
)
class Slider(ComponentNamespace):
"""Namespace for Slider components."""
|
value = staticmethod(SliderValue.create)
control = staticmethod(SliderControl.create)
track = staticmethod(SliderTrack.create)
indicator = staticmethod(SliderIndicator.create)
thumb = staticmethod(SliderThumb.create)
class_names = ClassNames
__call__ = staticmethod(HighLevelSlider.create)
slider = Slider()
| root = staticmethod(SliderRoot.create) |
def create(cls, *children, **props) -> BaseUIComponent:
"""Create the slider thumb component."""
props["data-slot"] = "slider-thumb"
cls.set_class_name(ClassNames.THUMB, props)
return super().create(*children, **props)
class HighLevelSlider(SliderRoot):
"""High-level wrapper for the Slider component."""
@classmethod
def create(cls, **props) -> BaseUIComponent:
"""Create a complete slider component.
Args:
**props: Additional properties to apply to the slider component.
Returns:
The slider component.
"""
return SliderRoot.create(
SliderControl.create(
SliderTrack.create(
SliderIndicator.create(),
SliderThumb.create(),
),
),
**props,
)
class Slider(ComponentNamespace):
"""Namespace for Slider components."""
root = staticmethod(SliderRoot.create)
|
control = staticmethod(SliderControl.create)
track = staticmethod(SliderTrack.create)
indicator = staticmethod(SliderIndicator.create)
thumb = staticmethod(SliderThumb.create)
class_names = ClassNames
__call__ = staticmethod(HighLevelSlider.create)
slider = Slider()
| value = staticmethod(SliderValue.create) |
eUIComponent:
"""Create the slider thumb component."""
props["data-slot"] = "slider-thumb"
cls.set_class_name(ClassNames.THUMB, props)
return super().create(*children, **props)
class HighLevelSlider(SliderRoot):
"""High-level wrapper for the Slider component."""
@classmethod
def create(cls, **props) -> BaseUIComponent:
"""Create a complete slider component.
Args:
**props: Additional properties to apply to the slider component.
Returns:
The slider component.
"""
return SliderRoot.create(
SliderControl.create(
SliderTrack.create(
SliderIndicator.create(),
SliderThumb.create(),
),
),
**props,
)
class Slider(ComponentNamespace):
"""Namespace for Slider components."""
root = staticmethod(SliderRoot.create)
value = staticmethod(SliderValue.create)
|
track = staticmethod(SliderTrack.create)
indicator = staticmethod(SliderIndicator.create)
thumb = staticmethod(SliderThumb.create)
class_names = ClassNames
__call__ = staticmethod(HighLevelSlider.create)
slider = Slider()
| control = staticmethod(SliderControl.create) |
component."""
props["data-slot"] = "slider-thumb"
cls.set_class_name(ClassNames.THUMB, props)
return super().create(*children, **props)
class HighLevelSlider(SliderRoot):
"""High-level wrapper for the Slider component."""
@classmethod
def create(cls, **props) -> BaseUIComponent:
"""Create a complete slider component.
Args:
**props: Additional properties to apply to the slider component.
Returns:
The slider component.
"""
return SliderRoot.create(
SliderControl.create(
SliderTrack.create(
SliderIndicator.create(),
SliderThumb.create(),
),
),
**props,
)
class Slider(ComponentNamespace):
"""Namespace for Slider components."""
root = staticmethod(SliderRoot.create)
value = staticmethod(SliderValue.create)
control = staticmethod(SliderControl.create)
|
indicator = staticmethod(SliderIndicator.create)
thumb = staticmethod(SliderThumb.create)
class_names = ClassNames
__call__ = staticmethod(HighLevelSlider.create)
slider = Slider()
| track = staticmethod(SliderTrack.create) |
lider-thumb"
cls.set_class_name(ClassNames.THUMB, props)
return super().create(*children, **props)
class HighLevelSlider(SliderRoot):
"""High-level wrapper for the Slider component."""
@classmethod
def create(cls, **props) -> BaseUIComponent:
"""Create a complete slider component.
Args:
**props: Additional properties to apply to the slider component.
Returns:
The slider component.
"""
return SliderRoot.create(
SliderControl.create(
SliderTrack.create(
SliderIndicator.create(),
SliderThumb.create(),
),
),
**props,
)
class Slider(ComponentNamespace):
"""Namespace for Slider components."""
root = staticmethod(SliderRoot.create)
value = staticmethod(SliderValue.create)
control = staticmethod(SliderControl.create)
track = staticmethod(SliderTrack.create)
|
thumb = staticmethod(SliderThumb.create)
class_names = ClassNames
__call__ = staticmethod(HighLevelSlider.create)
slider = Slider()
| indicator = staticmethod(SliderIndicator.create) |
UMB, props)
return super().create(*children, **props)
class HighLevelSlider(SliderRoot):
"""High-level wrapper for the Slider component."""
@classmethod
def create(cls, **props) -> BaseUIComponent:
"""Create a complete slider component.
Args:
**props: Additional properties to apply to the slider component.
Returns:
The slider component.
"""
return SliderRoot.create(
SliderControl.create(
SliderTrack.create(
SliderIndicator.create(),
SliderThumb.create(),
),
),
**props,
)
class Slider(ComponentNamespace):
"""Namespace for Slider components."""
root = staticmethod(SliderRoot.create)
value = staticmethod(SliderValue.create)
control = staticmethod(SliderControl.create)
track = staticmethod(SliderTrack.create)
indicator = staticmethod(SliderIndicator.create)
|
class_names = ClassNames
__call__ = staticmethod(HighLevelSlider.create)
slider = Slider()
| thumb = staticmethod(SliderThumb.create) |
ildren, **props)
class HighLevelSlider(SliderRoot):
"""High-level wrapper for the Slider component."""
@classmethod
def create(cls, **props) -> BaseUIComponent:
"""Create a complete slider component.
Args:
**props: Additional properties to apply to the slider component.
Returns:
The slider component.
"""
return SliderRoot.create(
SliderControl.create(
SliderTrack.create(
SliderIndicator.create(),
SliderThumb.create(),
),
),
**props,
)
class Slider(ComponentNamespace):
"""Namespace for Slider components."""
root = staticmethod(SliderRoot.create)
value = staticmethod(SliderValue.create)
control = staticmethod(SliderControl.create)
track = staticmethod(SliderTrack.create)
indicator = staticmethod(SliderIndicator.create)
thumb = staticmethod(SliderThumb.create)
|
__call__ = staticmethod(HighLevelSlider.create)
slider = Slider()
| class_names = ClassNames |
LevelSlider(SliderRoot):
"""High-level wrapper for the Slider component."""
@classmethod
def create(cls, **props) -> BaseUIComponent:
"""Create a complete slider component.
Args:
**props: Additional properties to apply to the slider component.
Returns:
The slider component.
"""
return SliderRoot.create(
SliderControl.create(
SliderTrack.create(
SliderIndicator.create(),
SliderThumb.create(),
),
),
**props,
)
class Slider(ComponentNamespace):
"""Namespace for Slider components."""
root = staticmethod(SliderRoot.create)
value = staticmethod(SliderValue.create)
control = staticmethod(SliderControl.create)
track = staticmethod(SliderTrack.create)
indicator = staticmethod(SliderIndicator.create)
thumb = staticmethod(SliderThumb.create)
class_names = ClassNames
|
slider = Slider()
| __call__ = staticmethod(HighLevelSlider.create) |
for the Slider component."""
@classmethod
def create(cls, **props) -> BaseUIComponent:
"""Create a complete slider component.
Args:
**props: Additional properties to apply to the slider component.
Returns:
The slider component.
"""
return SliderRoot.create(
SliderControl.create(
SliderTrack.create(
SliderIndicator.create(),
SliderThumb.create(),
),
),
**props,
)
class Slider(ComponentNamespace):
"""Namespace for Slider components."""
root = staticmethod(SliderRoot.create)
value = staticmethod(SliderValue.create)
control = staticmethod(SliderControl.create)
track = staticmethod(SliderTrack.create)
indicator = staticmethod(SliderIndicator.create)
thumb = staticmethod(SliderThumb.create)
class_names = ClassNames
__call__ = staticmethod(HighLevelSlider.create)
| slider = Slider() | |
"""Custom switch component."""
|
from reflex.event import EventHandler, passthrough_event_spec
from reflex.utils.imports import ImportVar
from reflex.vars.base import Var
from reflex_ui.components.base_ui import PACKAGE_NAME, BaseUIComponent
class ClassNames:
"""Class names for switch components."""
ROOT = "relative flex h-5 w-8 rounded-full bg-secondary-4 p-0.5 transition-colors duration-200 ease-out before:absolute before:rounded-full before:outline-offset-2 before:outline-primary-8 focus-visible:before:inset-0 data-[checked]:bg-primary-9 disabled:opacity-50 disabled:cursor-not-allowed cursor-default"
THUMB = "aspect-square h-full rounded-full bg-white transition-transform duration-200 ease-out data-[checked]:translate-x-3 shadow-small"
class SwitchBaseComponent(BaseUIComponent):
"""Base component for switch components."""
library = f"{PACKAGE_NAME}/switch"
@property
def import_var(self):
"""Return the import variable for the switch component."""
return ImportVar( | from reflex.components.component import Component, ComponentNamespace |
"""Custom switch component."""
from reflex.components.component import Component, ComponentNamespace
|
from reflex.utils.imports import ImportVar
from reflex.vars.base import Var
from reflex_ui.components.base_ui import PACKAGE_NAME, BaseUIComponent
class ClassNames:
"""Class names for switch components."""
ROOT = "relative flex h-5 w-8 rounded-full bg-secondary-4 p-0.5 transition-colors duration-200 ease-out before:absolute before:rounded-full before:outline-offset-2 before:outline-primary-8 focus-visible:before:inset-0 data-[checked]:bg-primary-9 disabled:opacity-50 disabled:cursor-not-allowed cursor-default"
THUMB = "aspect-square h-full rounded-full bg-white transition-transform duration-200 ease-out data-[checked]:translate-x-3 shadow-small"
class SwitchBaseComponent(BaseUIComponent):
"""Base component for switch components."""
library = f"{PACKAGE_NAME}/switch"
@property
def import_var(self):
"""Return the import variable for the switch component."""
return ImportVar(tag="Switch", package_path="", install=False)
class SwitchRo | from reflex.event import EventHandler, passthrough_event_spec |
"""Custom switch component."""
from reflex.components.component import Component, ComponentNamespace
from reflex.event import EventHandler, passthrough_event_spec
|
from reflex.vars.base import Var
from reflex_ui.components.base_ui import PACKAGE_NAME, BaseUIComponent
class ClassNames:
"""Class names for switch components."""
ROOT = "relative flex h-5 w-8 rounded-full bg-secondary-4 p-0.5 transition-colors duration-200 ease-out before:absolute before:rounded-full before:outline-offset-2 before:outline-primary-8 focus-visible:before:inset-0 data-[checked]:bg-primary-9 disabled:opacity-50 disabled:cursor-not-allowed cursor-default"
THUMB = "aspect-square h-full rounded-full bg-white transition-transform duration-200 ease-out data-[checked]:translate-x-3 shadow-small"
class SwitchBaseComponent(BaseUIComponent):
"""Base component for switch components."""
library = f"{PACKAGE_NAME}/switch"
@property
def import_var(self):
"""Return the import variable for the switch component."""
return ImportVar(tag="Switch", package_path="", install=False)
class SwitchRoot(SwitchBaseComponent):
"""Represents | from reflex.utils.imports import ImportVar |
"""Custom switch component."""
from reflex.components.component import Component, ComponentNamespace
from reflex.event import EventHandler, passthrough_event_spec
from reflex.utils.imports import ImportVar
|
from reflex_ui.components.base_ui import PACKAGE_NAME, BaseUIComponent
class ClassNames:
"""Class names for switch components."""
ROOT = "relative flex h-5 w-8 rounded-full bg-secondary-4 p-0.5 transition-colors duration-200 ease-out before:absolute before:rounded-full before:outline-offset-2 before:outline-primary-8 focus-visible:before:inset-0 data-[checked]:bg-primary-9 disabled:opacity-50 disabled:cursor-not-allowed cursor-default"
THUMB = "aspect-square h-full rounded-full bg-white transition-transform duration-200 ease-out data-[checked]:translate-x-3 shadow-small"
class SwitchBaseComponent(BaseUIComponent):
"""Base component for switch components."""
library = f"{PACKAGE_NAME}/switch"
@property
def import_var(self):
"""Return the import variable for the switch component."""
return ImportVar(tag="Switch", package_path="", install=False)
class SwitchRoot(SwitchBaseComponent):
"""Represents the switch itself. Renders a butt | from reflex.vars.base import Var |
"""Custom switch component."""
from reflex.components.component import Component, ComponentNamespace
from reflex.event import EventHandler, passthrough_event_spec
from reflex.utils.imports import ImportVar
from reflex.vars.base import Var
|
class ClassNames:
"""Class names for switch components."""
ROOT = "relative flex h-5 w-8 rounded-full bg-secondary-4 p-0.5 transition-colors duration-200 ease-out before:absolute before:rounded-full before:outline-offset-2 before:outline-primary-8 focus-visible:before:inset-0 data-[checked]:bg-primary-9 disabled:opacity-50 disabled:cursor-not-allowed cursor-default"
THUMB = "aspect-square h-full rounded-full bg-white transition-transform duration-200 ease-out data-[checked]:translate-x-3 shadow-small"
class SwitchBaseComponent(BaseUIComponent):
"""Base component for switch components."""
library = f"{PACKAGE_NAME}/switch"
@property
def import_var(self):
"""Return the import variable for the switch component."""
return ImportVar(tag="Switch", package_path="", install=False)
class SwitchRoot(SwitchBaseComponent):
"""Represents the switch itself. Renders a button element and a hidden input beside."""
tag = "Switch.Root"
# | from reflex_ui.components.base_ui import PACKAGE_NAME, BaseUIComponent |
"""Custom switch component."""
from reflex.components.component import Component, ComponentNamespace
from reflex.event import EventHandler, passthrough_event_spec
from reflex.utils.imports import ImportVar
from reflex.vars.base import Var
from reflex_ui.components.base_ui import PACKAGE_NAME, BaseUIComponent
class ClassNames:
"""Class names for switch components."""
|
THUMB = "aspect-square h-full rounded-full bg-white transition-transform duration-200 ease-out data-[checked]:translate-x-3 shadow-small"
class SwitchBaseComponent(BaseUIComponent):
"""Base component for switch components."""
library = f"{PACKAGE_NAME}/switch"
@property
def import_var(self):
"""Return the import variable for the switch component."""
return ImportVar(tag="Switch", package_path="", install=False)
class SwitchRoot(SwitchBaseComponent):
"""Represents the switch itself. Renders a button element and a hidden input beside."""
tag = "Switch.Root"
# Identifies the field when a form is submitted.
name: Var[str]
# Whether the switch is initially active. To render a controlled switch, use the checked prop instead. Defaults to False.
default_checked: Var[bool]
# Whether the switch is currently active. To render an uncontrolled switch, use the default_checked prop instead.
checked: Var[bool]
# Event | ROOT = "relative flex h-5 w-8 rounded-full bg-secondary-4 p-0.5 transition-colors duration-200 ease-out before:absolute before:rounded-full before:outline-offset-2 before:outline-primary-8 focus-visible:before:inset-0 data-[checked]:bg-primary-9 disabled:opacity-50 disabled:cursor-not-allowed cursor-default" |
"""Custom switch component."""
from reflex.components.component import Component, ComponentNamespace
from reflex.event import EventHandler, passthrough_event_spec
from reflex.utils.imports import ImportVar
from reflex.vars.base import Var
from reflex_ui.components.base_ui import PACKAGE_NAME, BaseUIComponent
class ClassNames:
"""Class names for switch components."""
ROOT = "relative flex h-5 w-8 rounded-full bg-secondary-4 p-0.5 transition-colors duration-200 ease-out before:absolute before:rounded-full before:outline-offset-2 before:outline-primary-8 focus-visible:before:inset-0 data-[checked]:bg-primary-9 disabled:opacity-50 disabled:cursor-not-allowed cursor-default"
|
class SwitchBaseComponent(BaseUIComponent):
"""Base component for switch components."""
library = f"{PACKAGE_NAME}/switch"
@property
def import_var(self):
"""Return the import variable for the switch component."""
return ImportVar(tag="Switch", package_path="", install=False)
class SwitchRoot(SwitchBaseComponent):
"""Represents the switch itself. Renders a button element and a hidden input beside."""
tag = "Switch.Root"
# Identifies the field when a form is submitted.
name: Var[str]
# Whether the switch is initially active. To render a controlled switch, use the checked prop instead. Defaults to False.
default_checked: Var[bool]
# Whether the switch is currently active. To render an uncontrolled switch, use the default_checked prop instead.
checked: Var[bool]
# Event handler called when the switch is activated or deactivated.
on_checked_change: EventHandler[passthrough_event_spec(bool)]
# Whether t | THUMB = "aspect-square h-full rounded-full bg-white transition-transform duration-200 ease-out data-[checked]:translate-x-3 shadow-small" |
"""Custom switch component."""
from reflex.components.component import Component, ComponentNamespace
from reflex.event import EventHandler, passthrough_event_spec
from reflex.utils.imports import ImportVar
from reflex.vars.base import Var
from reflex_ui.components.base_ui import PACKAGE_NAME, BaseUIComponent
class ClassNames:
"""Class names for switch components."""
ROOT = "relative flex h-5 w-8 rounded-full bg-secondary-4 p-0.5 transition-colors duration-200 ease-out before:absolute before:rounded-full before:outline-offset-2 before:outline-primary-8 focus-visible:before:inset-0 data-[checked]:bg-primary-9 disabled:opacity-50 disabled:cursor-not-allowed cursor-default"
THUMB = "aspect-square h-full rounded-full bg-white transition-transform duration-200 ease-out data-[checked]:translate-x-3 shadow-small"
|
class SwitchRoot(SwitchBaseComponent):
"""Represents the switch itself. Renders a button element and a hidden input beside."""
tag = "Switch.Root"
# Identifies the field when a form is submitted.
name: Var[str]
# Whether the switch is initially active. To render a controlled switch, use the checked prop instead. Defaults to False.
default_checked: Var[bool]
# Whether the switch is currently active. To render an uncontrolled switch, use the default_checked prop instead.
checked: Var[bool]
# Event handler called when the switch is activated or deactivated.
on_checked_change: EventHandler[passthrough_event_spec(bool)]
# Whether the component renders a native <button> element when replacing it via the render prop. Set to false if the rendered element is not a button (e.g. <div>). Defaults to True.
native_button: Var[bool]
# Whether the component should ignore user interaction. Defaults to False.
disabled: Var[bool]
# Wh | class SwitchBaseComponent(BaseUIComponent):
"""Base component for switch components."""
library = f"{PACKAGE_NAME}/switch"
@property
def import_var(self):
"""Return the import variable for the switch component."""
return ImportVar(tag="Switch", package_path="", install=False) |
"""Custom switch component."""
from reflex.components.component import Component, ComponentNamespace
from reflex.event import EventHandler, passthrough_event_spec
from reflex.utils.imports import ImportVar
from reflex.vars.base import Var
from reflex_ui.components.base_ui import PACKAGE_NAME, BaseUIComponent
class ClassNames:
"""Class names for switch components."""
ROOT = "relative flex h-5 w-8 rounded-full bg-secondary-4 p-0.5 transition-colors duration-200 ease-out before:absolute before:rounded-full before:outline-offset-2 before:outline-primary-8 focus-visible:before:inset-0 data-[checked]:bg-primary-9 disabled:opacity-50 disabled:cursor-not-allowed cursor-default"
THUMB = "aspect-square h-full rounded-full bg-white transition-transform duration-200 ease-out data-[checked]:translate-x-3 shadow-small"
class SwitchBaseComponent(BaseUIComponent):
"""Base component for switch components."""
|
@property
def import_var(self):
"""Return the import variable for the switch component."""
return ImportVar(tag="Switch", package_path="", install=False)
class SwitchRoot(SwitchBaseComponent):
"""Represents the switch itself. Renders a button element and a hidden input beside."""
tag = "Switch.Root"
# Identifies the field when a form is submitted.
name: Var[str]
# Whether the switch is initially active. To render a controlled switch, use the checked prop instead. Defaults to False.
default_checked: Var[bool]
# Whether the switch is currently active. To render an uncontrolled switch, use the default_checked prop instead.
checked: Var[bool]
# Event handler called when the switch is activated or deactivated.
on_checked_change: EventHandler[passthrough_event_spec(bool)]
# Whether the component renders a native <button> element when replacing it via the render prop. Set to false if the rendered element is not a bu | library = f"{PACKAGE_NAME}/switch" |
"""Custom switch component."""
from reflex.components.component import Component, ComponentNamespace
from reflex.event import EventHandler, passthrough_event_spec
from reflex.utils.imports import ImportVar
from reflex.vars.base import Var
from reflex_ui.components.base_ui import PACKAGE_NAME, BaseUIComponent
class ClassNames:
"""Class names for switch components."""
ROOT = "relative flex h-5 w-8 rounded-full bg-secondary-4 p-0.5 transition-colors duration-200 ease-out before:absolute before:rounded-full before:outline-offset-2 before:outline-primary-8 focus-visible:before:inset-0 data-[checked]:bg-primary-9 disabled:opacity-50 disabled:cursor-not-allowed cursor-default"
THUMB = "aspect-square h-full rounded-full bg-white transition-transform duration-200 ease-out data-[checked]:translate-x-3 shadow-small"
class SwitchBaseComponent(BaseUIComponent):
"""Base component for switch components."""
library = f"{PACKAGE_NAME}/switch"
@property
|
class SwitchRoot(SwitchBaseComponent):
"""Represents the switch itself. Renders a button element and a hidden input beside."""
tag = "Switch.Root"
# Identifies the field when a form is submitted.
name: Var[str]
# Whether the switch is initially active. To render a controlled switch, use the checked prop instead. Defaults to False.
default_checked: Var[bool]
# Whether the switch is currently active. To render an uncontrolled switch, use the default_checked prop instead.
checked: Var[bool]
# Event handler called when the switch is activated or deactivated.
on_checked_change: EventHandler[passthrough_event_spec(bool)]
# Whether the component renders a native <button> element when replacing it via the render prop. Set to false if the rendered element is not a button (e.g. <div>). Defaults to True.
native_button: Var[bool]
# Whether the component should ignore user interaction. Defaults to False.
disabled: Var[bool]
# Wh | def import_var(self):
"""Return the import variable for the switch component."""
return ImportVar(tag="Switch", package_path="", install=False) |
KAGE_NAME, BaseUIComponent
class ClassNames:
"""Class names for switch components."""
ROOT = "relative flex h-5 w-8 rounded-full bg-secondary-4 p-0.5 transition-colors duration-200 ease-out before:absolute before:rounded-full before:outline-offset-2 before:outline-primary-8 focus-visible:before:inset-0 data-[checked]:bg-primary-9 disabled:opacity-50 disabled:cursor-not-allowed cursor-default"
THUMB = "aspect-square h-full rounded-full bg-white transition-transform duration-200 ease-out data-[checked]:translate-x-3 shadow-small"
class SwitchBaseComponent(BaseUIComponent):
"""Base component for switch components."""
library = f"{PACKAGE_NAME}/switch"
@property
def import_var(self):
"""Return the import variable for the switch component."""
return ImportVar(tag="Switch", package_path="", install=False)
class SwitchRoot(SwitchBaseComponent):
"""Represents the switch itself. Renders a button element and a hidden input beside."""
|
# Identifies the field when a form is submitted.
name: Var[str]
# Whether the switch is initially active. To render a controlled switch, use the checked prop instead. Defaults to False.
default_checked: Var[bool]
# Whether the switch is currently active. To render an uncontrolled switch, use the default_checked prop instead.
checked: Var[bool]
# Event handler called when the switch is activated or deactivated.
on_checked_change: EventHandler[passthrough_event_spec(bool)]
# Whether the component renders a native <button> element when replacing it via the render prop. Set to false if the rendered element is not a button (e.g. <div>). Defaults to True.
native_button: Var[bool]
# Whether the component should ignore user interaction. Defaults to False.
disabled: Var[bool]
# Whether the user should be unable to activate or deactivate the switch. Defaults to False.
read_only: Var[bool]
# Whether the user must activate the sw | tag = "Switch.Root" |
Var[bool]
# Whether the switch is currently active. To render an uncontrolled switch, use the default_checked prop instead.
checked: Var[bool]
# Event handler called when the switch is activated or deactivated.
on_checked_change: EventHandler[passthrough_event_spec(bool)]
# Whether the component renders a native <button> element when replacing it via the render prop. Set to false if the rendered element is not a button (e.g. <div>). Defaults to True.
native_button: Var[bool]
# Whether the component should ignore user interaction. Defaults to False.
disabled: Var[bool]
# Whether the user should be unable to activate or deactivate the switch. Defaults to False.
read_only: Var[bool]
# Whether the user must activate the switch before submitting a form. Defaults to False.
required: Var[bool]
# A ref to access the hidden <input> element.
input_ref: Var[str]
# The render prop
render_: Var[Component]
@classmethod
|
class SwitchThumb(SwitchBaseComponent):
"""The movable part of the switch that indicates whether the switch is on or off. Renders a span."""
tag = "Switch.Thumb"
# The render prop
render_: Var[Component]
@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create the switch thumb component."""
props["data-slot"] = "switch-thumb"
cls.set_class_name(ClassNames.THUMB, props)
return super().create(*children, **props)
class HighLevelSwitch(SwitchRoot):
"""High-level wrapper for the Switch component."""
@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create a complete switch component.
Args:
*children: Additional children to include in the switch.
**props: Additional properties to apply to the switch component.
Returns:
The switch component.
"""
return SwitchRoot.create(
SwitchThumb.cr | def create(cls, *children, **props) -> BaseUIComponent:
"""Create the switch root component."""
props["data-slot"] = "switch"
cls.set_class_name(ClassNames.ROOT, props)
return super().create(*children, **props) |
ed prop instead.
checked: Var[bool]
# Event handler called when the switch is activated or deactivated.
on_checked_change: EventHandler[passthrough_event_spec(bool)]
# Whether the component renders a native <button> element when replacing it via the render prop. Set to false if the rendered element is not a button (e.g. <div>). Defaults to True.
native_button: Var[bool]
# Whether the component should ignore user interaction. Defaults to False.
disabled: Var[bool]
# Whether the user should be unable to activate or deactivate the switch. Defaults to False.
read_only: Var[bool]
# Whether the user must activate the switch before submitting a form. Defaults to False.
required: Var[bool]
# A ref to access the hidden <input> element.
input_ref: Var[str]
# The render prop
render_: Var[Component]
@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create the switch root component."""
|
cls.set_class_name(ClassNames.ROOT, props)
return super().create(*children, **props)
class SwitchThumb(SwitchBaseComponent):
"""The movable part of the switch that indicates whether the switch is on or off. Renders a span."""
tag = "Switch.Thumb"
# The render prop
render_: Var[Component]
@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create the switch thumb component."""
props["data-slot"] = "switch-thumb"
cls.set_class_name(ClassNames.THUMB, props)
return super().create(*children, **props)
class HighLevelSwitch(SwitchRoot):
"""High-level wrapper for the Switch component."""
@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create a complete switch component.
Args:
*children: Additional children to include in the switch.
**props: Additional properties to apply to the switch component.
Returns:
| props["data-slot"] = "switch" |
t to false if the rendered element is not a button (e.g. <div>). Defaults to True.
native_button: Var[bool]
# Whether the component should ignore user interaction. Defaults to False.
disabled: Var[bool]
# Whether the user should be unable to activate or deactivate the switch. Defaults to False.
read_only: Var[bool]
# Whether the user must activate the switch before submitting a form. Defaults to False.
required: Var[bool]
# A ref to access the hidden <input> element.
input_ref: Var[str]
# The render prop
render_: Var[Component]
@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create the switch root component."""
props["data-slot"] = "switch"
cls.set_class_name(ClassNames.ROOT, props)
return super().create(*children, **props)
class SwitchThumb(SwitchBaseComponent):
"""The movable part of the switch that indicates whether the switch is on or off. Renders a span."""
|
# The render prop
render_: Var[Component]
@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create the switch thumb component."""
props["data-slot"] = "switch-thumb"
cls.set_class_name(ClassNames.THUMB, props)
return super().create(*children, **props)
class HighLevelSwitch(SwitchRoot):
"""High-level wrapper for the Switch component."""
@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create a complete switch component.
Args:
*children: Additional children to include in the switch.
**props: Additional properties to apply to the switch component.
Returns:
The switch component.
"""
return SwitchRoot.create(
SwitchThumb.create(),
*children,
**props,
)
class Switch(ComponentNamespace):
"""Namespace for Switch components."""
root = staticmethod(SwitchR | tag = "Switch.Thumb" |
button: Var[bool]
# Whether the component should ignore user interaction. Defaults to False.
disabled: Var[bool]
# Whether the user should be unable to activate or deactivate the switch. Defaults to False.
read_only: Var[bool]
# Whether the user must activate the switch before submitting a form. Defaults to False.
required: Var[bool]
# A ref to access the hidden <input> element.
input_ref: Var[str]
# The render prop
render_: Var[Component]
@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create the switch root component."""
props["data-slot"] = "switch"
cls.set_class_name(ClassNames.ROOT, props)
return super().create(*children, **props)
class SwitchThumb(SwitchBaseComponent):
"""The movable part of the switch that indicates whether the switch is on or off. Renders a span."""
tag = "Switch.Thumb"
# The render prop
render_: Var[Component]
@classmethod
|
class HighLevelSwitch(SwitchRoot):
"""High-level wrapper for the Switch component."""
@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create a complete switch component.
Args:
*children: Additional children to include in the switch.
**props: Additional properties to apply to the switch component.
Returns:
The switch component.
"""
return SwitchRoot.create(
SwitchThumb.create(),
*children,
**props,
)
class Switch(ComponentNamespace):
"""Namespace for Switch components."""
root = staticmethod(SwitchRoot.create)
thumb = staticmethod(SwitchThumb.create)
class_names = ClassNames
__call__ = staticmethod(HighLevelSwitch.create)
switch = Switch()
| def create(cls, *children, **props) -> BaseUIComponent:
"""Create the switch thumb component."""
props["data-slot"] = "switch-thumb"
cls.set_class_name(ClassNames.THUMB, props)
return super().create(*children, **props) |
ar[bool]
# Whether the user should be unable to activate or deactivate the switch. Defaults to False.
read_only: Var[bool]
# Whether the user must activate the switch before submitting a form. Defaults to False.
required: Var[bool]
# A ref to access the hidden <input> element.
input_ref: Var[str]
# The render prop
render_: Var[Component]
@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create the switch root component."""
props["data-slot"] = "switch"
cls.set_class_name(ClassNames.ROOT, props)
return super().create(*children, **props)
class SwitchThumb(SwitchBaseComponent):
"""The movable part of the switch that indicates whether the switch is on or off. Renders a span."""
tag = "Switch.Thumb"
# The render prop
render_: Var[Component]
@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create the switch thumb component."""
|
cls.set_class_name(ClassNames.THUMB, props)
return super().create(*children, **props)
class HighLevelSwitch(SwitchRoot):
"""High-level wrapper for the Switch component."""
@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create a complete switch component.
Args:
*children: Additional children to include in the switch.
**props: Additional properties to apply to the switch component.
Returns:
The switch component.
"""
return SwitchRoot.create(
SwitchThumb.create(),
*children,
**props,
)
class Switch(ComponentNamespace):
"""Namespace for Switch components."""
root = staticmethod(SwitchRoot.create)
thumb = staticmethod(SwitchThumb.create)
class_names = ClassNames
__call__ = staticmethod(HighLevelSwitch.create)
switch = Switch()
| props["data-slot"] = "switch-thumb" |
"
tag = "Switch.Thumb"
# The render prop
render_: Var[Component]
@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create the switch thumb component."""
props["data-slot"] = "switch-thumb"
cls.set_class_name(ClassNames.THUMB, props)
return super().create(*children, **props)
class HighLevelSwitch(SwitchRoot):
"""High-level wrapper for the Switch component."""
@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create a complete switch component.
Args:
*children: Additional children to include in the switch.
**props: Additional properties to apply to the switch component.
Returns:
The switch component.
"""
return SwitchRoot.create(
SwitchThumb.create(),
*children,
**props,
)
class Switch(ComponentNamespace):
"""Namespace for Switch components."""
|
thumb = staticmethod(SwitchThumb.create)
class_names = ClassNames
__call__ = staticmethod(HighLevelSwitch.create)
switch = Switch()
| root = staticmethod(SwitchRoot.create) |
ssmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create the switch thumb component."""
props["data-slot"] = "switch-thumb"
cls.set_class_name(ClassNames.THUMB, props)
return super().create(*children, **props)
class HighLevelSwitch(SwitchRoot):
"""High-level wrapper for the Switch component."""
@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create a complete switch component.
Args:
*children: Additional children to include in the switch.
**props: Additional properties to apply to the switch component.
Returns:
The switch component.
"""
return SwitchRoot.create(
SwitchThumb.create(),
*children,
**props,
)
class Switch(ComponentNamespace):
"""Namespace for Switch components."""
root = staticmethod(SwitchRoot.create)
thumb = staticmethod(SwitchThumb.create)
|
__call__ = staticmethod(HighLevelSwitch.create)
switch = Switch()
| class_names = ClassNames |
*children, **props) -> BaseUIComponent:
"""Create the switch thumb component."""
props["data-slot"] = "switch-thumb"
cls.set_class_name(ClassNames.THUMB, props)
return super().create(*children, **props)
class HighLevelSwitch(SwitchRoot):
"""High-level wrapper for the Switch component."""
@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create a complete switch component.
Args:
*children: Additional children to include in the switch.
**props: Additional properties to apply to the switch component.
Returns:
The switch component.
"""
return SwitchRoot.create(
SwitchThumb.create(),
*children,
**props,
)
class Switch(ComponentNamespace):
"""Namespace for Switch components."""
root = staticmethod(SwitchRoot.create)
thumb = staticmethod(SwitchThumb.create)
class_names = ClassNames
|
switch = Switch()
| __call__ = staticmethod(HighLevelSwitch.create) |
"Create the switch thumb component."""
props["data-slot"] = "switch-thumb"
cls.set_class_name(ClassNames.THUMB, props)
return super().create(*children, **props)
class HighLevelSwitch(SwitchRoot):
"""High-level wrapper for the Switch component."""
@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create a complete switch component.
Args:
*children: Additional children to include in the switch.
**props: Additional properties to apply to the switch component.
Returns:
The switch component.
"""
return SwitchRoot.create(
SwitchThumb.create(),
*children,
**props,
)
class Switch(ComponentNamespace):
"""Namespace for Switch components."""
root = staticmethod(SwitchRoot.create)
thumb = staticmethod(SwitchThumb.create)
class_names = ClassNames
__call__ = staticmethod(HighLevelSwitch.create)
| switch = Switch() | |
"""Custom tabs component."""
|
from reflex.components.component import Component, ComponentNamespace
from reflex.event import EventHandler, passthrough_event_spec
from reflex.utils.imports import ImportVar
from reflex.vars.base import Var
from reflex_ui.components.base_ui import PACKAGE_NAME, BaseUIComponent
LiteralOrientation = Literal["horizontal", "vertical"]
class ClassNames:
"""Class names for tabs components."""
ROOT = "flex flex-col gap-2"
LIST = "bg-secondary-3 inline-flex gap-1 p-1 items-center justify-start rounded-ui-md relative z-0"
TAB = "h-7 px-1.5 rounded-ui-sm justify-center items-center gap-1.5 inline-flex text-sm font-medium text-secondary-11 cursor-pointer z-[1] hover:text-secondary-12 transition-color text-nowrap data-[selected]:text-secondary-12 data-[disabled]:cursor-not-allowed data-[disabled]:text-secondary-8"
INDICATOR = "absolute top-1/2 left-0 -z-1 h-7 w-(--active-tab-width) -translate-y-1/2 translate-x-(--active-tab-left) rounded-ui-sm bg-secondary-1 shadow-smal | from typing import Literal |
"""Custom tabs component."""
from typing import Literal
|
from reflex.event import EventHandler, passthrough_event_spec
from reflex.utils.imports import ImportVar
from reflex.vars.base import Var
from reflex_ui.components.base_ui import PACKAGE_NAME, BaseUIComponent
LiteralOrientation = Literal["horizontal", "vertical"]
class ClassNames:
"""Class names for tabs components."""
ROOT = "flex flex-col gap-2"
LIST = "bg-secondary-3 inline-flex gap-1 p-1 items-center justify-start rounded-ui-md relative z-0"
TAB = "h-7 px-1.5 rounded-ui-sm justify-center items-center gap-1.5 inline-flex text-sm font-medium text-secondary-11 cursor-pointer z-[1] hover:text-secondary-12 transition-color text-nowrap data-[selected]:text-secondary-12 data-[disabled]:cursor-not-allowed data-[disabled]:text-secondary-8"
INDICATOR = "absolute top-1/2 left-0 -z-1 h-7 w-(--active-tab-width) -translate-y-1/2 translate-x-(--active-tab-left) rounded-ui-sm bg-secondary-1 shadow-small transition-all duration-200 ease-in-out"
PANEL = "flex flex-col g | from reflex.components.component import Component, ComponentNamespace |
"""Custom tabs component."""
from typing import Literal
from reflex.components.component import Component, ComponentNamespace
|
from reflex.utils.imports import ImportVar
from reflex.vars.base import Var
from reflex_ui.components.base_ui import PACKAGE_NAME, BaseUIComponent
LiteralOrientation = Literal["horizontal", "vertical"]
class ClassNames:
"""Class names for tabs components."""
ROOT = "flex flex-col gap-2"
LIST = "bg-secondary-3 inline-flex gap-1 p-1 items-center justify-start rounded-ui-md relative z-0"
TAB = "h-7 px-1.5 rounded-ui-sm justify-center items-center gap-1.5 inline-flex text-sm font-medium text-secondary-11 cursor-pointer z-[1] hover:text-secondary-12 transition-color text-nowrap data-[selected]:text-secondary-12 data-[disabled]:cursor-not-allowed data-[disabled]:text-secondary-8"
INDICATOR = "absolute top-1/2 left-0 -z-1 h-7 w-(--active-tab-width) -translate-y-1/2 translate-x-(--active-tab-left) rounded-ui-sm bg-secondary-1 shadow-small transition-all duration-200 ease-in-out"
PANEL = "flex flex-col gap-2"
class TabsBaseComponent(BaseUIComponent):
"""Base | from reflex.event import EventHandler, passthrough_event_spec |
"""Custom tabs component."""
from typing import Literal
from reflex.components.component import Component, ComponentNamespace
from reflex.event import EventHandler, passthrough_event_spec
|
from reflex.vars.base import Var
from reflex_ui.components.base_ui import PACKAGE_NAME, BaseUIComponent
LiteralOrientation = Literal["horizontal", "vertical"]
class ClassNames:
"""Class names for tabs components."""
ROOT = "flex flex-col gap-2"
LIST = "bg-secondary-3 inline-flex gap-1 p-1 items-center justify-start rounded-ui-md relative z-0"
TAB = "h-7 px-1.5 rounded-ui-sm justify-center items-center gap-1.5 inline-flex text-sm font-medium text-secondary-11 cursor-pointer z-[1] hover:text-secondary-12 transition-color text-nowrap data-[selected]:text-secondary-12 data-[disabled]:cursor-not-allowed data-[disabled]:text-secondary-8"
INDICATOR = "absolute top-1/2 left-0 -z-1 h-7 w-(--active-tab-width) -translate-y-1/2 translate-x-(--active-tab-left) rounded-ui-sm bg-secondary-1 shadow-small transition-all duration-200 ease-in-out"
PANEL = "flex flex-col gap-2"
class TabsBaseComponent(BaseUIComponent):
"""Base component for tabs components."""
libr | from reflex.utils.imports import ImportVar |
"""Custom tabs component."""
from typing import Literal
from reflex.components.component import Component, ComponentNamespace
from reflex.event import EventHandler, passthrough_event_spec
from reflex.utils.imports import ImportVar
|
from reflex_ui.components.base_ui import PACKAGE_NAME, BaseUIComponent
LiteralOrientation = Literal["horizontal", "vertical"]
class ClassNames:
"""Class names for tabs components."""
ROOT = "flex flex-col gap-2"
LIST = "bg-secondary-3 inline-flex gap-1 p-1 items-center justify-start rounded-ui-md relative z-0"
TAB = "h-7 px-1.5 rounded-ui-sm justify-center items-center gap-1.5 inline-flex text-sm font-medium text-secondary-11 cursor-pointer z-[1] hover:text-secondary-12 transition-color text-nowrap data-[selected]:text-secondary-12 data-[disabled]:cursor-not-allowed data-[disabled]:text-secondary-8"
INDICATOR = "absolute top-1/2 left-0 -z-1 h-7 w-(--active-tab-width) -translate-y-1/2 translate-x-(--active-tab-left) rounded-ui-sm bg-secondary-1 shadow-small transition-all duration-200 ease-in-out"
PANEL = "flex flex-col gap-2"
class TabsBaseComponent(BaseUIComponent):
"""Base component for tabs components."""
library = f"{PACKAGE_NAME}/tabs"
| from reflex.vars.base import Var |
"""Custom tabs component."""
from typing import Literal
from reflex.components.component import Component, ComponentNamespace
from reflex.event import EventHandler, passthrough_event_spec
from reflex.utils.imports import ImportVar
from reflex.vars.base import Var
|
LiteralOrientation = Literal["horizontal", "vertical"]
class ClassNames:
"""Class names for tabs components."""
ROOT = "flex flex-col gap-2"
LIST = "bg-secondary-3 inline-flex gap-1 p-1 items-center justify-start rounded-ui-md relative z-0"
TAB = "h-7 px-1.5 rounded-ui-sm justify-center items-center gap-1.5 inline-flex text-sm font-medium text-secondary-11 cursor-pointer z-[1] hover:text-secondary-12 transition-color text-nowrap data-[selected]:text-secondary-12 data-[disabled]:cursor-not-allowed data-[disabled]:text-secondary-8"
INDICATOR = "absolute top-1/2 left-0 -z-1 h-7 w-(--active-tab-width) -translate-y-1/2 translate-x-(--active-tab-left) rounded-ui-sm bg-secondary-1 shadow-small transition-all duration-200 ease-in-out"
PANEL = "flex flex-col gap-2"
class TabsBaseComponent(BaseUIComponent):
"""Base component for tabs components."""
library = f"{PACKAGE_NAME}/tabs"
@property
def import_var(self):
"""Return the import variab | from reflex_ui.components.base_ui import PACKAGE_NAME, BaseUIComponent |
"""Custom tabs component."""
from typing import Literal
from reflex.components.component import Component, ComponentNamespace
from reflex.event import EventHandler, passthrough_event_spec
from reflex.utils.imports import ImportVar
from reflex.vars.base import Var
from reflex_ui.components.base_ui import PACKAGE_NAME, BaseUIComponent
|
class ClassNames:
"""Class names for tabs components."""
ROOT = "flex flex-col gap-2"
LIST = "bg-secondary-3 inline-flex gap-1 p-1 items-center justify-start rounded-ui-md relative z-0"
TAB = "h-7 px-1.5 rounded-ui-sm justify-center items-center gap-1.5 inline-flex text-sm font-medium text-secondary-11 cursor-pointer z-[1] hover:text-secondary-12 transition-color text-nowrap data-[selected]:text-secondary-12 data-[disabled]:cursor-not-allowed data-[disabled]:text-secondary-8"
INDICATOR = "absolute top-1/2 left-0 -z-1 h-7 w-(--active-tab-width) -translate-y-1/2 translate-x-(--active-tab-left) rounded-ui-sm bg-secondary-1 shadow-small transition-all duration-200 ease-in-out"
PANEL = "flex flex-col gap-2"
class TabsBaseComponent(BaseUIComponent):
"""Base component for tabs components."""
library = f"{PACKAGE_NAME}/tabs"
@property
def import_var(self):
"""Return the import variable for the tabs component."""
return ImportVar(t | LiteralOrientation = Literal["horizontal", "vertical"] |
"""Custom tabs component."""
from typing import Literal
from reflex.components.component import Component, ComponentNamespace
from reflex.event import EventHandler, passthrough_event_spec
from reflex.utils.imports import ImportVar
from reflex.vars.base import Var
from reflex_ui.components.base_ui import PACKAGE_NAME, BaseUIComponent
LiteralOrientation = Literal["horizontal", "vertical"]
class ClassNames:
"""Class names for tabs components."""
|
LIST = "bg-secondary-3 inline-flex gap-1 p-1 items-center justify-start rounded-ui-md relative z-0"
TAB = "h-7 px-1.5 rounded-ui-sm justify-center items-center gap-1.5 inline-flex text-sm font-medium text-secondary-11 cursor-pointer z-[1] hover:text-secondary-12 transition-color text-nowrap data-[selected]:text-secondary-12 data-[disabled]:cursor-not-allowed data-[disabled]:text-secondary-8"
INDICATOR = "absolute top-1/2 left-0 -z-1 h-7 w-(--active-tab-width) -translate-y-1/2 translate-x-(--active-tab-left) rounded-ui-sm bg-secondary-1 shadow-small transition-all duration-200 ease-in-out"
PANEL = "flex flex-col gap-2"
class TabsBaseComponent(BaseUIComponent):
"""Base component for tabs components."""
library = f"{PACKAGE_NAME}/tabs"
@property
def import_var(self):
"""Return the import variable for the tabs component."""
return ImportVar(tag="Tabs", package_path="", install=False)
class TabsRoot(TabsBaseComponent):
"""Groups the | ROOT = "flex flex-col gap-2" |
"""Custom tabs component."""
from typing import Literal
from reflex.components.component import Component, ComponentNamespace
from reflex.event import EventHandler, passthrough_event_spec
from reflex.utils.imports import ImportVar
from reflex.vars.base import Var
from reflex_ui.components.base_ui import PACKAGE_NAME, BaseUIComponent
LiteralOrientation = Literal["horizontal", "vertical"]
class ClassNames:
"""Class names for tabs components."""
ROOT = "flex flex-col gap-2"
|
TAB = "h-7 px-1.5 rounded-ui-sm justify-center items-center gap-1.5 inline-flex text-sm font-medium text-secondary-11 cursor-pointer z-[1] hover:text-secondary-12 transition-color text-nowrap data-[selected]:text-secondary-12 data-[disabled]:cursor-not-allowed data-[disabled]:text-secondary-8"
INDICATOR = "absolute top-1/2 left-0 -z-1 h-7 w-(--active-tab-width) -translate-y-1/2 translate-x-(--active-tab-left) rounded-ui-sm bg-secondary-1 shadow-small transition-all duration-200 ease-in-out"
PANEL = "flex flex-col gap-2"
class TabsBaseComponent(BaseUIComponent):
"""Base component for tabs components."""
library = f"{PACKAGE_NAME}/tabs"
@property
def import_var(self):
"""Return the import variable for the tabs component."""
return ImportVar(tag="Tabs", package_path="", install=False)
class TabsRoot(TabsBaseComponent):
"""Groups the tabs and the corresponding panels. Renders a <div> element."""
tag = "Tabs.Root"
# The defaul | LIST = "bg-secondary-3 inline-flex gap-1 p-1 items-center justify-start rounded-ui-md relative z-0" |
"""Custom tabs component."""
from typing import Literal
from reflex.components.component import Component, ComponentNamespace
from reflex.event import EventHandler, passthrough_event_spec
from reflex.utils.imports import ImportVar
from reflex.vars.base import Var
from reflex_ui.components.base_ui import PACKAGE_NAME, BaseUIComponent
LiteralOrientation = Literal["horizontal", "vertical"]
class ClassNames:
"""Class names for tabs components."""
ROOT = "flex flex-col gap-2"
LIST = "bg-secondary-3 inline-flex gap-1 p-1 items-center justify-start rounded-ui-md relative z-0"
|
INDICATOR = "absolute top-1/2 left-0 -z-1 h-7 w-(--active-tab-width) -translate-y-1/2 translate-x-(--active-tab-left) rounded-ui-sm bg-secondary-1 shadow-small transition-all duration-200 ease-in-out"
PANEL = "flex flex-col gap-2"
class TabsBaseComponent(BaseUIComponent):
"""Base component for tabs components."""
library = f"{PACKAGE_NAME}/tabs"
@property
def import_var(self):
"""Return the import variable for the tabs component."""
return ImportVar(tag="Tabs", package_path="", install=False)
class TabsRoot(TabsBaseComponent):
"""Groups the tabs and the corresponding panels. Renders a <div> element."""
tag = "Tabs.Root"
# The default value. Use when the component is not controlled. When the value is null, no Tab will be selected. Defaults to 0.
default_value: Var[str | int]
# The value of the currently selected Tab. Use when the component is controlled. When the value is null, no Tab will be selected.
value: Var[ | TAB = "h-7 px-1.5 rounded-ui-sm justify-center items-center gap-1.5 inline-flex text-sm font-medium text-secondary-11 cursor-pointer z-[1] hover:text-secondary-12 transition-color text-nowrap data-[selected]:text-secondary-12 data-[disabled]:cursor-not-allowed data-[disabled]:text-secondary-8" |
"""Custom tabs component."""
from typing import Literal
from reflex.components.component import Component, ComponentNamespace
from reflex.event import EventHandler, passthrough_event_spec
from reflex.utils.imports import ImportVar
from reflex.vars.base import Var
from reflex_ui.components.base_ui import PACKAGE_NAME, BaseUIComponent
LiteralOrientation = Literal["horizontal", "vertical"]
class ClassNames:
"""Class names for tabs components."""
ROOT = "flex flex-col gap-2"
LIST = "bg-secondary-3 inline-flex gap-1 p-1 items-center justify-start rounded-ui-md relative z-0"
TAB = "h-7 px-1.5 rounded-ui-sm justify-center items-center gap-1.5 inline-flex text-sm font-medium text-secondary-11 cursor-pointer z-[1] hover:text-secondary-12 transition-color text-nowrap data-[selected]:text-secondary-12 data-[disabled]:cursor-not-allowed data-[disabled]:text-secondary-8"
|
PANEL = "flex flex-col gap-2"
class TabsBaseComponent(BaseUIComponent):
"""Base component for tabs components."""
library = f"{PACKAGE_NAME}/tabs"
@property
def import_var(self):
"""Return the import variable for the tabs component."""
return ImportVar(tag="Tabs", package_path="", install=False)
class TabsRoot(TabsBaseComponent):
"""Groups the tabs and the corresponding panels. Renders a <div> element."""
tag = "Tabs.Root"
# The default value. Use when the component is not controlled. When the value is null, no Tab will be selected. Defaults to 0.
default_value: Var[str | int]
# The value of the currently selected Tab. Use when the component is controlled. When the value is null, no Tab will be selected.
value: Var[str | int]
# Callback invoked when new value is being set.
on_value_change: EventHandler[passthrough_event_spec(str | dict)]
# The component orientation (layout flow direction). Defaults to " | INDICATOR = "absolute top-1/2 left-0 -z-1 h-7 w-(--active-tab-width) -translate-y-1/2 translate-x-(--active-tab-left) rounded-ui-sm bg-secondary-1 shadow-small transition-all duration-200 ease-in-out" |
nent, ComponentNamespace
from reflex.event import EventHandler, passthrough_event_spec
from reflex.utils.imports import ImportVar
from reflex.vars.base import Var
from reflex_ui.components.base_ui import PACKAGE_NAME, BaseUIComponent
LiteralOrientation = Literal["horizontal", "vertical"]
class ClassNames:
"""Class names for tabs components."""
ROOT = "flex flex-col gap-2"
LIST = "bg-secondary-3 inline-flex gap-1 p-1 items-center justify-start rounded-ui-md relative z-0"
TAB = "h-7 px-1.5 rounded-ui-sm justify-center items-center gap-1.5 inline-flex text-sm font-medium text-secondary-11 cursor-pointer z-[1] hover:text-secondary-12 transition-color text-nowrap data-[selected]:text-secondary-12 data-[disabled]:cursor-not-allowed data-[disabled]:text-secondary-8"
INDICATOR = "absolute top-1/2 left-0 -z-1 h-7 w-(--active-tab-width) -translate-y-1/2 translate-x-(--active-tab-left) rounded-ui-sm bg-secondary-1 shadow-small transition-all duration-200 ease-in-out"
|
class TabsBaseComponent(BaseUIComponent):
"""Base component for tabs components."""
library = f"{PACKAGE_NAME}/tabs"
@property
def import_var(self):
"""Return the import variable for the tabs component."""
return ImportVar(tag="Tabs", package_path="", install=False)
class TabsRoot(TabsBaseComponent):
"""Groups the tabs and the corresponding panels. Renders a <div> element."""
tag = "Tabs.Root"
# The default value. Use when the component is not controlled. When the value is null, no Tab will be selected. Defaults to 0.
default_value: Var[str | int]
# The value of the currently selected Tab. Use when the component is controlled. When the value is null, no Tab will be selected.
value: Var[str | int]
# Callback invoked when new value is being set.
on_value_change: EventHandler[passthrough_event_spec(str | dict)]
# The component orientation (layout flow direction). Defaults to "horizontal".
orientation: Var[ | PANEL = "flex flex-col gap-2" |
flex.event import EventHandler, passthrough_event_spec
from reflex.utils.imports import ImportVar
from reflex.vars.base import Var
from reflex_ui.components.base_ui import PACKAGE_NAME, BaseUIComponent
LiteralOrientation = Literal["horizontal", "vertical"]
class ClassNames:
"""Class names for tabs components."""
ROOT = "flex flex-col gap-2"
LIST = "bg-secondary-3 inline-flex gap-1 p-1 items-center justify-start rounded-ui-md relative z-0"
TAB = "h-7 px-1.5 rounded-ui-sm justify-center items-center gap-1.5 inline-flex text-sm font-medium text-secondary-11 cursor-pointer z-[1] hover:text-secondary-12 transition-color text-nowrap data-[selected]:text-secondary-12 data-[disabled]:cursor-not-allowed data-[disabled]:text-secondary-8"
INDICATOR = "absolute top-1/2 left-0 -z-1 h-7 w-(--active-tab-width) -translate-y-1/2 translate-x-(--active-tab-left) rounded-ui-sm bg-secondary-1 shadow-small transition-all duration-200 ease-in-out"
PANEL = "flex flex-col gap-2"
|
class TabsRoot(TabsBaseComponent):
"""Groups the tabs and the corresponding panels. Renders a <div> element."""
tag = "Tabs.Root"
# The default value. Use when the component is not controlled. When the value is null, no Tab will be selected. Defaults to 0.
default_value: Var[str | int]
# The value of the currently selected Tab. Use when the component is controlled. When the value is null, no Tab will be selected.
value: Var[str | int]
# Callback invoked when new value is being set.
on_value_change: EventHandler[passthrough_event_spec(str | dict)]
# The component orientation (layout flow direction). Defaults to "horizontal".
orientation: Var[LiteralOrientation]
# The render prop
render_: Var[Component]
@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create the tabs root component."""
props["data-slot"] = "tabs"
cls.set_class_name(ClassNames.ROOT, props)
return super( | class TabsBaseComponent(BaseUIComponent):
"""Base component for tabs components."""
library = f"{PACKAGE_NAME}/tabs"
@property
def import_var(self):
"""Return the import variable for the tabs component."""
return ImportVar(tag="Tabs", package_path="", install=False) |
tVar
from reflex.vars.base import Var
from reflex_ui.components.base_ui import PACKAGE_NAME, BaseUIComponent
LiteralOrientation = Literal["horizontal", "vertical"]
class ClassNames:
"""Class names for tabs components."""
ROOT = "flex flex-col gap-2"
LIST = "bg-secondary-3 inline-flex gap-1 p-1 items-center justify-start rounded-ui-md relative z-0"
TAB = "h-7 px-1.5 rounded-ui-sm justify-center items-center gap-1.5 inline-flex text-sm font-medium text-secondary-11 cursor-pointer z-[1] hover:text-secondary-12 transition-color text-nowrap data-[selected]:text-secondary-12 data-[disabled]:cursor-not-allowed data-[disabled]:text-secondary-8"
INDICATOR = "absolute top-1/2 left-0 -z-1 h-7 w-(--active-tab-width) -translate-y-1/2 translate-x-(--active-tab-left) rounded-ui-sm bg-secondary-1 shadow-small transition-all duration-200 ease-in-out"
PANEL = "flex flex-col gap-2"
class TabsBaseComponent(BaseUIComponent):
"""Base component for tabs components."""
|
@property
def import_var(self):
"""Return the import variable for the tabs component."""
return ImportVar(tag="Tabs", package_path="", install=False)
class TabsRoot(TabsBaseComponent):
"""Groups the tabs and the corresponding panels. Renders a <div> element."""
tag = "Tabs.Root"
# The default value. Use when the component is not controlled. When the value is null, no Tab will be selected. Defaults to 0.
default_value: Var[str | int]
# The value of the currently selected Tab. Use when the component is controlled. When the value is null, no Tab will be selected.
value: Var[str | int]
# Callback invoked when new value is being set.
on_value_change: EventHandler[passthrough_event_spec(str | dict)]
# The component orientation (layout flow direction). Defaults to "horizontal".
orientation: Var[LiteralOrientation]
# The render prop
render_: Var[Component]
@classmethod
def create(cls, *children, **props) | library = f"{PACKAGE_NAME}/tabs" |
i.components.base_ui import PACKAGE_NAME, BaseUIComponent
LiteralOrientation = Literal["horizontal", "vertical"]
class ClassNames:
"""Class names for tabs components."""
ROOT = "flex flex-col gap-2"
LIST = "bg-secondary-3 inline-flex gap-1 p-1 items-center justify-start rounded-ui-md relative z-0"
TAB = "h-7 px-1.5 rounded-ui-sm justify-center items-center gap-1.5 inline-flex text-sm font-medium text-secondary-11 cursor-pointer z-[1] hover:text-secondary-12 transition-color text-nowrap data-[selected]:text-secondary-12 data-[disabled]:cursor-not-allowed data-[disabled]:text-secondary-8"
INDICATOR = "absolute top-1/2 left-0 -z-1 h-7 w-(--active-tab-width) -translate-y-1/2 translate-x-(--active-tab-left) rounded-ui-sm bg-secondary-1 shadow-small transition-all duration-200 ease-in-out"
PANEL = "flex flex-col gap-2"
class TabsBaseComponent(BaseUIComponent):
"""Base component for tabs components."""
library = f"{PACKAGE_NAME}/tabs"
@property
|
class TabsRoot(TabsBaseComponent):
"""Groups the tabs and the corresponding panels. Renders a <div> element."""
tag = "Tabs.Root"
# The default value. Use when the component is not controlled. When the value is null, no Tab will be selected. Defaults to 0.
default_value: Var[str | int]
# The value of the currently selected Tab. Use when the component is controlled. When the value is null, no Tab will be selected.
value: Var[str | int]
# Callback invoked when new value is being set.
on_value_change: EventHandler[passthrough_event_spec(str | dict)]
# The component orientation (layout flow direction). Defaults to "horizontal".
orientation: Var[LiteralOrientation]
# The render prop
render_: Var[Component]
@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create the tabs root component."""
props["data-slot"] = "tabs"
cls.set_class_name(ClassNames.ROOT, props)
return super( | def import_var(self):
"""Return the import variable for the tabs component."""
return ImportVar(tag="Tabs", package_path="", install=False) |
y-start rounded-ui-md relative z-0"
TAB = "h-7 px-1.5 rounded-ui-sm justify-center items-center gap-1.5 inline-flex text-sm font-medium text-secondary-11 cursor-pointer z-[1] hover:text-secondary-12 transition-color text-nowrap data-[selected]:text-secondary-12 data-[disabled]:cursor-not-allowed data-[disabled]:text-secondary-8"
INDICATOR = "absolute top-1/2 left-0 -z-1 h-7 w-(--active-tab-width) -translate-y-1/2 translate-x-(--active-tab-left) rounded-ui-sm bg-secondary-1 shadow-small transition-all duration-200 ease-in-out"
PANEL = "flex flex-col gap-2"
class TabsBaseComponent(BaseUIComponent):
"""Base component for tabs components."""
library = f"{PACKAGE_NAME}/tabs"
@property
def import_var(self):
"""Return the import variable for the tabs component."""
return ImportVar(tag="Tabs", package_path="", install=False)
class TabsRoot(TabsBaseComponent):
"""Groups the tabs and the corresponding panels. Renders a <div> element."""
|
# The default value. Use when the component is not controlled. When the value is null, no Tab will be selected. Defaults to 0.
default_value: Var[str | int]
# The value of the currently selected Tab. Use when the component is controlled. When the value is null, no Tab will be selected.
value: Var[str | int]
# Callback invoked when new value is being set.
on_value_change: EventHandler[passthrough_event_spec(str | dict)]
# The component orientation (layout flow direction). Defaults to "horizontal".
orientation: Var[LiteralOrientation]
# The render prop
render_: Var[Component]
@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create the tabs root component."""
props["data-slot"] = "tabs"
cls.set_class_name(ClassNames.ROOT, props)
return super().create(*children, **props)
class TabsList(TabsBaseComponent):
"""Groups the individual tab buttons. Renders a <div> element."""
| tag = "Tabs.Root" |
library = f"{PACKAGE_NAME}/tabs"
@property
def import_var(self):
"""Return the import variable for the tabs component."""
return ImportVar(tag="Tabs", package_path="", install=False)
class TabsRoot(TabsBaseComponent):
"""Groups the tabs and the corresponding panels. Renders a <div> element."""
tag = "Tabs.Root"
# The default value. Use when the component is not controlled. When the value is null, no Tab will be selected. Defaults to 0.
default_value: Var[str | int]
# The value of the currently selected Tab. Use when the component is controlled. When the value is null, no Tab will be selected.
value: Var[str | int]
# Callback invoked when new value is being set.
on_value_change: EventHandler[passthrough_event_spec(str | dict)]
# The component orientation (layout flow direction). Defaults to "horizontal".
orientation: Var[LiteralOrientation]
# The render prop
render_: Var[Component]
@classmethod
|
class TabsList(TabsBaseComponent):
"""Groups the individual tab buttons. Renders a <div> element."""
tag = "Tabs.List"
# Whether to automatically change the active tab on arrow key focus. Otherwise, tabs will be activated using Enter or Spacebar key press. Defaults to True.
activate_on_focus: Var[bool]
# Whether to loop keyboard focus back to the first item when the end of the list is reached while using the arrow keys. Defaults to True.
loop: Var[bool]
@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create the tabs list component."""
props["data-slot"] = "tabs-list"
cls.set_class_name(ClassNames.LIST, props)
return super().create(*children, **props)
class TabsTab(TabsBaseComponent):
"""An individual interactive tab button that toggles the corresponding panel. Renders a <button> element."""
tag = "Tabs.Tab"
# The value of the Tab. When not specified, the value is the child pos | def create(cls, *children, **props) -> BaseUIComponent:
"""Create the tabs root component."""
props["data-slot"] = "tabs"
cls.set_class_name(ClassNames.ROOT, props)
return super().create(*children, **props) |
able for the tabs component."""
return ImportVar(tag="Tabs", package_path="", install=False)
class TabsRoot(TabsBaseComponent):
"""Groups the tabs and the corresponding panels. Renders a <div> element."""
tag = "Tabs.Root"
# The default value. Use when the component is not controlled. When the value is null, no Tab will be selected. Defaults to 0.
default_value: Var[str | int]
# The value of the currently selected Tab. Use when the component is controlled. When the value is null, no Tab will be selected.
value: Var[str | int]
# Callback invoked when new value is being set.
on_value_change: EventHandler[passthrough_event_spec(str | dict)]
# The component orientation (layout flow direction). Defaults to "horizontal".
orientation: Var[LiteralOrientation]
# The render prop
render_: Var[Component]
@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create the tabs root component."""
|
cls.set_class_name(ClassNames.ROOT, props)
return super().create(*children, **props)
class TabsList(TabsBaseComponent):
"""Groups the individual tab buttons. Renders a <div> element."""
tag = "Tabs.List"
# Whether to automatically change the active tab on arrow key focus. Otherwise, tabs will be activated using Enter or Spacebar key press. Defaults to True.
activate_on_focus: Var[bool]
# Whether to loop keyboard focus back to the first item when the end of the list is reached while using the arrow keys. Defaults to True.
loop: Var[bool]
@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create the tabs list component."""
props["data-slot"] = "tabs-list"
cls.set_class_name(ClassNames.LIST, props)
return super().create(*children, **props)
class TabsTab(TabsBaseComponent):
"""An individual interactive tab button that toggles the corresponding panel. Renders a <button> element. | props["data-slot"] = "tabs" |
# The default value. Use when the component is not controlled. When the value is null, no Tab will be selected. Defaults to 0.
default_value: Var[str | int]
# The value of the currently selected Tab. Use when the component is controlled. When the value is null, no Tab will be selected.
value: Var[str | int]
# Callback invoked when new value is being set.
on_value_change: EventHandler[passthrough_event_spec(str | dict)]
# The component orientation (layout flow direction). Defaults to "horizontal".
orientation: Var[LiteralOrientation]
# The render prop
render_: Var[Component]
@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create the tabs root component."""
props["data-slot"] = "tabs"
cls.set_class_name(ClassNames.ROOT, props)
return super().create(*children, **props)
class TabsList(TabsBaseComponent):
"""Groups the individual tab buttons. Renders a <div> element."""
|
# Whether to automatically change the active tab on arrow key focus. Otherwise, tabs will be activated using Enter or Spacebar key press. Defaults to True.
activate_on_focus: Var[bool]
# Whether to loop keyboard focus back to the first item when the end of the list is reached while using the arrow keys. Defaults to True.
loop: Var[bool]
@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create the tabs list component."""
props["data-slot"] = "tabs-list"
cls.set_class_name(ClassNames.LIST, props)
return super().create(*children, **props)
class TabsTab(TabsBaseComponent):
"""An individual interactive tab button that toggles the corresponding panel. Renders a <button> element."""
tag = "Tabs.Tab"
# The value of the Tab. When not specified, the value is the child position index.
value: Var[str | int]
# Whether the component renders a native <button> element when replacing it via the re | tag = "Tabs.List" |
nge: EventHandler[passthrough_event_spec(str | dict)]
# The component orientation (layout flow direction). Defaults to "horizontal".
orientation: Var[LiteralOrientation]
# The render prop
render_: Var[Component]
@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create the tabs root component."""
props["data-slot"] = "tabs"
cls.set_class_name(ClassNames.ROOT, props)
return super().create(*children, **props)
class TabsList(TabsBaseComponent):
"""Groups the individual tab buttons. Renders a <div> element."""
tag = "Tabs.List"
# Whether to automatically change the active tab on arrow key focus. Otherwise, tabs will be activated using Enter or Spacebar key press. Defaults to True.
activate_on_focus: Var[bool]
# Whether to loop keyboard focus back to the first item when the end of the list is reached while using the arrow keys. Defaults to True.
loop: Var[bool]
@classmethod
|
class TabsTab(TabsBaseComponent):
"""An individual interactive tab button that toggles the corresponding panel. Renders a <button> element."""
tag = "Tabs.Tab"
# The value of the Tab. When not specified, the value is the child position index.
value: Var[str | int]
# Whether the component renders a native <button> element when replacing it via the render prop. Set to false if the rendered element is not a button (e.g. <div>). Defaults to True.
native_button: Var[bool]
# Whether the Tab is disabled. Defaults to false.
disabled: Var[bool]
@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create the tabs tab component."""
props["data-slot"] = "tabs-tab"
cls.set_class_name(ClassNames.TAB, props)
return super().create(*children, **props)
class TabsIndicator(TabsBaseComponent):
"""A visual indicator that can be styled to match the position of the currently active tab. Renders a <span> e | def create(cls, *children, **props) -> BaseUIComponent:
"""Create the tabs list component."""
props["data-slot"] = "tabs-list"
cls.set_class_name(ClassNames.LIST, props)
return super().create(*children, **props) |
. Defaults to "horizontal".
orientation: Var[LiteralOrientation]
# The render prop
render_: Var[Component]
@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create the tabs root component."""
props["data-slot"] = "tabs"
cls.set_class_name(ClassNames.ROOT, props)
return super().create(*children, **props)
class TabsList(TabsBaseComponent):
"""Groups the individual tab buttons. Renders a <div> element."""
tag = "Tabs.List"
# Whether to automatically change the active tab on arrow key focus. Otherwise, tabs will be activated using Enter or Spacebar key press. Defaults to True.
activate_on_focus: Var[bool]
# Whether to loop keyboard focus back to the first item when the end of the list is reached while using the arrow keys. Defaults to True.
loop: Var[bool]
@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create the tabs list component."""
|
cls.set_class_name(ClassNames.LIST, props)
return super().create(*children, **props)
class TabsTab(TabsBaseComponent):
"""An individual interactive tab button that toggles the corresponding panel. Renders a <button> element."""
tag = "Tabs.Tab"
# The value of the Tab. When not specified, the value is the child position index.
value: Var[str | int]
# Whether the component renders a native <button> element when replacing it via the render prop. Set to false if the rendered element is not a button (e.g. <div>). Defaults to True.
native_button: Var[bool]
# Whether the Tab is disabled. Defaults to false.
disabled: Var[bool]
@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create the tabs tab component."""
props["data-slot"] = "tabs-tab"
cls.set_class_name(ClassNames.TAB, props)
return super().create(*children, **props)
class TabsIndicator(TabsBaseComponent):
"""A visu | props["data-slot"] = "tabs-list" |
cls.set_class_name(ClassNames.ROOT, props)
return super().create(*children, **props)
class TabsList(TabsBaseComponent):
"""Groups the individual tab buttons. Renders a <div> element."""
tag = "Tabs.List"
# Whether to automatically change the active tab on arrow key focus. Otherwise, tabs will be activated using Enter or Spacebar key press. Defaults to True.
activate_on_focus: Var[bool]
# Whether to loop keyboard focus back to the first item when the end of the list is reached while using the arrow keys. Defaults to True.
loop: Var[bool]
@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create the tabs list component."""
props["data-slot"] = "tabs-list"
cls.set_class_name(ClassNames.LIST, props)
return super().create(*children, **props)
class TabsTab(TabsBaseComponent):
"""An individual interactive tab button that toggles the corresponding panel. Renders a <button> element."""
|
# The value of the Tab. When not specified, the value is the child position index.
value: Var[str | int]
# Whether the component renders a native <button> element when replacing it via the render prop. Set to false if the rendered element is not a button (e.g. <div>). Defaults to True.
native_button: Var[bool]
# Whether the Tab is disabled. Defaults to false.
disabled: Var[bool]
@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create the tabs tab component."""
props["data-slot"] = "tabs-tab"
cls.set_class_name(ClassNames.TAB, props)
return super().create(*children, **props)
class TabsIndicator(TabsBaseComponent):
"""A visual indicator that can be styled to match the position of the currently active tab. Renders a <span> element."""
tag = "Tabs.Indicator"
# Whether to render itself before React hydrates. This minimizes the time that the indicator isn't visible after server-side re | tag = "Tabs.Tab" |
focus back to the first item when the end of the list is reached while using the arrow keys. Defaults to True.
loop: Var[bool]
@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create the tabs list component."""
props["data-slot"] = "tabs-list"
cls.set_class_name(ClassNames.LIST, props)
return super().create(*children, **props)
class TabsTab(TabsBaseComponent):
"""An individual interactive tab button that toggles the corresponding panel. Renders a <button> element."""
tag = "Tabs.Tab"
# The value of the Tab. When not specified, the value is the child position index.
value: Var[str | int]
# Whether the component renders a native <button> element when replacing it via the render prop. Set to false if the rendered element is not a button (e.g. <div>). Defaults to True.
native_button: Var[bool]
# Whether the Tab is disabled. Defaults to false.
disabled: Var[bool]
@classmethod
|
class TabsIndicator(TabsBaseComponent):
"""A visual indicator that can be styled to match the position of the currently active tab. Renders a <span> element."""
tag = "Tabs.Indicator"
# Whether to render itself before React hydrates. This minimizes the time that the indicator isn't visible after server-side rendering. Defaults to False.
render_before_hydration: Var[bool]
@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create the tabs indicator component."""
props["data-slot"] = "tabs-indicator"
cls.set_class_name(ClassNames.INDICATOR, props)
return super().create(*children, **props)
class TabsPanel(TabsBaseComponent):
"""A panel displayed when the corresponding tab is active. Renders a <div> element."""
tag = "Tabs.Panel"
# The value of the TabPanel. It will be shown when the Tab with the corresponding value is selected. If not provided, it will fall back to the index of the panel. It | def create(cls, *children, **props) -> BaseUIComponent:
"""Create the tabs tab component."""
props["data-slot"] = "tabs-tab"
cls.set_class_name(ClassNames.TAB, props)
return super().create(*children, **props) |
e.
loop: Var[bool]
@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create the tabs list component."""
props["data-slot"] = "tabs-list"
cls.set_class_name(ClassNames.LIST, props)
return super().create(*children, **props)
class TabsTab(TabsBaseComponent):
"""An individual interactive tab button that toggles the corresponding panel. Renders a <button> element."""
tag = "Tabs.Tab"
# The value of the Tab. When not specified, the value is the child position index.
value: Var[str | int]
# Whether the component renders a native <button> element when replacing it via the render prop. Set to false if the rendered element is not a button (e.g. <div>). Defaults to True.
native_button: Var[bool]
# Whether the Tab is disabled. Defaults to false.
disabled: Var[bool]
@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create the tabs tab component."""
|
cls.set_class_name(ClassNames.TAB, props)
return super().create(*children, **props)
class TabsIndicator(TabsBaseComponent):
"""A visual indicator that can be styled to match the position of the currently active tab. Renders a <span> element."""
tag = "Tabs.Indicator"
# Whether to render itself before React hydrates. This minimizes the time that the indicator isn't visible after server-side rendering. Defaults to False.
render_before_hydration: Var[bool]
@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create the tabs indicator component."""
props["data-slot"] = "tabs-indicator"
cls.set_class_name(ClassNames.INDICATOR, props)
return super().create(*children, **props)
class TabsPanel(TabsBaseComponent):
"""A panel displayed when the corresponding tab is active. Renders a <div> element."""
tag = "Tabs.Panel"
# The value of the TabPanel. It will be shown when the Tab with th | props["data-slot"] = "tabs-tab" |
(TabsBaseComponent):
"""An individual interactive tab button that toggles the corresponding panel. Renders a <button> element."""
tag = "Tabs.Tab"
# The value of the Tab. When not specified, the value is the child position index.
value: Var[str | int]
# Whether the component renders a native <button> element when replacing it via the render prop. Set to false if the rendered element is not a button (e.g. <div>). Defaults to True.
native_button: Var[bool]
# Whether the Tab is disabled. Defaults to false.
disabled: Var[bool]
@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create the tabs tab component."""
props["data-slot"] = "tabs-tab"
cls.set_class_name(ClassNames.TAB, props)
return super().create(*children, **props)
class TabsIndicator(TabsBaseComponent):
"""A visual indicator that can be styled to match the position of the currently active tab. Renders a <span> element."""
|
# Whether to render itself before React hydrates. This minimizes the time that the indicator isn't visible after server-side rendering. Defaults to False.
render_before_hydration: Var[bool]
@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create the tabs indicator component."""
props["data-slot"] = "tabs-indicator"
cls.set_class_name(ClassNames.INDICATOR, props)
return super().create(*children, **props)
class TabsPanel(TabsBaseComponent):
"""A panel displayed when the corresponding tab is active. Renders a <div> element."""
tag = "Tabs.Panel"
# The value of the TabPanel. It will be shown when the Tab with the corresponding value is selected. If not provided, it will fall back to the index of the panel. It is recommended to explicitly provide it, as it's required for the tab panel to be rendered on the server.
value: Var[str | int]
# Whether to keep the HTML element in the DOM while the pa | tag = "Tabs.Indicator" |
value: Var[str | int]
# Whether the component renders a native <button> element when replacing it via the render prop. Set to false if the rendered element is not a button (e.g. <div>). Defaults to True.
native_button: Var[bool]
# Whether the Tab is disabled. Defaults to false.
disabled: Var[bool]
@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create the tabs tab component."""
props["data-slot"] = "tabs-tab"
cls.set_class_name(ClassNames.TAB, props)
return super().create(*children, **props)
class TabsIndicator(TabsBaseComponent):
"""A visual indicator that can be styled to match the position of the currently active tab. Renders a <span> element."""
tag = "Tabs.Indicator"
# Whether to render itself before React hydrates. This minimizes the time that the indicator isn't visible after server-side rendering. Defaults to False.
render_before_hydration: Var[bool]
@classmethod
|
class TabsPanel(TabsBaseComponent):
"""A panel displayed when the corresponding tab is active. Renders a <div> element."""
tag = "Tabs.Panel"
# The value of the TabPanel. It will be shown when the Tab with the corresponding value is selected. If not provided, it will fall back to the index of the panel. It is recommended to explicitly provide it, as it's required for the tab panel to be rendered on the server.
value: Var[str | int]
# Whether to keep the HTML element in the DOM while the panel is hidden. Defaults to False.
keep_mounted: Var[bool]
@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create the tabs panel component."""
props["data-slot"] = "tabs-panel"
cls.set_class_name(ClassNames.PANEL, props)
return super().create(*children, **props)
class Tabs(ComponentNamespace):
"""Namespace for Tabs components."""
root = __call__ = staticmethod(TabsRoot.create)
list = staticmeth | def create(cls, *children, **props) -> BaseUIComponent:
"""Create the tabs indicator component."""
props["data-slot"] = "tabs-indicator"
cls.set_class_name(ClassNames.INDICATOR, props)
return super().create(*children, **props) |
render prop. Set to false if the rendered element is not a button (e.g. <div>). Defaults to True.
native_button: Var[bool]
# Whether the Tab is disabled. Defaults to false.
disabled: Var[bool]
@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create the tabs tab component."""
props["data-slot"] = "tabs-tab"
cls.set_class_name(ClassNames.TAB, props)
return super().create(*children, **props)
class TabsIndicator(TabsBaseComponent):
"""A visual indicator that can be styled to match the position of the currently active tab. Renders a <span> element."""
tag = "Tabs.Indicator"
# Whether to render itself before React hydrates. This minimizes the time that the indicator isn't visible after server-side rendering. Defaults to False.
render_before_hydration: Var[bool]
@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create the tabs indicator component."""
|
cls.set_class_name(ClassNames.INDICATOR, props)
return super().create(*children, **props)
class TabsPanel(TabsBaseComponent):
"""A panel displayed when the corresponding tab is active. Renders a <div> element."""
tag = "Tabs.Panel"
# The value of the TabPanel. It will be shown when the Tab with the corresponding value is selected. If not provided, it will fall back to the index of the panel. It is recommended to explicitly provide it, as it's required for the tab panel to be rendered on the server.
value: Var[str | int]
# Whether to keep the HTML element in the DOM while the panel is hidden. Defaults to False.
keep_mounted: Var[bool]
@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create the tabs panel component."""
props["data-slot"] = "tabs-panel"
cls.set_class_name(ClassNames.PANEL, props)
return super().create(*children, **props)
class Tabs(ComponentNamespace):
"""Na | props["data-slot"] = "tabs-indicator" |
nent:
"""Create the tabs tab component."""
props["data-slot"] = "tabs-tab"
cls.set_class_name(ClassNames.TAB, props)
return super().create(*children, **props)
class TabsIndicator(TabsBaseComponent):
"""A visual indicator that can be styled to match the position of the currently active tab. Renders a <span> element."""
tag = "Tabs.Indicator"
# Whether to render itself before React hydrates. This minimizes the time that the indicator isn't visible after server-side rendering. Defaults to False.
render_before_hydration: Var[bool]
@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create the tabs indicator component."""
props["data-slot"] = "tabs-indicator"
cls.set_class_name(ClassNames.INDICATOR, props)
return super().create(*children, **props)
class TabsPanel(TabsBaseComponent):
"""A panel displayed when the corresponding tab is active. Renders a <div> element."""
|
# The value of the TabPanel. It will be shown when the Tab with the corresponding value is selected. If not provided, it will fall back to the index of the panel. It is recommended to explicitly provide it, as it's required for the tab panel to be rendered on the server.
value: Var[str | int]
# Whether to keep the HTML element in the DOM while the panel is hidden. Defaults to False.
keep_mounted: Var[bool]
@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create the tabs panel component."""
props["data-slot"] = "tabs-panel"
cls.set_class_name(ClassNames.PANEL, props)
return super().create(*children, **props)
class Tabs(ComponentNamespace):
"""Namespace for Tabs components."""
root = __call__ = staticmethod(TabsRoot.create)
list = staticmethod(TabsList.create)
tab = staticmethod(TabsTab.create)
panel = staticmethod(TabsPanel.create)
indicator = staticmethod(TabsIndicator.create)
| tag = "Tabs.Panel" |
the indicator isn't visible after server-side rendering. Defaults to False.
render_before_hydration: Var[bool]
@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create the tabs indicator component."""
props["data-slot"] = "tabs-indicator"
cls.set_class_name(ClassNames.INDICATOR, props)
return super().create(*children, **props)
class TabsPanel(TabsBaseComponent):
"""A panel displayed when the corresponding tab is active. Renders a <div> element."""
tag = "Tabs.Panel"
# The value of the TabPanel. It will be shown when the Tab with the corresponding value is selected. If not provided, it will fall back to the index of the panel. It is recommended to explicitly provide it, as it's required for the tab panel to be rendered on the server.
value: Var[str | int]
# Whether to keep the HTML element in the DOM while the panel is hidden. Defaults to False.
keep_mounted: Var[bool]
@classmethod
|
class Tabs(ComponentNamespace):
"""Namespace for Tabs components."""
root = __call__ = staticmethod(TabsRoot.create)
list = staticmethod(TabsList.create)
tab = staticmethod(TabsTab.create)
panel = staticmethod(TabsPanel.create)
indicator = staticmethod(TabsIndicator.create)
class_names = ClassNames
tabs = Tabs()
| def create(cls, *children, **props) -> BaseUIComponent:
"""Create the tabs panel component."""
props["data-slot"] = "tabs-panel"
cls.set_class_name(ClassNames.PANEL, props)
return super().create(*children, **props) |
ool]
@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create the tabs indicator component."""
props["data-slot"] = "tabs-indicator"
cls.set_class_name(ClassNames.INDICATOR, props)
return super().create(*children, **props)
class TabsPanel(TabsBaseComponent):
"""A panel displayed when the corresponding tab is active. Renders a <div> element."""
tag = "Tabs.Panel"
# The value of the TabPanel. It will be shown when the Tab with the corresponding value is selected. If not provided, it will fall back to the index of the panel. It is recommended to explicitly provide it, as it's required for the tab panel to be rendered on the server.
value: Var[str | int]
# Whether to keep the HTML element in the DOM while the panel is hidden. Defaults to False.
keep_mounted: Var[bool]
@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create the tabs panel component."""
|
cls.set_class_name(ClassNames.PANEL, props)
return super().create(*children, **props)
class Tabs(ComponentNamespace):
"""Namespace for Tabs components."""
root = __call__ = staticmethod(TabsRoot.create)
list = staticmethod(TabsList.create)
tab = staticmethod(TabsTab.create)
panel = staticmethod(TabsPanel.create)
indicator = staticmethod(TabsIndicator.create)
class_names = ClassNames
tabs = Tabs()
| props["data-slot"] = "tabs-panel" |
props["data-slot"] = "tabs-indicator"
cls.set_class_name(ClassNames.INDICATOR, props)
return super().create(*children, **props)
class TabsPanel(TabsBaseComponent):
"""A panel displayed when the corresponding tab is active. Renders a <div> element."""
tag = "Tabs.Panel"
# The value of the TabPanel. It will be shown when the Tab with the corresponding value is selected. If not provided, it will fall back to the index of the panel. It is recommended to explicitly provide it, as it's required for the tab panel to be rendered on the server.
value: Var[str | int]
# Whether to keep the HTML element in the DOM while the panel is hidden. Defaults to False.
keep_mounted: Var[bool]
@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create the tabs panel component."""
props["data-slot"] = "tabs-panel"
cls.set_class_name(ClassNames.PANEL, props)
return super().create(*children, **props)
|
tabs = Tabs()
| class Tabs(ComponentNamespace):
"""Namespace for Tabs components."""
root = __call__ = staticmethod(TabsRoot.create)
list = staticmethod(TabsList.create)
tab = staticmethod(TabsTab.create)
panel = staticmethod(TabsPanel.create)
indicator = staticmethod(TabsIndicator.create)
class_names = ClassNames |
s.INDICATOR, props)
return super().create(*children, **props)
class TabsPanel(TabsBaseComponent):
"""A panel displayed when the corresponding tab is active. Renders a <div> element."""
tag = "Tabs.Panel"
# The value of the TabPanel. It will be shown when the Tab with the corresponding value is selected. If not provided, it will fall back to the index of the panel. It is recommended to explicitly provide it, as it's required for the tab panel to be rendered on the server.
value: Var[str | int]
# Whether to keep the HTML element in the DOM while the panel is hidden. Defaults to False.
keep_mounted: Var[bool]
@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create the tabs panel component."""
props["data-slot"] = "tabs-panel"
cls.set_class_name(ClassNames.PANEL, props)
return super().create(*children, **props)
class Tabs(ComponentNamespace):
"""Namespace for Tabs components."""
|
list = staticmethod(TabsList.create)
tab = staticmethod(TabsTab.create)
panel = staticmethod(TabsPanel.create)
indicator = staticmethod(TabsIndicator.create)
class_names = ClassNames
tabs = Tabs()
| root = __call__ = staticmethod(TabsRoot.create) |
hildren, **props)
class TabsPanel(TabsBaseComponent):
"""A panel displayed when the corresponding tab is active. Renders a <div> element."""
tag = "Tabs.Panel"
# The value of the TabPanel. It will be shown when the Tab with the corresponding value is selected. If not provided, it will fall back to the index of the panel. It is recommended to explicitly provide it, as it's required for the tab panel to be rendered on the server.
value: Var[str | int]
# Whether to keep the HTML element in the DOM while the panel is hidden. Defaults to False.
keep_mounted: Var[bool]
@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create the tabs panel component."""
props["data-slot"] = "tabs-panel"
cls.set_class_name(ClassNames.PANEL, props)
return super().create(*children, **props)
class Tabs(ComponentNamespace):
"""Namespace for Tabs components."""
root = __call__ = staticmethod(TabsRoot.create)
|
tab = staticmethod(TabsTab.create)
panel = staticmethod(TabsPanel.create)
indicator = staticmethod(TabsIndicator.create)
class_names = ClassNames
tabs = Tabs()
| list = staticmethod(TabsList.create) |
aseComponent):
"""A panel displayed when the corresponding tab is active. Renders a <div> element."""
tag = "Tabs.Panel"
# The value of the TabPanel. It will be shown when the Tab with the corresponding value is selected. If not provided, it will fall back to the index of the panel. It is recommended to explicitly provide it, as it's required for the tab panel to be rendered on the server.
value: Var[str | int]
# Whether to keep the HTML element in the DOM while the panel is hidden. Defaults to False.
keep_mounted: Var[bool]
@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create the tabs panel component."""
props["data-slot"] = "tabs-panel"
cls.set_class_name(ClassNames.PANEL, props)
return super().create(*children, **props)
class Tabs(ComponentNamespace):
"""Namespace for Tabs components."""
root = __call__ = staticmethod(TabsRoot.create)
list = staticmethod(TabsList.create)
|
panel = staticmethod(TabsPanel.create)
indicator = staticmethod(TabsIndicator.create)
class_names = ClassNames
tabs = Tabs()
| tab = staticmethod(TabsTab.create) |
when the corresponding tab is active. Renders a <div> element."""
tag = "Tabs.Panel"
# The value of the TabPanel. It will be shown when the Tab with the corresponding value is selected. If not provided, it will fall back to the index of the panel. It is recommended to explicitly provide it, as it's required for the tab panel to be rendered on the server.
value: Var[str | int]
# Whether to keep the HTML element in the DOM while the panel is hidden. Defaults to False.
keep_mounted: Var[bool]
@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create the tabs panel component."""
props["data-slot"] = "tabs-panel"
cls.set_class_name(ClassNames.PANEL, props)
return super().create(*children, **props)
class Tabs(ComponentNamespace):
"""Namespace for Tabs components."""
root = __call__ = staticmethod(TabsRoot.create)
list = staticmethod(TabsList.create)
tab = staticmethod(TabsTab.create)
|
indicator = staticmethod(TabsIndicator.create)
class_names = ClassNames
tabs = Tabs()
| panel = staticmethod(TabsPanel.create) |
ers a <div> element."""
tag = "Tabs.Panel"
# The value of the TabPanel. It will be shown when the Tab with the corresponding value is selected. If not provided, it will fall back to the index of the panel. It is recommended to explicitly provide it, as it's required for the tab panel to be rendered on the server.
value: Var[str | int]
# Whether to keep the HTML element in the DOM while the panel is hidden. Defaults to False.
keep_mounted: Var[bool]
@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create the tabs panel component."""
props["data-slot"] = "tabs-panel"
cls.set_class_name(ClassNames.PANEL, props)
return super().create(*children, **props)
class Tabs(ComponentNamespace):
"""Namespace for Tabs components."""
root = __call__ = staticmethod(TabsRoot.create)
list = staticmethod(TabsList.create)
tab = staticmethod(TabsTab.create)
panel = staticmethod(TabsPanel.create)
|
class_names = ClassNames
tabs = Tabs()
| indicator = staticmethod(TabsIndicator.create) |
# The value of the TabPanel. It will be shown when the Tab with the corresponding value is selected. If not provided, it will fall back to the index of the panel. It is recommended to explicitly provide it, as it's required for the tab panel to be rendered on the server.
value: Var[str | int]
# Whether to keep the HTML element in the DOM while the panel is hidden. Defaults to False.
keep_mounted: Var[bool]
@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create the tabs panel component."""
props["data-slot"] = "tabs-panel"
cls.set_class_name(ClassNames.PANEL, props)
return super().create(*children, **props)
class Tabs(ComponentNamespace):
"""Namespace for Tabs components."""
root = __call__ = staticmethod(TabsRoot.create)
list = staticmethod(TabsList.create)
tab = staticmethod(TabsTab.create)
panel = staticmethod(TabsPanel.create)
indicator = staticmethod(TabsIndicator.create)
|
tabs = Tabs()
| class_names = ClassNames |
el. It will be shown when the Tab with the corresponding value is selected. If not provided, it will fall back to the index of the panel. It is recommended to explicitly provide it, as it's required for the tab panel to be rendered on the server.
value: Var[str | int]
# Whether to keep the HTML element in the DOM while the panel is hidden. Defaults to False.
keep_mounted: Var[bool]
@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create the tabs panel component."""
props["data-slot"] = "tabs-panel"
cls.set_class_name(ClassNames.PANEL, props)
return super().create(*children, **props)
class Tabs(ComponentNamespace):
"""Namespace for Tabs components."""
root = __call__ = staticmethod(TabsRoot.create)
list = staticmethod(TabsList.create)
tab = staticmethod(TabsTab.create)
panel = staticmethod(TabsPanel.create)
indicator = staticmethod(TabsIndicator.create)
class_names = ClassNames
| tabs = Tabs() | |
"""Custom Textarea component."""
|
from reflex.components.el import Textarea as TextareaComponent
from reflex_ui.components.component import CoreComponent
class ClassNames:
"""Class names for textarea components."""
ROOT = "focus:shadow-[0px_0px_0px_2px_var(--primary-4)] focus:border-primary-7 focus:hover:border-primary-7 bg-secondary-1 border border-secondary-a4 hover:border-secondary-a6 transition-[color,box-shadow] disabled:border-secondary-4 disabled:bg-secondary-3 disabled:text-secondary-8 disabled:cursor-not-allowed cursor-text min-h-24 rounded-ui-md text-secondary-12 placeholder:text-secondary-9 text-sm disabled:placeholder:text-secondary-8 w-full outline-none max-h-[15rem] resize-none overflow-y-auto px-3 py-2.5 font-medium"
class Textarea(TextareaComponent, CoreComponent):
"""Root component for Textarea."""
@classmethod
def create(cls, *children, **props) -> Component:
"""Create the textarea component."""
props.setdefault(
"custom_attrs",
{
| from reflex.components.component import Component |
"""Custom Textarea component."""
from reflex.components.component import Component
|
from reflex_ui.components.component import CoreComponent
class ClassNames:
"""Class names for textarea components."""
ROOT = "focus:shadow-[0px_0px_0px_2px_var(--primary-4)] focus:border-primary-7 focus:hover:border-primary-7 bg-secondary-1 border border-secondary-a4 hover:border-secondary-a6 transition-[color,box-shadow] disabled:border-secondary-4 disabled:bg-secondary-3 disabled:text-secondary-8 disabled:cursor-not-allowed cursor-text min-h-24 rounded-ui-md text-secondary-12 placeholder:text-secondary-9 text-sm disabled:placeholder:text-secondary-8 w-full outline-none max-h-[15rem] resize-none overflow-y-auto px-3 py-2.5 font-medium"
class Textarea(TextareaComponent, CoreComponent):
"""Root component for Textarea."""
@classmethod
def create(cls, *children, **props) -> Component:
"""Create the textarea component."""
props.setdefault(
"custom_attrs",
{
"autoComplete": "off",
"autoCapita | from reflex.components.el import Textarea as TextareaComponent |
"""Custom Textarea component."""
from reflex.components.component import Component
from reflex.components.el import Textarea as TextareaComponent
|
class ClassNames:
"""Class names for textarea components."""
ROOT = "focus:shadow-[0px_0px_0px_2px_var(--primary-4)] focus:border-primary-7 focus:hover:border-primary-7 bg-secondary-1 border border-secondary-a4 hover:border-secondary-a6 transition-[color,box-shadow] disabled:border-secondary-4 disabled:bg-secondary-3 disabled:text-secondary-8 disabled:cursor-not-allowed cursor-text min-h-24 rounded-ui-md text-secondary-12 placeholder:text-secondary-9 text-sm disabled:placeholder:text-secondary-8 w-full outline-none max-h-[15rem] resize-none overflow-y-auto px-3 py-2.5 font-medium"
class Textarea(TextareaComponent, CoreComponent):
"""Root component for Textarea."""
@classmethod
def create(cls, *children, **props) -> Component:
"""Create the textarea component."""
props.setdefault(
"custom_attrs",
{
"autoComplete": "off",
"autoCapitalize": "none",
"autoCorrect": "off",
| from reflex_ui.components.component import CoreComponent |
ROOT = "focus:shadow-[0px_0px_0px_2px_var(--primary-4)] focus:border-primary-7 focus:hover:border-primary-7 bg-secondary-1 border border-secondary-a4 hover:border-secondary-a6 transition-[color,box-shadow] disabled:border-secondary-4 disabled:bg-secondary-3 disabled:text-secondary-8 disabled:cursor-not-allowed cursor-text min-h-24 rounded-ui-md text-secondary-12 placeholder:text-secondary-9 text-sm disabled:placeholder:text-secondary-8 w-full outline-none max-h-[15rem] resize-none overflow-y-auto px-3 py-2.5 font-medium"
class Textarea(TextareaComponent, CoreComponent):
"""Root component for Textarea."""
@classmethod
def create(cls, *children, **props) -> Component:
"""Create the textarea component."""
props.setdefault(
"custom_attrs",
{
"autoComplete": "off",
"autoCapitalize": "none",
"autoCorrect": "off",
"spellCheck": "false",
},
)
|
cls.set_class_name(ClassNames.ROOT, props)
return super().create(*children, **props)
textarea = Textarea.create
| props["data-slot"] = "textarea" |
border-secondary-a4 hover:border-secondary-a6 transition-[color,box-shadow] disabled:border-secondary-4 disabled:bg-secondary-3 disabled:text-secondary-8 disabled:cursor-not-allowed cursor-text min-h-24 rounded-ui-md text-secondary-12 placeholder:text-secondary-9 text-sm disabled:placeholder:text-secondary-8 w-full outline-none max-h-[15rem] resize-none overflow-y-auto px-3 py-2.5 font-medium"
class Textarea(TextareaComponent, CoreComponent):
"""Root component for Textarea."""
@classmethod
def create(cls, *children, **props) -> Component:
"""Create the textarea component."""
props.setdefault(
"custom_attrs",
{
"autoComplete": "off",
"autoCapitalize": "none",
"autoCorrect": "off",
"spellCheck": "false",
},
)
props["data-slot"] = "textarea"
cls.set_class_name(ClassNames.ROOT, props)
return super().create(*children, **props)
| textarea = Textarea.create | |
"""Theme switcher component."""
|
from reflex.components.core.cond import cond
from reflex.components.el import Button, Div
from reflex.style import LiteralColorMode, color_mode, set_color_mode
from reflex_ui.components.icons.hugeicon import hi
from reflex_ui.utils.twmerge import cn
def theme_switcher_item(mode: LiteralColorMode, icon: str) -> Component:
"""Create a theme switcher item button for a specific mode."""
active_cn = "text-secondary-11 shadow-small bg-secondary-1"
unactive_cn = "hover:text-secondary-11 text-secondary-9"
return Button.create(
hi(icon, class_name="shrink-0", size=14),
on_click=set_color_mode(mode),
class_name=(
"flex items-center cursor-pointer justify-center rounded-ui-xs transition-color size-6",
cond(mode == color_mode, active_cn, unactive_cn),
),
aria_label=f"Switch to {mode} mode",
)
def theme_switcher(class_name: str = "") -> Component:
"""Theme switcher component."""
return Div.create(
| from reflex.components.component import Component, memo |
"""Theme switcher component."""
from reflex.components.component import Component, memo
|
from reflex.components.el import Button, Div
from reflex.style import LiteralColorMode, color_mode, set_color_mode
from reflex_ui.components.icons.hugeicon import hi
from reflex_ui.utils.twmerge import cn
def theme_switcher_item(mode: LiteralColorMode, icon: str) -> Component:
"""Create a theme switcher item button for a specific mode."""
active_cn = "text-secondary-11 shadow-small bg-secondary-1"
unactive_cn = "hover:text-secondary-11 text-secondary-9"
return Button.create(
hi(icon, class_name="shrink-0", size=14),
on_click=set_color_mode(mode),
class_name=(
"flex items-center cursor-pointer justify-center rounded-ui-xs transition-color size-6",
cond(mode == color_mode, active_cn, unactive_cn),
),
aria_label=f"Switch to {mode} mode",
)
def theme_switcher(class_name: str = "") -> Component:
"""Theme switcher component."""
return Div.create(
theme_switcher_item("system", "ComputerIc | from reflex.components.core.cond import cond |
"""Theme switcher component."""
from reflex.components.component import Component, memo
from reflex.components.core.cond import cond
|
from reflex.style import LiteralColorMode, color_mode, set_color_mode
from reflex_ui.components.icons.hugeicon import hi
from reflex_ui.utils.twmerge import cn
def theme_switcher_item(mode: LiteralColorMode, icon: str) -> Component:
"""Create a theme switcher item button for a specific mode."""
active_cn = "text-secondary-11 shadow-small bg-secondary-1"
unactive_cn = "hover:text-secondary-11 text-secondary-9"
return Button.create(
hi(icon, class_name="shrink-0", size=14),
on_click=set_color_mode(mode),
class_name=(
"flex items-center cursor-pointer justify-center rounded-ui-xs transition-color size-6",
cond(mode == color_mode, active_cn, unactive_cn),
),
aria_label=f"Switch to {mode} mode",
)
def theme_switcher(class_name: str = "") -> Component:
"""Theme switcher component."""
return Div.create(
theme_switcher_item("system", "ComputerIcon"),
theme_switcher_item("light", "S | from reflex.components.el import Button, Div |
"""Theme switcher component."""
from reflex.components.component import Component, memo
from reflex.components.core.cond import cond
from reflex.components.el import Button, Div
|
from reflex_ui.components.icons.hugeicon import hi
from reflex_ui.utils.twmerge import cn
def theme_switcher_item(mode: LiteralColorMode, icon: str) -> Component:
"""Create a theme switcher item button for a specific mode."""
active_cn = "text-secondary-11 shadow-small bg-secondary-1"
unactive_cn = "hover:text-secondary-11 text-secondary-9"
return Button.create(
hi(icon, class_name="shrink-0", size=14),
on_click=set_color_mode(mode),
class_name=(
"flex items-center cursor-pointer justify-center rounded-ui-xs transition-color size-6",
cond(mode == color_mode, active_cn, unactive_cn),
),
aria_label=f"Switch to {mode} mode",
)
def theme_switcher(class_name: str = "") -> Component:
"""Theme switcher component."""
return Div.create(
theme_switcher_item("system", "ComputerIcon"),
theme_switcher_item("light", "Sun01Icon"),
theme_switcher_item("dark", "Moon02Icon"),
| from reflex.style import LiteralColorMode, color_mode, set_color_mode |
"""Theme switcher component."""
from reflex.components.component import Component, memo
from reflex.components.core.cond import cond
from reflex.components.el import Button, Div
from reflex.style import LiteralColorMode, color_mode, set_color_mode
|
from reflex_ui.utils.twmerge import cn
def theme_switcher_item(mode: LiteralColorMode, icon: str) -> Component:
"""Create a theme switcher item button for a specific mode."""
active_cn = "text-secondary-11 shadow-small bg-secondary-1"
unactive_cn = "hover:text-secondary-11 text-secondary-9"
return Button.create(
hi(icon, class_name="shrink-0", size=14),
on_click=set_color_mode(mode),
class_name=(
"flex items-center cursor-pointer justify-center rounded-ui-xs transition-color size-6",
cond(mode == color_mode, active_cn, unactive_cn),
),
aria_label=f"Switch to {mode} mode",
)
def theme_switcher(class_name: str = "") -> Component:
"""Theme switcher component."""
return Div.create(
theme_switcher_item("system", "ComputerIcon"),
theme_switcher_item("light", "Sun01Icon"),
theme_switcher_item("dark", "Moon02Icon"),
class_name=cn(
"flex flex-row items-cen | from reflex_ui.components.icons.hugeicon import hi |
"""Theme switcher component."""
from reflex.components.component import Component, memo
from reflex.components.core.cond import cond
from reflex.components.el import Button, Div
from reflex.style import LiteralColorMode, color_mode, set_color_mode
from reflex_ui.components.icons.hugeicon import hi
from reflex_ui.utils.twmerge import cn
def theme_switcher_item(mode: LiteralColorMode, icon: str) -> Component:
"""Create a theme switcher item button for a specific mode."""
|
unactive_cn = "hover:text-secondary-11 text-secondary-9"
return Button.create(
hi(icon, class_name="shrink-0", size=14),
on_click=set_color_mode(mode),
class_name=(
"flex items-center cursor-pointer justify-center rounded-ui-xs transition-color size-6",
cond(mode == color_mode, active_cn, unactive_cn),
),
aria_label=f"Switch to {mode} mode",
)
def theme_switcher(class_name: str = "") -> Component:
"""Theme switcher component."""
return Div.create(
theme_switcher_item("system", "ComputerIcon"),
theme_switcher_item("light", "Sun01Icon"),
theme_switcher_item("dark", "Moon02Icon"),
class_name=cn(
"flex flex-row items-center bg-secondary-3 p-1 rounded-ui-md w-fit",
class_name,
),
)
@memo
def memoized_theme_switcher(class_name: str = "") -> Component:
"""Memoized theme switcher component."""
return theme_switcher(class_name=class | active_cn = "text-secondary-11 shadow-small bg-secondary-1" |
"""Theme switcher component."""
from reflex.components.component import Component, memo
from reflex.components.core.cond import cond
from reflex.components.el import Button, Div
from reflex.style import LiteralColorMode, color_mode, set_color_mode
from reflex_ui.components.icons.hugeicon import hi
from reflex_ui.utils.twmerge import cn
def theme_switcher_item(mode: LiteralColorMode, icon: str) -> Component:
"""Create a theme switcher item button for a specific mode."""
active_cn = "text-secondary-11 shadow-small bg-secondary-1"
|
return Button.create(
hi(icon, class_name="shrink-0", size=14),
on_click=set_color_mode(mode),
class_name=(
"flex items-center cursor-pointer justify-center rounded-ui-xs transition-color size-6",
cond(mode == color_mode, active_cn, unactive_cn),
),
aria_label=f"Switch to {mode} mode",
)
def theme_switcher(class_name: str = "") -> Component:
"""Theme switcher component."""
return Div.create(
theme_switcher_item("system", "ComputerIcon"),
theme_switcher_item("light", "Sun01Icon"),
theme_switcher_item("dark", "Moon02Icon"),
class_name=cn(
"flex flex-row items-center bg-secondary-3 p-1 rounded-ui-md w-fit",
class_name,
),
)
@memo
def memoized_theme_switcher(class_name: str = "") -> Component:
"""Memoized theme switcher component."""
return theme_switcher(class_name=class_name)
| unactive_cn = "hover:text-secondary-11 text-secondary-9" |
"""Custom toggle component."""
|
from reflex.event import EventHandler, passthrough_event_spec
from reflex.utils.imports import ImportVar
from reflex.vars.base import Var
from reflex_ui.components.base_ui import PACKAGE_NAME, BaseUIComponent
class ClassNames:
"""Class names for toggle components."""
ROOT = "flex size-8 items-center justify-center rounded-ui-sm text-secondary-11 select-none hover:bg-secondary-3 focus-visible:bg-none active:bg-secondary-4 data-[pressed]:text-secondary-12 data-[pressed]:bg-secondary-4 transition-colors"
class ToggleBaseComponent(BaseUIComponent):
"""Base component for toggle components."""
library = f"{PACKAGE_NAME}/toggle"
@property
def import_var(self):
"""Return the import variable for the toggle component."""
return ImportVar(tag="Toggle", package_path="", install=False)
class Toggle(ToggleBaseComponent):
"""A two-state button that can be on or off. Renders a <button> element."""
tag = "Toggle"
# A unique string that id | from reflex.components.component import Component |
"""Custom toggle component."""
from reflex.components.component import Component
|
from reflex.utils.imports import ImportVar
from reflex.vars.base import Var
from reflex_ui.components.base_ui import PACKAGE_NAME, BaseUIComponent
class ClassNames:
"""Class names for toggle components."""
ROOT = "flex size-8 items-center justify-center rounded-ui-sm text-secondary-11 select-none hover:bg-secondary-3 focus-visible:bg-none active:bg-secondary-4 data-[pressed]:text-secondary-12 data-[pressed]:bg-secondary-4 transition-colors"
class ToggleBaseComponent(BaseUIComponent):
"""Base component for toggle components."""
library = f"{PACKAGE_NAME}/toggle"
@property
def import_var(self):
"""Return the import variable for the toggle component."""
return ImportVar(tag="Toggle", package_path="", install=False)
class Toggle(ToggleBaseComponent):
"""A two-state button that can be on or off. Renders a <button> element."""
tag = "Toggle"
# A unique string that identifies the toggle when used inside a toggle group.
value | from reflex.event import EventHandler, passthrough_event_spec |
"""Custom toggle component."""
from reflex.components.component import Component
from reflex.event import EventHandler, passthrough_event_spec
|
from reflex.vars.base import Var
from reflex_ui.components.base_ui import PACKAGE_NAME, BaseUIComponent
class ClassNames:
"""Class names for toggle components."""
ROOT = "flex size-8 items-center justify-center rounded-ui-sm text-secondary-11 select-none hover:bg-secondary-3 focus-visible:bg-none active:bg-secondary-4 data-[pressed]:text-secondary-12 data-[pressed]:bg-secondary-4 transition-colors"
class ToggleBaseComponent(BaseUIComponent):
"""Base component for toggle components."""
library = f"{PACKAGE_NAME}/toggle"
@property
def import_var(self):
"""Return the import variable for the toggle component."""
return ImportVar(tag="Toggle", package_path="", install=False)
class Toggle(ToggleBaseComponent):
"""A two-state button that can be on or off. Renders a <button> element."""
tag = "Toggle"
# A unique string that identifies the toggle when used inside a toggle group.
value: Var[str]
# Whether the toggle button | from reflex.utils.imports import ImportVar |
"""Custom toggle component."""
from reflex.components.component import Component
from reflex.event import EventHandler, passthrough_event_spec
from reflex.utils.imports import ImportVar
|
from reflex_ui.components.base_ui import PACKAGE_NAME, BaseUIComponent
class ClassNames:
"""Class names for toggle components."""
ROOT = "flex size-8 items-center justify-center rounded-ui-sm text-secondary-11 select-none hover:bg-secondary-3 focus-visible:bg-none active:bg-secondary-4 data-[pressed]:text-secondary-12 data-[pressed]:bg-secondary-4 transition-colors"
class ToggleBaseComponent(BaseUIComponent):
"""Base component for toggle components."""
library = f"{PACKAGE_NAME}/toggle"
@property
def import_var(self):
"""Return the import variable for the toggle component."""
return ImportVar(tag="Toggle", package_path="", install=False)
class Toggle(ToggleBaseComponent):
"""A two-state button that can be on or off. Renders a <button> element."""
tag = "Toggle"
# A unique string that identifies the toggle when used inside a toggle group.
value: Var[str]
# Whether the toggle button is currently pressed. This is th | from reflex.vars.base import Var |
"""Custom toggle component."""
from reflex.components.component import Component
from reflex.event import EventHandler, passthrough_event_spec
from reflex.utils.imports import ImportVar
from reflex.vars.base import Var
|
class ClassNames:
"""Class names for toggle components."""
ROOT = "flex size-8 items-center justify-center rounded-ui-sm text-secondary-11 select-none hover:bg-secondary-3 focus-visible:bg-none active:bg-secondary-4 data-[pressed]:text-secondary-12 data-[pressed]:bg-secondary-4 transition-colors"
class ToggleBaseComponent(BaseUIComponent):
"""Base component for toggle components."""
library = f"{PACKAGE_NAME}/toggle"
@property
def import_var(self):
"""Return the import variable for the toggle component."""
return ImportVar(tag="Toggle", package_path="", install=False)
class Toggle(ToggleBaseComponent):
"""A two-state button that can be on or off. Renders a <button> element."""
tag = "Toggle"
# A unique string that identifies the toggle when used inside a toggle group.
value: Var[str]
# Whether the toggle button is currently pressed. This is the uncontrolled counterpart of pressed. Defaults to False.
default_pr | from reflex_ui.components.base_ui import PACKAGE_NAME, BaseUIComponent |
"""Custom toggle component."""
from reflex.components.component import Component
from reflex.event import EventHandler, passthrough_event_spec
from reflex.utils.imports import ImportVar
from reflex.vars.base import Var
from reflex_ui.components.base_ui import PACKAGE_NAME, BaseUIComponent
class ClassNames:
"""Class names for toggle components."""
ROOT = "flex size-8 items-center justify-center rounded-ui-sm text-secondary-11 select-none hover:bg-secondary-3 focus-visible:bg-none active:bg-secondary-4 data-[pressed]:text-secondary-12 data-[pressed]:bg-secondary-4 transition-colors"
class ToggleBaseComponent(BaseUIComponent):
"""Base component for toggle components."""
|
@property
def import_var(self):
"""Return the import variable for the toggle component."""
return ImportVar(tag="Toggle", package_path="", install=False)
class Toggle(ToggleBaseComponent):
"""A two-state button that can be on or off. Renders a <button> element."""
tag = "Toggle"
# A unique string that identifies the toggle when used inside a toggle group.
value: Var[str]
# Whether the toggle button is currently pressed. This is the uncontrolled counterpart of pressed. Defaults to False.
default_pressed: Var[bool]
# Whether the toggle button is currently pressed. This is the controlled counterpart of default_pressed.
pressed: Var[bool]
# Callback fired when the pressed state is changed.
on_pressed_change: EventHandler[passthrough_event_spec(bool, dict)]
# Whether the component renders a native <button> element when replacing it via the render prop. Set to false if the rendered element is not a button (e.g. <di | library = f"{PACKAGE_NAME}/toggle" |
"""Custom toggle component."""
from reflex.components.component import Component
from reflex.event import EventHandler, passthrough_event_spec
from reflex.utils.imports import ImportVar
from reflex.vars.base import Var
from reflex_ui.components.base_ui import PACKAGE_NAME, BaseUIComponent
class ClassNames:
"""Class names for toggle components."""
ROOT = "flex size-8 items-center justify-center rounded-ui-sm text-secondary-11 select-none hover:bg-secondary-3 focus-visible:bg-none active:bg-secondary-4 data-[pressed]:text-secondary-12 data-[pressed]:bg-secondary-4 transition-colors"
class ToggleBaseComponent(BaseUIComponent):
"""Base component for toggle components."""
library = f"{PACKAGE_NAME}/toggle"
@property
|
class Toggle(ToggleBaseComponent):
"""A two-state button that can be on or off. Renders a <button> element."""
tag = "Toggle"
# A unique string that identifies the toggle when used inside a toggle group.
value: Var[str]
# Whether the toggle button is currently pressed. This is the uncontrolled counterpart of pressed. Defaults to False.
default_pressed: Var[bool]
# Whether the toggle button is currently pressed. This is the controlled counterpart of default_pressed.
pressed: Var[bool]
# Callback fired when the pressed state is changed.
on_pressed_change: EventHandler[passthrough_event_spec(bool, dict)]
# Whether the component renders a native <button> element when replacing it via the render prop. Set to false if the rendered element is not a button (e.g. <div>). Defaults to True.
native_button: Var[bool]
# Whether the component should ignore user interaction. Defaults to False.
disabled: Var[bool]
# The render prop
| def import_var(self):
"""Return the import variable for the toggle component."""
return ImportVar(tag="Toggle", package_path="", install=False) |
reflex.components.component import Component
from reflex.event import EventHandler, passthrough_event_spec
from reflex.utils.imports import ImportVar
from reflex.vars.base import Var
from reflex_ui.components.base_ui import PACKAGE_NAME, BaseUIComponent
class ClassNames:
"""Class names for toggle components."""
ROOT = "flex size-8 items-center justify-center rounded-ui-sm text-secondary-11 select-none hover:bg-secondary-3 focus-visible:bg-none active:bg-secondary-4 data-[pressed]:text-secondary-12 data-[pressed]:bg-secondary-4 transition-colors"
class ToggleBaseComponent(BaseUIComponent):
"""Base component for toggle components."""
library = f"{PACKAGE_NAME}/toggle"
@property
def import_var(self):
"""Return the import variable for the toggle component."""
return ImportVar(tag="Toggle", package_path="", install=False)
class Toggle(ToggleBaseComponent):
"""A two-state button that can be on or off. Renders a <button> element."""
|
# A unique string that identifies the toggle when used inside a toggle group.
value: Var[str]
# Whether the toggle button is currently pressed. This is the uncontrolled counterpart of pressed. Defaults to False.
default_pressed: Var[bool]
# Whether the toggle button is currently pressed. This is the controlled counterpart of default_pressed.
pressed: Var[bool]
# Callback fired when the pressed state is changed.
on_pressed_change: EventHandler[passthrough_event_spec(bool, dict)]
# Whether the component renders a native <button> element when replacing it via the render prop. Set to false if the rendered element is not a button (e.g. <div>). Defaults to True.
native_button: Var[bool]
# Whether the component should ignore user interaction. Defaults to False.
disabled: Var[bool]
# The render prop
render_: Var[Component]
@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create the toggle co | tag = "Toggle" |
ing that identifies the toggle when used inside a toggle group.
value: Var[str]
# Whether the toggle button is currently pressed. This is the uncontrolled counterpart of pressed. Defaults to False.
default_pressed: Var[bool]
# Whether the toggle button is currently pressed. This is the controlled counterpart of default_pressed.
pressed: Var[bool]
# Callback fired when the pressed state is changed.
on_pressed_change: EventHandler[passthrough_event_spec(bool, dict)]
# Whether the component renders a native <button> element when replacing it via the render prop. Set to false if the rendered element is not a button (e.g. <div>). Defaults to True.
native_button: Var[bool]
# Whether the component should ignore user interaction. Defaults to False.
disabled: Var[bool]
# The render prop
render_: Var[Component]
@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create the toggle component."""
|
cls.set_class_name(ClassNames.ROOT, props)
return super().create(*children, **props)
toggle = Toggle.create
| props["data-slot"] = "toggle" |
ssed. This is the uncontrolled counterpart of pressed. Defaults to False.
default_pressed: Var[bool]
# Whether the toggle button is currently pressed. This is the controlled counterpart of default_pressed.
pressed: Var[bool]
# Callback fired when the pressed state is changed.
on_pressed_change: EventHandler[passthrough_event_spec(bool, dict)]
# Whether the component renders a native <button> element when replacing it via the render prop. Set to false if the rendered element is not a button (e.g. <div>). Defaults to True.
native_button: Var[bool]
# Whether the component should ignore user interaction. Defaults to False.
disabled: Var[bool]
# The render prop
render_: Var[Component]
@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create the toggle component."""
props["data-slot"] = "toggle"
cls.set_class_name(ClassNames.ROOT, props)
return super().create(*children, **props)
| toggle = Toggle.create | |
"""Custom toggle group component."""
|
from reflex.components.component import Component
from reflex.event import EventHandler, passthrough_event_spec
from reflex.utils.imports import ImportVar
from reflex.vars.base import Var
from reflex_ui.components.base_ui import PACKAGE_NAME, BaseUIComponent
LiteralOrientation = Literal["horizontal", "vertical"]
class ClassNames:
"""Class names for toggle group components."""
ROOT = "inline-flex items-center gap-1 p-1 rounded-ui-md bg-secondary-3 data-[orientation=vertical]:flex-col data-[disabled]:opacity-50 data-[disabled]:cursor-not-allowed"
class ToggleGroupBaseComponent(BaseUIComponent):
"""Base component for toggle group components."""
library = f"{PACKAGE_NAME}/toggle-group"
@property
def import_var(self):
"""Return the import variable for the toggle group component."""
return ImportVar(tag="ToggleGroup", package_path="", install=False)
class ToggleGroupRoot(ToggleGroupBaseComponent):
"""Provides a shared state to a series | from typing import Literal |
"""Custom toggle group component."""
from typing import Literal
|
from reflex.event import EventHandler, passthrough_event_spec
from reflex.utils.imports import ImportVar
from reflex.vars.base import Var
from reflex_ui.components.base_ui import PACKAGE_NAME, BaseUIComponent
LiteralOrientation = Literal["horizontal", "vertical"]
class ClassNames:
"""Class names for toggle group components."""
ROOT = "inline-flex items-center gap-1 p-1 rounded-ui-md bg-secondary-3 data-[orientation=vertical]:flex-col data-[disabled]:opacity-50 data-[disabled]:cursor-not-allowed"
class ToggleGroupBaseComponent(BaseUIComponent):
"""Base component for toggle group components."""
library = f"{PACKAGE_NAME}/toggle-group"
@property
def import_var(self):
"""Return the import variable for the toggle group component."""
return ImportVar(tag="ToggleGroup", package_path="", install=False)
class ToggleGroupRoot(ToggleGroupBaseComponent):
"""Provides a shared state to a series of toggle buttons."""
tag = "ToggleGroup"
| from reflex.components.component import Component |
"""Custom toggle group component."""
from typing import Literal
from reflex.components.component import Component
|
from reflex.utils.imports import ImportVar
from reflex.vars.base import Var
from reflex_ui.components.base_ui import PACKAGE_NAME, BaseUIComponent
LiteralOrientation = Literal["horizontal", "vertical"]
class ClassNames:
"""Class names for toggle group components."""
ROOT = "inline-flex items-center gap-1 p-1 rounded-ui-md bg-secondary-3 data-[orientation=vertical]:flex-col data-[disabled]:opacity-50 data-[disabled]:cursor-not-allowed"
class ToggleGroupBaseComponent(BaseUIComponent):
"""Base component for toggle group components."""
library = f"{PACKAGE_NAME}/toggle-group"
@property
def import_var(self):
"""Return the import variable for the toggle group component."""
return ImportVar(tag="ToggleGroup", package_path="", install=False)
class ToggleGroupRoot(ToggleGroupBaseComponent):
"""Provides a shared state to a series of toggle buttons."""
tag = "ToggleGroup"
# The open state of the toggle group represented by an array | from reflex.event import EventHandler, passthrough_event_spec |
"""Custom toggle group component."""
from typing import Literal
from reflex.components.component import Component
from reflex.event import EventHandler, passthrough_event_spec
|
from reflex.vars.base import Var
from reflex_ui.components.base_ui import PACKAGE_NAME, BaseUIComponent
LiteralOrientation = Literal["horizontal", "vertical"]
class ClassNames:
"""Class names for toggle group components."""
ROOT = "inline-flex items-center gap-1 p-1 rounded-ui-md bg-secondary-3 data-[orientation=vertical]:flex-col data-[disabled]:opacity-50 data-[disabled]:cursor-not-allowed"
class ToggleGroupBaseComponent(BaseUIComponent):
"""Base component for toggle group components."""
library = f"{PACKAGE_NAME}/toggle-group"
@property
def import_var(self):
"""Return the import variable for the toggle group component."""
return ImportVar(tag="ToggleGroup", package_path="", install=False)
class ToggleGroupRoot(ToggleGroupBaseComponent):
"""Provides a shared state to a series of toggle buttons."""
tag = "ToggleGroup"
# The open state of the toggle group represented by an array of the values of all pressed toggle button | from reflex.utils.imports import ImportVar |
"""Custom toggle group component."""
from typing import Literal
from reflex.components.component import Component
from reflex.event import EventHandler, passthrough_event_spec
from reflex.utils.imports import ImportVar
|
from reflex_ui.components.base_ui import PACKAGE_NAME, BaseUIComponent
LiteralOrientation = Literal["horizontal", "vertical"]
class ClassNames:
"""Class names for toggle group components."""
ROOT = "inline-flex items-center gap-1 p-1 rounded-ui-md bg-secondary-3 data-[orientation=vertical]:flex-col data-[disabled]:opacity-50 data-[disabled]:cursor-not-allowed"
class ToggleGroupBaseComponent(BaseUIComponent):
"""Base component for toggle group components."""
library = f"{PACKAGE_NAME}/toggle-group"
@property
def import_var(self):
"""Return the import variable for the toggle group component."""
return ImportVar(tag="ToggleGroup", package_path="", install=False)
class ToggleGroupRoot(ToggleGroupBaseComponent):
"""Provides a shared state to a series of toggle buttons."""
tag = "ToggleGroup"
# The open state of the toggle group represented by an array of the values of all pressed toggle buttons. This is the uncontrolled count | from reflex.vars.base import Var |
"""Custom toggle group component."""
from typing import Literal
from reflex.components.component import Component
from reflex.event import EventHandler, passthrough_event_spec
from reflex.utils.imports import ImportVar
from reflex.vars.base import Var
|
LiteralOrientation = Literal["horizontal", "vertical"]
class ClassNames:
"""Class names for toggle group components."""
ROOT = "inline-flex items-center gap-1 p-1 rounded-ui-md bg-secondary-3 data-[orientation=vertical]:flex-col data-[disabled]:opacity-50 data-[disabled]:cursor-not-allowed"
class ToggleGroupBaseComponent(BaseUIComponent):
"""Base component for toggle group components."""
library = f"{PACKAGE_NAME}/toggle-group"
@property
def import_var(self):
"""Return the import variable for the toggle group component."""
return ImportVar(tag="ToggleGroup", package_path="", install=False)
class ToggleGroupRoot(ToggleGroupBaseComponent):
"""Provides a shared state to a series of toggle buttons."""
tag = "ToggleGroup"
# The open state of the toggle group represented by an array of the values of all pressed toggle buttons. This is the uncontrolled counterpart of value.
default_value: Var[list[str | int]]
# The open | from reflex_ui.components.base_ui import PACKAGE_NAME, BaseUIComponent |
"""Custom toggle group component."""
from typing import Literal
from reflex.components.component import Component
from reflex.event import EventHandler, passthrough_event_spec
from reflex.utils.imports import ImportVar
from reflex.vars.base import Var
from reflex_ui.components.base_ui import PACKAGE_NAME, BaseUIComponent
|
class ClassNames:
"""Class names for toggle group components."""
ROOT = "inline-flex items-center gap-1 p-1 rounded-ui-md bg-secondary-3 data-[orientation=vertical]:flex-col data-[disabled]:opacity-50 data-[disabled]:cursor-not-allowed"
class ToggleGroupBaseComponent(BaseUIComponent):
"""Base component for toggle group components."""
library = f"{PACKAGE_NAME}/toggle-group"
@property
def import_var(self):
"""Return the import variable for the toggle group component."""
return ImportVar(tag="ToggleGroup", package_path="", install=False)
class ToggleGroupRoot(ToggleGroupBaseComponent):
"""Provides a shared state to a series of toggle buttons."""
tag = "ToggleGroup"
# The open state of the toggle group represented by an array of the values of all pressed toggle buttons. This is the uncontrolled counterpart of value.
default_value: Var[list[str | int]]
# The open state of the toggle group represented by an array of th | LiteralOrientation = Literal["horizontal", "vertical"] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.