instruction
stringlengths
0
1k
input
stringlengths
1
1k
output
stringlengths
10
6.51k
"""Custom Accordion component.""" from typing import Any, Literal from reflex.components.component import Component, ComponentNamespace from reflex.components.core.foreach import foreach from reflex.components.el import Div from reflex.event import EventHandler, passthrough_event_spec from reflex.utils.imports import ImportVar from reflex.vars.base import Var from reflex.vars.object import ObjectVar from reflex_ui.components.base_ui import PACKAGE_NAME, BaseUIComponent
LiteralOrientation = Literal["horizontal", "vertical"] ITEMS_TYPE = list[dict[str, str | Component]] class ClassNames: """Class names for accordion components.""" ROOT = "flex flex-col justify-center shadow-small border border-secondary-a4 divide-y divide-secondary-a4 overflow-hidden rounded-xl" ITEM = "" HEADER = "" TRIGGER = "group relative flex w-full items-center justify-between gap-4 bg-secondary-1 hover:bg-secondary-3 px-6 py-4 text-md font-semibold text-secondary-12 transition-colors disabled:cursor-not-allowed disabled:bg-secondary-3 disabled:text-secondary-8 disabled:[&_svg]:text-secondary-8 [&_svg]:text-secondary-11" PANEL = "h-[var(--accordion-panel-height)] overflow-hidden text-base text-secondary-11 font-medium transition-[height] ease-out data-[ending-style]:h-0 data-[starting-style]:h-0 border-t border-secondary-a4" PANEL_DIV = "py-4 px-6" TRIGGER_ICON = "size-4 shrink-0 transition-all ease-out group-data-[panel-open]:scale-110 group
from reflex_ui.components.icons.hugeicon import icon
"""Custom Accordion component.""" from typing import Any, Literal from reflex.components.component import Component, ComponentNamespace from reflex.components.core.foreach import foreach from reflex.components.el import Div from reflex.event import EventHandler, passthrough_event_spec from reflex.utils.imports import ImportVar from reflex.vars.base import Var from reflex.vars.object import ObjectVar from reflex_ui.components.base_ui import PACKAGE_NAME, BaseUIComponent from reflex_ui.components.icons.hugeicon import icon
ITEMS_TYPE = list[dict[str, str | Component]] class ClassNames: """Class names for accordion components.""" ROOT = "flex flex-col justify-center shadow-small border border-secondary-a4 divide-y divide-secondary-a4 overflow-hidden rounded-xl" ITEM = "" HEADER = "" TRIGGER = "group relative flex w-full items-center justify-between gap-4 bg-secondary-1 hover:bg-secondary-3 px-6 py-4 text-md font-semibold text-secondary-12 transition-colors disabled:cursor-not-allowed disabled:bg-secondary-3 disabled:text-secondary-8 disabled:[&_svg]:text-secondary-8 [&_svg]:text-secondary-11" PANEL = "h-[var(--accordion-panel-height)] overflow-hidden text-base text-secondary-11 font-medium transition-[height] ease-out data-[ending-style]:h-0 data-[starting-style]:h-0 border-t border-secondary-a4" PANEL_DIV = "py-4 px-6" TRIGGER_ICON = "size-4 shrink-0 transition-all ease-out group-data-[panel-open]:scale-110 group-data-[panel-open]:rotate-45" class AccordionBaseCompo
LiteralOrientation = Literal["horizontal", "vertical"]
"""Custom Accordion component.""" from typing import Any, Literal from reflex.components.component import Component, ComponentNamespace from reflex.components.core.foreach import foreach from reflex.components.el import Div from reflex.event import EventHandler, passthrough_event_spec from reflex.utils.imports import ImportVar from reflex.vars.base import Var from reflex.vars.object import ObjectVar from reflex_ui.components.base_ui import PACKAGE_NAME, BaseUIComponent from reflex_ui.components.icons.hugeicon import icon LiteralOrientation = Literal["horizontal", "vertical"]
class ClassNames: """Class names for accordion components.""" ROOT = "flex flex-col justify-center shadow-small border border-secondary-a4 divide-y divide-secondary-a4 overflow-hidden rounded-xl" ITEM = "" HEADER = "" TRIGGER = "group relative flex w-full items-center justify-between gap-4 bg-secondary-1 hover:bg-secondary-3 px-6 py-4 text-md font-semibold text-secondary-12 transition-colors disabled:cursor-not-allowed disabled:bg-secondary-3 disabled:text-secondary-8 disabled:[&_svg]:text-secondary-8 [&_svg]:text-secondary-11" PANEL = "h-[var(--accordion-panel-height)] overflow-hidden text-base text-secondary-11 font-medium transition-[height] ease-out data-[ending-style]:h-0 data-[starting-style]:h-0 border-t border-secondary-a4" PANEL_DIV = "py-4 px-6" TRIGGER_ICON = "size-4 shrink-0 transition-all ease-out group-data-[panel-open]:scale-110 group-data-[panel-open]:rotate-45" class AccordionBaseComponent(BaseUIComponent): """Base component fo
ITEMS_TYPE = list[dict[str, str | Component]]
"""Custom Accordion component.""" from typing import Any, Literal from reflex.components.component import Component, ComponentNamespace from reflex.components.core.foreach import foreach from reflex.components.el import Div from reflex.event import EventHandler, passthrough_event_spec from reflex.utils.imports import ImportVar from reflex.vars.base import Var from reflex.vars.object import ObjectVar from reflex_ui.components.base_ui import PACKAGE_NAME, BaseUIComponent from reflex_ui.components.icons.hugeicon import icon LiteralOrientation = Literal["horizontal", "vertical"] ITEMS_TYPE = list[dict[str, str | Component]]
class AccordionBaseComponent(BaseUIComponent): """Base component for accordion components.""" library = f"{PACKAGE_NAME}/accordion" @property def import_var(self): """Return the import variable for the accordion component.""" return ImportVar(tag="Accordion", package_path="", install=False) class AccordionRoot(AccordionBaseComponent): """Groups all parts of the accordion.""" tag = "Accordion.Root" # The uncontrolled value of the item(s) that should be initially expanded. To render a controlled accordion, use the `value` prop instead. default_value: Var[list[Any]] # The controlled value of the item(s) that should be expanded. To render an uncontrolled accordion, use the `default_value` prop instead. value: Var[list[Any]] # Event handler called when an accordion item is expanded or collapsed. Provides the new value as an argument. on_value_change: EventHandler[passthrough_event_spec(list[str])] # Allows the b
class ClassNames: """Class names for accordion components.""" ROOT = "flex flex-col justify-center shadow-small border border-secondary-a4 divide-y divide-secondary-a4 overflow-hidden rounded-xl" ITEM = "" HEADER = "" TRIGGER = "group relative flex w-full items-center justify-between gap-4 bg-secondary-1 hover:bg-secondary-3 px-6 py-4 text-md font-semibold text-secondary-12 transition-colors disabled:cursor-not-allowed disabled:bg-secondary-3 disabled:text-secondary-8 disabled:[&_svg]:text-secondary-8 [&_svg]:text-secondary-11" PANEL = "h-[var(--accordion-panel-height)] overflow-hidden text-base text-secondary-11 font-medium transition-[height] ease-out data-[ending-style]:h-0 data-[starting-style]:h-0 border-t border-secondary-a4" PANEL_DIV = "py-4 px-6" TRIGGER_ICON = "size-4 shrink-0 transition-all ease-out group-data-[panel-open]:scale-110 group-data-[panel-open]:rotate-45"
"""Custom Accordion component.""" from typing import Any, Literal from reflex.components.component import Component, ComponentNamespace from reflex.components.core.foreach import foreach from reflex.components.el import Div from reflex.event import EventHandler, passthrough_event_spec from reflex.utils.imports import ImportVar from reflex.vars.base import Var from reflex.vars.object import ObjectVar from reflex_ui.components.base_ui import PACKAGE_NAME, BaseUIComponent from reflex_ui.components.icons.hugeicon import icon LiteralOrientation = Literal["horizontal", "vertical"] ITEMS_TYPE = list[dict[str, str | Component]] class ClassNames: """Class names for accordion components."""
ITEM = "" HEADER = "" TRIGGER = "group relative flex w-full items-center justify-between gap-4 bg-secondary-1 hover:bg-secondary-3 px-6 py-4 text-md font-semibold text-secondary-12 transition-colors disabled:cursor-not-allowed disabled:bg-secondary-3 disabled:text-secondary-8 disabled:[&_svg]:text-secondary-8 [&_svg]:text-secondary-11" PANEL = "h-[var(--accordion-panel-height)] overflow-hidden text-base text-secondary-11 font-medium transition-[height] ease-out data-[ending-style]:h-0 data-[starting-style]:h-0 border-t border-secondary-a4" PANEL_DIV = "py-4 px-6" TRIGGER_ICON = "size-4 shrink-0 transition-all ease-out group-data-[panel-open]:scale-110 group-data-[panel-open]:rotate-45" class AccordionBaseComponent(BaseUIComponent): """Base component for accordion components.""" library = f"{PACKAGE_NAME}/accordion" @property def import_var(self): """Return the import variable for the accordion component.""" return ImportVar(t
ROOT = "flex flex-col justify-center shadow-small border border-secondary-a4 divide-y divide-secondary-a4 overflow-hidden rounded-xl"
"""Custom Accordion component.""" from typing import Any, Literal from reflex.components.component import Component, ComponentNamespace from reflex.components.core.foreach import foreach from reflex.components.el import Div from reflex.event import EventHandler, passthrough_event_spec from reflex.utils.imports import ImportVar from reflex.vars.base import Var from reflex.vars.object import ObjectVar from reflex_ui.components.base_ui import PACKAGE_NAME, BaseUIComponent from reflex_ui.components.icons.hugeicon import icon LiteralOrientation = Literal["horizontal", "vertical"] ITEMS_TYPE = list[dict[str, str | Component]] class ClassNames: """Class names for accordion components.""" ROOT = "flex flex-col justify-center shadow-small border border-secondary-a4 divide-y divide-secondary-a4 overflow-hidden rounded-xl" ITEM = ""
TRIGGER = "group relative flex w-full items-center justify-between gap-4 bg-secondary-1 hover:bg-secondary-3 px-6 py-4 text-md font-semibold text-secondary-12 transition-colors disabled:cursor-not-allowed disabled:bg-secondary-3 disabled:text-secondary-8 disabled:[&_svg]:text-secondary-8 [&_svg]:text-secondary-11" PANEL = "h-[var(--accordion-panel-height)] overflow-hidden text-base text-secondary-11 font-medium transition-[height] ease-out data-[ending-style]:h-0 data-[starting-style]:h-0 border-t border-secondary-a4" PANEL_DIV = "py-4 px-6" TRIGGER_ICON = "size-4 shrink-0 transition-all ease-out group-data-[panel-open]:scale-110 group-data-[panel-open]:rotate-45" class AccordionBaseComponent(BaseUIComponent): """Base component for accordion components.""" library = f"{PACKAGE_NAME}/accordion" @property def import_var(self): """Return the import variable for the accordion component.""" return ImportVar(tag="Accordion", package_path="
HEADER = ""
"""Custom Accordion component.""" from typing import Any, Literal from reflex.components.component import Component, ComponentNamespace from reflex.components.core.foreach import foreach from reflex.components.el import Div from reflex.event import EventHandler, passthrough_event_spec from reflex.utils.imports import ImportVar from reflex.vars.base import Var from reflex.vars.object import ObjectVar from reflex_ui.components.base_ui import PACKAGE_NAME, BaseUIComponent from reflex_ui.components.icons.hugeicon import icon LiteralOrientation = Literal["horizontal", "vertical"] ITEMS_TYPE = list[dict[str, str | Component]] class ClassNames: """Class names for accordion components.""" ROOT = "flex flex-col justify-center shadow-small border border-secondary-a4 divide-y divide-secondary-a4 overflow-hidden rounded-xl" ITEM = "" HEADER = ""
PANEL = "h-[var(--accordion-panel-height)] overflow-hidden text-base text-secondary-11 font-medium transition-[height] ease-out data-[ending-style]:h-0 data-[starting-style]:h-0 border-t border-secondary-a4" PANEL_DIV = "py-4 px-6" TRIGGER_ICON = "size-4 shrink-0 transition-all ease-out group-data-[panel-open]:scale-110 group-data-[panel-open]:rotate-45" class AccordionBaseComponent(BaseUIComponent): """Base component for accordion components.""" library = f"{PACKAGE_NAME}/accordion" @property def import_var(self): """Return the import variable for the accordion component.""" return ImportVar(tag="Accordion", package_path="", install=False) class AccordionRoot(AccordionBaseComponent): """Groups all parts of the accordion.""" tag = "Accordion.Root" # The uncontrolled value of the item(s) that should be initially expanded. To render a controlled accordion, use the `value` prop instead. default_value: Var[list[Any]]
TRIGGER = "group relative flex w-full items-center justify-between gap-4 bg-secondary-1 hover:bg-secondary-3 px-6 py-4 text-md font-semibold text-secondary-12 transition-colors disabled:cursor-not-allowed disabled:bg-secondary-3 disabled:text-secondary-8 disabled:[&_svg]:text-secondary-8 [&_svg]:text-secondary-11"
reflex.components.el import Div from reflex.event import EventHandler, passthrough_event_spec from reflex.utils.imports import ImportVar from reflex.vars.base import Var from reflex.vars.object import ObjectVar from reflex_ui.components.base_ui import PACKAGE_NAME, BaseUIComponent from reflex_ui.components.icons.hugeicon import icon LiteralOrientation = Literal["horizontal", "vertical"] ITEMS_TYPE = list[dict[str, str | Component]] class ClassNames: """Class names for accordion components.""" ROOT = "flex flex-col justify-center shadow-small border border-secondary-a4 divide-y divide-secondary-a4 overflow-hidden rounded-xl" ITEM = "" HEADER = "" TRIGGER = "group relative flex w-full items-center justify-between gap-4 bg-secondary-1 hover:bg-secondary-3 px-6 py-4 text-md font-semibold text-secondary-12 transition-colors disabled:cursor-not-allowed disabled:bg-secondary-3 disabled:text-secondary-8 disabled:[&_svg]:text-secondary-8 [&_svg]:text-secondary-11"
PANEL_DIV = "py-4 px-6" TRIGGER_ICON = "size-4 shrink-0 transition-all ease-out group-data-[panel-open]:scale-110 group-data-[panel-open]:rotate-45" class AccordionBaseComponent(BaseUIComponent): """Base component for accordion components.""" library = f"{PACKAGE_NAME}/accordion" @property def import_var(self): """Return the import variable for the accordion component.""" return ImportVar(tag="Accordion", package_path="", install=False) class AccordionRoot(AccordionBaseComponent): """Groups all parts of the accordion.""" tag = "Accordion.Root" # The uncontrolled value of the item(s) that should be initially expanded. To render a controlled accordion, use the `value` prop instead. default_value: Var[list[Any]] # The controlled value of the item(s) that should be expanded. To render an uncontrolled accordion, use the `default_value` prop instead. value: Var[list[Any]] # Event handler called when an accordion i
PANEL = "h-[var(--accordion-panel-height)] overflow-hidden text-base text-secondary-11 font-medium transition-[height] ease-out data-[ending-style]:h-0 data-[starting-style]:h-0 border-t border-secondary-a4"
from reflex_ui.components.base_ui import PACKAGE_NAME, BaseUIComponent from reflex_ui.components.icons.hugeicon import icon LiteralOrientation = Literal["horizontal", "vertical"] ITEMS_TYPE = list[dict[str, str | Component]] class ClassNames: """Class names for accordion components.""" ROOT = "flex flex-col justify-center shadow-small border border-secondary-a4 divide-y divide-secondary-a4 overflow-hidden rounded-xl" ITEM = "" HEADER = "" TRIGGER = "group relative flex w-full items-center justify-between gap-4 bg-secondary-1 hover:bg-secondary-3 px-6 py-4 text-md font-semibold text-secondary-12 transition-colors disabled:cursor-not-allowed disabled:bg-secondary-3 disabled:text-secondary-8 disabled:[&_svg]:text-secondary-8 [&_svg]:text-secondary-11" PANEL = "h-[var(--accordion-panel-height)] overflow-hidden text-base text-secondary-11 font-medium transition-[height] ease-out data-[ending-style]:h-0 data-[starting-style]:h-0 border-t border-secondary-a4"
TRIGGER_ICON = "size-4 shrink-0 transition-all ease-out group-data-[panel-open]:scale-110 group-data-[panel-open]:rotate-45" class AccordionBaseComponent(BaseUIComponent): """Base component for accordion components.""" library = f"{PACKAGE_NAME}/accordion" @property def import_var(self): """Return the import variable for the accordion component.""" return ImportVar(tag="Accordion", package_path="", install=False) class AccordionRoot(AccordionBaseComponent): """Groups all parts of the accordion.""" tag = "Accordion.Root" # The uncontrolled value of the item(s) that should be initially expanded. To render a controlled accordion, use the `value` prop instead. default_value: Var[list[Any]] # The controlled value of the item(s) that should be expanded. To render an uncontrolled accordion, use the `default_value` prop instead. value: Var[list[Any]] # Event handler called when an accordion item is expanded or collapsed
PANEL_DIV = "py-4 px-6"
se_ui import PACKAGE_NAME, BaseUIComponent from reflex_ui.components.icons.hugeicon import icon LiteralOrientation = Literal["horizontal", "vertical"] ITEMS_TYPE = list[dict[str, str | Component]] class ClassNames: """Class names for accordion components.""" ROOT = "flex flex-col justify-center shadow-small border border-secondary-a4 divide-y divide-secondary-a4 overflow-hidden rounded-xl" ITEM = "" HEADER = "" TRIGGER = "group relative flex w-full items-center justify-between gap-4 bg-secondary-1 hover:bg-secondary-3 px-6 py-4 text-md font-semibold text-secondary-12 transition-colors disabled:cursor-not-allowed disabled:bg-secondary-3 disabled:text-secondary-8 disabled:[&_svg]:text-secondary-8 [&_svg]:text-secondary-11" PANEL = "h-[var(--accordion-panel-height)] overflow-hidden text-base text-secondary-11 font-medium transition-[height] ease-out data-[ending-style]:h-0 data-[starting-style]:h-0 border-t border-secondary-a4" PANEL_DIV = "py-4 px-6"
class AccordionBaseComponent(BaseUIComponent): """Base component for accordion components.""" library = f"{PACKAGE_NAME}/accordion" @property def import_var(self): """Return the import variable for the accordion component.""" return ImportVar(tag="Accordion", package_path="", install=False) class AccordionRoot(AccordionBaseComponent): """Groups all parts of the accordion.""" tag = "Accordion.Root" # The uncontrolled value of the item(s) that should be initially expanded. To render a controlled accordion, use the `value` prop instead. default_value: Var[list[Any]] # The controlled value of the item(s) that should be expanded. To render an uncontrolled accordion, use the `default_value` prop instead. value: Var[list[Any]] # Event handler called when an accordion item is expanded or collapsed. Provides the new value as an argument. on_value_change: EventHandler[passthrough_event_spec(list[str])] # Allows the b
TRIGGER_ICON = "size-4 shrink-0 transition-all ease-out group-data-[panel-open]:scale-110 group-data-[panel-open]:rotate-45"
horizontal", "vertical"] ITEMS_TYPE = list[dict[str, str | Component]] class ClassNames: """Class names for accordion components.""" ROOT = "flex flex-col justify-center shadow-small border border-secondary-a4 divide-y divide-secondary-a4 overflow-hidden rounded-xl" ITEM = "" HEADER = "" TRIGGER = "group relative flex w-full items-center justify-between gap-4 bg-secondary-1 hover:bg-secondary-3 px-6 py-4 text-md font-semibold text-secondary-12 transition-colors disabled:cursor-not-allowed disabled:bg-secondary-3 disabled:text-secondary-8 disabled:[&_svg]:text-secondary-8 [&_svg]:text-secondary-11" PANEL = "h-[var(--accordion-panel-height)] overflow-hidden text-base text-secondary-11 font-medium transition-[height] ease-out data-[ending-style]:h-0 data-[starting-style]:h-0 border-t border-secondary-a4" PANEL_DIV = "py-4 px-6" TRIGGER_ICON = "size-4 shrink-0 transition-all ease-out group-data-[panel-open]:scale-110 group-data-[panel-open]:rotate-45"
class AccordionRoot(AccordionBaseComponent): """Groups all parts of the accordion.""" tag = "Accordion.Root" # The uncontrolled value of the item(s) that should be initially expanded. To render a controlled accordion, use the `value` prop instead. default_value: Var[list[Any]] # The controlled value of the item(s) that should be expanded. To render an uncontrolled accordion, use the `default_value` prop instead. value: Var[list[Any]] # Event handler called when an accordion item is expanded or collapsed. Provides the new value as an argument. on_value_change: EventHandler[passthrough_event_spec(list[str])] # Allows the browser's built-in page search to find and expand the panel contents. Overrides the `keep_mounted` prop and uses `hidden="until-found"` to hide the element without removing it from the DOM. Defaults to False. hidden_until_found: Var[bool] # Whether multiple items can be open at the same time. Defaults to True. mult
class AccordionBaseComponent(BaseUIComponent): """Base component for accordion components.""" library = f"{PACKAGE_NAME}/accordion" @property def import_var(self): """Return the import variable for the accordion component.""" return ImportVar(tag="Accordion", package_path="", install=False)
s names for accordion components.""" ROOT = "flex flex-col justify-center shadow-small border border-secondary-a4 divide-y divide-secondary-a4 overflow-hidden rounded-xl" ITEM = "" HEADER = "" TRIGGER = "group relative flex w-full items-center justify-between gap-4 bg-secondary-1 hover:bg-secondary-3 px-6 py-4 text-md font-semibold text-secondary-12 transition-colors disabled:cursor-not-allowed disabled:bg-secondary-3 disabled:text-secondary-8 disabled:[&_svg]:text-secondary-8 [&_svg]:text-secondary-11" PANEL = "h-[var(--accordion-panel-height)] overflow-hidden text-base text-secondary-11 font-medium transition-[height] ease-out data-[ending-style]:h-0 data-[starting-style]:h-0 border-t border-secondary-a4" PANEL_DIV = "py-4 px-6" TRIGGER_ICON = "size-4 shrink-0 transition-all ease-out group-data-[panel-open]:scale-110 group-data-[panel-open]:rotate-45" class AccordionBaseComponent(BaseUIComponent): """Base component for accordion components."""
@property def import_var(self): """Return the import variable for the accordion component.""" return ImportVar(tag="Accordion", package_path="", install=False) class AccordionRoot(AccordionBaseComponent): """Groups all parts of the accordion.""" tag = "Accordion.Root" # The uncontrolled value of the item(s) that should be initially expanded. To render a controlled accordion, use the `value` prop instead. default_value: Var[list[Any]] # The controlled value of the item(s) that should be expanded. To render an uncontrolled accordion, use the `default_value` prop instead. value: Var[list[Any]] # Event handler called when an accordion item is expanded or collapsed. Provides the new value as an argument. on_value_change: EventHandler[passthrough_event_spec(list[str])] # Allows the browser's built-in page search to find and expand the panel contents. Overrides the `keep_mounted` prop and uses `hidden="until-found"` to hide
library = f"{PACKAGE_NAME}/accordion"
ex-col justify-center shadow-small border border-secondary-a4 divide-y divide-secondary-a4 overflow-hidden rounded-xl" ITEM = "" HEADER = "" TRIGGER = "group relative flex w-full items-center justify-between gap-4 bg-secondary-1 hover:bg-secondary-3 px-6 py-4 text-md font-semibold text-secondary-12 transition-colors disabled:cursor-not-allowed disabled:bg-secondary-3 disabled:text-secondary-8 disabled:[&_svg]:text-secondary-8 [&_svg]:text-secondary-11" PANEL = "h-[var(--accordion-panel-height)] overflow-hidden text-base text-secondary-11 font-medium transition-[height] ease-out data-[ending-style]:h-0 data-[starting-style]:h-0 border-t border-secondary-a4" PANEL_DIV = "py-4 px-6" TRIGGER_ICON = "size-4 shrink-0 transition-all ease-out group-data-[panel-open]:scale-110 group-data-[panel-open]:rotate-45" class AccordionBaseComponent(BaseUIComponent): """Base component for accordion components.""" library = f"{PACKAGE_NAME}/accordion" @property
class AccordionRoot(AccordionBaseComponent): """Groups all parts of the accordion.""" tag = "Accordion.Root" # The uncontrolled value of the item(s) that should be initially expanded. To render a controlled accordion, use the `value` prop instead. default_value: Var[list[Any]] # The controlled value of the item(s) that should be expanded. To render an uncontrolled accordion, use the `default_value` prop instead. value: Var[list[Any]] # Event handler called when an accordion item is expanded or collapsed. Provides the new value as an argument. on_value_change: EventHandler[passthrough_event_spec(list[str])] # Allows the browser's built-in page search to find and expand the panel contents. Overrides the `keep_mounted` prop and uses `hidden="until-found"` to hide the element without removing it from the DOM. Defaults to False. hidden_until_found: Var[bool] # Whether multiple items can be open at the same time. Defaults to True. mult
def import_var(self): """Return the import variable for the accordion component.""" return ImportVar(tag="Accordion", package_path="", install=False)
x-6 py-4 text-md font-semibold text-secondary-12 transition-colors disabled:cursor-not-allowed disabled:bg-secondary-3 disabled:text-secondary-8 disabled:[&_svg]:text-secondary-8 [&_svg]:text-secondary-11" PANEL = "h-[var(--accordion-panel-height)] overflow-hidden text-base text-secondary-11 font-medium transition-[height] ease-out data-[ending-style]:h-0 data-[starting-style]:h-0 border-t border-secondary-a4" PANEL_DIV = "py-4 px-6" TRIGGER_ICON = "size-4 shrink-0 transition-all ease-out group-data-[panel-open]:scale-110 group-data-[panel-open]:rotate-45" class AccordionBaseComponent(BaseUIComponent): """Base component for accordion components.""" library = f"{PACKAGE_NAME}/accordion" @property def import_var(self): """Return the import variable for the accordion component.""" return ImportVar(tag="Accordion", package_path="", install=False) class AccordionRoot(AccordionBaseComponent): """Groups all parts of the accordion."""
# The uncontrolled value of the item(s) that should be initially expanded. To render a controlled accordion, use the `value` prop instead. default_value: Var[list[Any]] # The controlled value of the item(s) that should be expanded. To render an uncontrolled accordion, use the `default_value` prop instead. value: Var[list[Any]] # Event handler called when an accordion item is expanded or collapsed. Provides the new value as an argument. on_value_change: EventHandler[passthrough_event_spec(list[str])] # Allows the browser's built-in page search to find and expand the panel contents. Overrides the `keep_mounted` prop and uses `hidden="until-found"` to hide the element without removing it from the DOM. Defaults to False. hidden_until_found: Var[bool] # Whether multiple items can be open at the same time. Defaults to True. multiple: Var[bool] # Whether the component should ignore user interaction. Defaults to False. disabled: Var[bool]
tag = "Accordion.Root"
expand the panel contents. Overrides the `keep_mounted` prop and uses `hidden="until-found"` to hide the element without removing it from the DOM. Defaults to False. hidden_until_found: Var[bool] # Whether multiple items can be open at the same time. Defaults to True. multiple: Var[bool] # Whether the component should ignore user interaction. Defaults to False. disabled: 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] # The visual orientation of the accordion. Controls whether roving focus uses left/right or up/down arrow keys. Defaults to 'vertical'. orientation: Var[LiteralOrientation] # Whether to keep the element in the DOM while the panel is closed. This prop is ignored when hidden_until_found is used. Defaults to False. keep_mounted: Var[bool] # The render prop. render_: Var[Component] @classmethod
class AccordionItem(AccordionBaseComponent): """Groups an accordion header with the corresponding panel.""" tag = "Accordion.Item" # The value that identifies this item. value: Var[str] # Event handler called when the panel is opened or closed. on_open_change: EventHandler[passthrough_event_spec(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 accordion item component.""" props["data-slot"] = "accordion-item" cls.set_class_name(ClassNames.ITEM, props) return super().create(*children, **props) class AccordionHeader(AccordionBaseComponent): """A heading that labels the corresponding panel.""" tag = "Accordion.Header" # The render prop. render_: Var[Component] @classmethod def create(cls, *childre
def create(cls, *children, **props) -> BaseUIComponent: """Create the accordion root component.""" props["data-slot"] = "accordion" cls.set_class_name(ClassNames.ROOT, props) return super().create(*children, **props)
ithout removing it from the DOM. Defaults to False. hidden_until_found: Var[bool] # Whether multiple items can be open at the same time. Defaults to True. multiple: Var[bool] # Whether the component should ignore user interaction. Defaults to False. disabled: 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] # The visual orientation of the accordion. Controls whether roving focus uses left/right or up/down arrow keys. Defaults to 'vertical'. orientation: Var[LiteralOrientation] # Whether to keep the element in the DOM while the panel is closed. This prop is ignored when hidden_until_found is used. Defaults to False. keep_mounted: Var[bool] # The render prop. render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the accordion root component."""
cls.set_class_name(ClassNames.ROOT, props) return super().create(*children, **props) class AccordionItem(AccordionBaseComponent): """Groups an accordion header with the corresponding panel.""" tag = "Accordion.Item" # The value that identifies this item. value: Var[str] # Event handler called when the panel is opened or closed. on_open_change: EventHandler[passthrough_event_spec(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 accordion item component.""" props["data-slot"] = "accordion-item" cls.set_class_name(ClassNames.ITEM, props) return super().create(*children, **props) class AccordionHeader(AccordionBaseComponent): """A heading that labels the corresponding panel.""" tag = "Accordion.Heade
props["data-slot"] = "accordion"
ame time. Defaults to True. multiple: Var[bool] # Whether the component should ignore user interaction. Defaults to False. disabled: 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] # The visual orientation of the accordion. Controls whether roving focus uses left/right or up/down arrow keys. Defaults to 'vertical'. orientation: Var[LiteralOrientation] # Whether to keep the element in the DOM while the panel is closed. This prop is ignored when hidden_until_found is used. Defaults to False. keep_mounted: Var[bool] # The render prop. render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the accordion root component.""" props["data-slot"] = "accordion" cls.set_class_name(ClassNames.ROOT, props) return super().create(*children, **props)
class AccordionHeader(AccordionBaseComponent): """A heading that labels the corresponding panel.""" tag = "Accordion.Header" # The render prop. render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the accordion header component.""" props["data-slot"] = "accordion-header" cls.set_class_name(ClassNames.HEADER, props) return super().create(*children, **props) class AccordionTrigger(AccordionBaseComponent): """A button that opens and closes the corresponding panel.""" tag = "Accordion.Trigger" # 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] # The render prop. render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the accord
class AccordionItem(AccordionBaseComponent): """Groups an accordion header with the corresponding panel.""" tag = "Accordion.Item" # The value that identifies this item. value: Var[str] # Event handler called when the panel is opened or closed. on_open_change: EventHandler[passthrough_event_spec(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 accordion item component.""" props["data-slot"] = "accordion-item" cls.set_class_name(ClassNames.ITEM, props) return super().create(*children, **props)
ults to False. disabled: 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] # The visual orientation of the accordion. Controls whether roving focus uses left/right or up/down arrow keys. Defaults to 'vertical'. orientation: Var[LiteralOrientation] # Whether to keep the element in the DOM while the panel is closed. This prop is ignored when hidden_until_found is used. Defaults to False. keep_mounted: Var[bool] # The render prop. render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the accordion root component.""" props["data-slot"] = "accordion" cls.set_class_name(ClassNames.ROOT, props) return super().create(*children, **props) class AccordionItem(AccordionBaseComponent): """Groups an accordion header with the corresponding panel."""
# The value that identifies this item. value: Var[str] # Event handler called when the panel is opened or closed. on_open_change: EventHandler[passthrough_event_spec(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 accordion item component.""" props["data-slot"] = "accordion-item" cls.set_class_name(ClassNames.ITEM, props) return super().create(*children, **props) class AccordionHeader(AccordionBaseComponent): """A heading that labels the corresponding panel.""" tag = "Accordion.Header" # The render prop. render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the accordion header component.""" props["data-slot"] = "accordion-header" c
tag = "Accordion.Item"
hether to keep the element in the DOM while the panel is closed. This prop is ignored when hidden_until_found is used. Defaults to False. keep_mounted: Var[bool] # The render prop. render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the accordion root component.""" props["data-slot"] = "accordion" cls.set_class_name(ClassNames.ROOT, props) return super().create(*children, **props) class AccordionItem(AccordionBaseComponent): """Groups an accordion header with the corresponding panel.""" tag = "Accordion.Item" # The value that identifies this item. value: Var[str] # Event handler called when the panel is opened or closed. on_open_change: EventHandler[passthrough_event_spec(bool)] # Whether the component should ignore user interaction. Defaults to False. disabled: Var[bool] # The render prop. render_: Var[Component] @classmethod
class AccordionHeader(AccordionBaseComponent): """A heading that labels the corresponding panel.""" tag = "Accordion.Header" # The render prop. render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the accordion header component.""" props["data-slot"] = "accordion-header" cls.set_class_name(ClassNames.HEADER, props) return super().create(*children, **props) class AccordionTrigger(AccordionBaseComponent): """A button that opens and closes the corresponding panel.""" tag = "Accordion.Trigger" # 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] # The render prop. render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the accord
def create(cls, *children, **props) -> BaseUIComponent: """Create the accordion item component.""" props["data-slot"] = "accordion-item" cls.set_class_name(ClassNames.ITEM, props) return super().create(*children, **props)
ed. Defaults to False. keep_mounted: Var[bool] # The render prop. render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the accordion root component.""" props["data-slot"] = "accordion" cls.set_class_name(ClassNames.ROOT, props) return super().create(*children, **props) class AccordionItem(AccordionBaseComponent): """Groups an accordion header with the corresponding panel.""" tag = "Accordion.Item" # The value that identifies this item. value: Var[str] # Event handler called when the panel is opened or closed. on_open_change: EventHandler[passthrough_event_spec(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 accordion item component."""
cls.set_class_name(ClassNames.ITEM, props) return super().create(*children, **props) class AccordionHeader(AccordionBaseComponent): """A heading that labels the corresponding panel.""" tag = "Accordion.Header" # The render prop. render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the accordion header component.""" props["data-slot"] = "accordion-header" cls.set_class_name(ClassNames.HEADER, props) return super().create(*children, **props) class AccordionTrigger(AccordionBaseComponent): """A button that opens and closes the corresponding panel.""" tag = "Accordion.Trigger" # 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] # The render prop. render_: Var[Component]
props["data-slot"] = "accordion-item"
*children, **props) -> BaseUIComponent: """Create the accordion root component.""" props["data-slot"] = "accordion" cls.set_class_name(ClassNames.ROOT, props) return super().create(*children, **props) class AccordionItem(AccordionBaseComponent): """Groups an accordion header with the corresponding panel.""" tag = "Accordion.Item" # The value that identifies this item. value: Var[str] # Event handler called when the panel is opened or closed. on_open_change: EventHandler[passthrough_event_spec(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 accordion item component.""" props["data-slot"] = "accordion-item" cls.set_class_name(ClassNames.ITEM, props) return super().create(*children, **props)
class AccordionTrigger(AccordionBaseComponent): """A button that opens and closes the corresponding panel.""" tag = "Accordion.Trigger" # 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] # The render prop. render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the accordion trigger component.""" props["data-slot"] = "accordion-trigger" cls.set_class_name(ClassNames.TRIGGER, props) return super().create(*children, **props) class AccordionPanel(AccordionBaseComponent): """A collapsible panel with the accordion item contents.""" tag = "Accordion.Panel" # Allows the browser's built-in page search to find and expand the panel contents. Overrides the `keep_mounted` prop and uses `hidden="until-foun
class AccordionHeader(AccordionBaseComponent): """A heading that labels the corresponding panel.""" tag = "Accordion.Header" # The render prop. render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the accordion header component.""" props["data-slot"] = "accordion-header" cls.set_class_name(ClassNames.HEADER, props) return super().create(*children, **props)
a-slot"] = "accordion" cls.set_class_name(ClassNames.ROOT, props) return super().create(*children, **props) class AccordionItem(AccordionBaseComponent): """Groups an accordion header with the corresponding panel.""" tag = "Accordion.Item" # The value that identifies this item. value: Var[str] # Event handler called when the panel is opened or closed. on_open_change: EventHandler[passthrough_event_spec(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 accordion item component.""" props["data-slot"] = "accordion-item" cls.set_class_name(ClassNames.ITEM, props) return super().create(*children, **props) class AccordionHeader(AccordionBaseComponent): """A heading that labels the corresponding panel."""
# The render prop. render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the accordion header component.""" props["data-slot"] = "accordion-header" cls.set_class_name(ClassNames.HEADER, props) return super().create(*children, **props) class AccordionTrigger(AccordionBaseComponent): """A button that opens and closes the corresponding panel.""" tag = "Accordion.Trigger" # 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] # The render prop. render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the accordion trigger component.""" props["data-slot"] = "accordion-trigger" cls.set_class_name(ClassNames.TRIGGER, props)
tag = "Accordion.Header"
eate(*children, **props) class AccordionItem(AccordionBaseComponent): """Groups an accordion header with the corresponding panel.""" tag = "Accordion.Item" # The value that identifies this item. value: Var[str] # Event handler called when the panel is opened or closed. on_open_change: EventHandler[passthrough_event_spec(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 accordion item component.""" props["data-slot"] = "accordion-item" cls.set_class_name(ClassNames.ITEM, props) return super().create(*children, **props) class AccordionHeader(AccordionBaseComponent): """A heading that labels the corresponding panel.""" tag = "Accordion.Header" # The render prop. render_: Var[Component] @classmethod
class AccordionTrigger(AccordionBaseComponent): """A button that opens and closes the corresponding panel.""" tag = "Accordion.Trigger" # 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] # The render prop. render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the accordion trigger component.""" props["data-slot"] = "accordion-trigger" cls.set_class_name(ClassNames.TRIGGER, props) return super().create(*children, **props) class AccordionPanel(AccordionBaseComponent): """A collapsible panel with the accordion item contents.""" tag = "Accordion.Panel" # Allows the browser's built-in page search to find and expand the panel contents. Overrides the `keep_mounted` prop and uses `hidden="until-foun
def create(cls, *children, **props) -> BaseUIComponent: """Create the accordion header component.""" props["data-slot"] = "accordion-header" cls.set_class_name(ClassNames.HEADER, props) return super().create(*children, **props)
rresponding panel.""" tag = "Accordion.Item" # The value that identifies this item. value: Var[str] # Event handler called when the panel is opened or closed. on_open_change: EventHandler[passthrough_event_spec(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 accordion item component.""" props["data-slot"] = "accordion-item" cls.set_class_name(ClassNames.ITEM, props) return super().create(*children, **props) class AccordionHeader(AccordionBaseComponent): """A heading that labels the corresponding panel.""" tag = "Accordion.Header" # The render prop. render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the accordion header component."""
cls.set_class_name(ClassNames.HEADER, props) return super().create(*children, **props) class AccordionTrigger(AccordionBaseComponent): """A button that opens and closes the corresponding panel.""" tag = "Accordion.Trigger" # 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] # The render prop. render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the accordion trigger component.""" props["data-slot"] = "accordion-trigger" cls.set_class_name(ClassNames.TRIGGER, props) return super().create(*children, **props) class AccordionPanel(AccordionBaseComponent): """A collapsible panel with the accordion item contents.""" tag = "Accordion.Panel" # Allows the browser's built-in page searc
props["data-slot"] = "accordion-header"
n the panel is opened or closed. on_open_change: EventHandler[passthrough_event_spec(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 accordion item component.""" props["data-slot"] = "accordion-item" cls.set_class_name(ClassNames.ITEM, props) return super().create(*children, **props) class AccordionHeader(AccordionBaseComponent): """A heading that labels the corresponding panel.""" tag = "Accordion.Header" # The render prop. render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the accordion header component.""" props["data-slot"] = "accordion-header" cls.set_class_name(ClassNames.HEADER, props) return super().create(*children, **props)
class AccordionPanel(AccordionBaseComponent): """A collapsible panel with the accordion item contents.""" tag = "Accordion.Panel" # Allows the browser's built-in page search to find and expand the panel contents. Overrides the `keep_mounted` prop and uses `hidden="until-found"` to hide the element without removing it from the DOM. Defaults to False. hidden_until_found: Var[bool] # Whether to keep the element in the DOM while the panel is closed. This prop is ignored when `hidden_until_found` is used. Defaults to False. keep_mounted: Var[bool] # The render prop. render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the accordion panel component.""" props["data-slot"] = "accordion-panel" cls.set_class_name(ClassNames.PANEL, props) return super().create(*children, **props) class HighLevelAccordion(AccordionRoot): """High level wrapper for the Accordion com
class AccordionTrigger(AccordionBaseComponent): """A button that opens and closes the corresponding panel.""" tag = "Accordion.Trigger" # 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] # The render prop. render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the accordion trigger component.""" props["data-slot"] = "accordion-trigger" cls.set_class_name(ClassNames.TRIGGER, props) return super().create(*children, **props)
onent 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 accordion item component.""" props["data-slot"] = "accordion-item" cls.set_class_name(ClassNames.ITEM, props) return super().create(*children, **props) class AccordionHeader(AccordionBaseComponent): """A heading that labels the corresponding panel.""" tag = "Accordion.Header" # The render prop. render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the accordion header component.""" props["data-slot"] = "accordion-header" cls.set_class_name(ClassNames.HEADER, props) return super().create(*children, **props) class AccordionTrigger(AccordionBaseComponent): """A button that opens and closes the corresponding panel."""
# 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] # The render prop. render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the accordion trigger component.""" props["data-slot"] = "accordion-trigger" cls.set_class_name(ClassNames.TRIGGER, props) return super().create(*children, **props) class AccordionPanel(AccordionBaseComponent): """A collapsible panel with the accordion item contents.""" tag = "Accordion.Panel" # Allows the browser's built-in page search to find and expand the panel contents. Overrides the `keep_mounted` prop and uses `hidden="until-found"` to hide the element without removing it from the DOM. Defaults to False. hidden_until_found: Var[bool] # Whether to keep the element i
tag = "Accordion.Trigger"
class_name(ClassNames.ITEM, props) return super().create(*children, **props) class AccordionHeader(AccordionBaseComponent): """A heading that labels the corresponding panel.""" tag = "Accordion.Header" # The render prop. render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the accordion header component.""" props["data-slot"] = "accordion-header" cls.set_class_name(ClassNames.HEADER, props) return super().create(*children, **props) class AccordionTrigger(AccordionBaseComponent): """A button that opens and closes the corresponding panel.""" tag = "Accordion.Trigger" # 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] # The render prop. render_: Var[Component] @classmethod
class AccordionPanel(AccordionBaseComponent): """A collapsible panel with the accordion item contents.""" tag = "Accordion.Panel" # Allows the browser's built-in page search to find and expand the panel contents. Overrides the `keep_mounted` prop and uses `hidden="until-found"` to hide the element without removing it from the DOM. Defaults to False. hidden_until_found: Var[bool] # Whether to keep the element in the DOM while the panel is closed. This prop is ignored when `hidden_until_found` is used. Defaults to False. keep_mounted: Var[bool] # The render prop. render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the accordion panel component.""" props["data-slot"] = "accordion-panel" cls.set_class_name(ClassNames.PANEL, props) return super().create(*children, **props) class HighLevelAccordion(AccordionRoot): """High level wrapper for the Accordion com
def create(cls, *children, **props) -> BaseUIComponent: """Create the accordion trigger component.""" props["data-slot"] = "accordion-trigger" cls.set_class_name(ClassNames.TRIGGER, props) return super().create(*children, **props)
BaseComponent): """A heading that labels the corresponding panel.""" tag = "Accordion.Header" # The render prop. render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the accordion header component.""" props["data-slot"] = "accordion-header" cls.set_class_name(ClassNames.HEADER, props) return super().create(*children, **props) class AccordionTrigger(AccordionBaseComponent): """A button that opens and closes the corresponding panel.""" tag = "Accordion.Trigger" # 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] # The render prop. render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the accordion trigger component."""
cls.set_class_name(ClassNames.TRIGGER, props) return super().create(*children, **props) class AccordionPanel(AccordionBaseComponent): """A collapsible panel with the accordion item contents.""" tag = "Accordion.Panel" # Allows the browser's built-in page search to find and expand the panel contents. Overrides the `keep_mounted` prop and uses `hidden="until-found"` to hide the element without removing it from the DOM. Defaults to False. hidden_until_found: Var[bool] # Whether to keep the element in the DOM while the panel is closed. This prop is ignored when `hidden_until_found` is used. Defaults to False. keep_mounted: Var[bool] # The render prop. render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the accordion panel component.""" props["data-slot"] = "accordion-panel" cls.set_class_name(ClassNames.PANEL, props) return super().create(*child
props["data-slot"] = "accordion-trigger"
ponent] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the accordion header component.""" props["data-slot"] = "accordion-header" cls.set_class_name(ClassNames.HEADER, props) return super().create(*children, **props) class AccordionTrigger(AccordionBaseComponent): """A button that opens and closes the corresponding panel.""" tag = "Accordion.Trigger" # 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] # The render prop. render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the accordion trigger component.""" props["data-slot"] = "accordion-trigger" cls.set_class_name(ClassNames.TRIGGER, props) return super().create(*children, **props)
class HighLevelAccordion(AccordionRoot): """High level wrapper for the Accordion component.""" items: Var[ITEMS_TYPE] | ITEMS_TYPE _item_props = {"on_open_change", "disabled"} _trigger_props = {"native_button"} _panel_props = {"hidden_until_found", "keep_mounted"} @classmethod def create( cls, items: Var[ITEMS_TYPE] | ITEMS_TYPE, **props, ) -> BaseUIComponent: """Create a high level accordion component. Args: items: List of dictionaries with 'trigger', 'content', and optional 'value' and 'disabled' keys. **props: Additional properties to apply to the accordion component. Returns: The accordion component with all necessary subcomponents. """ # Extract props for different parts item_props = {k: props.pop(k) for k in cls._item_props & props.keys()} trigger_props = {k: props.pop(k) for k in cls._trigger_props & props.keys()} pan
class AccordionPanel(AccordionBaseComponent): """A collapsible panel with the accordion item contents.""" tag = "Accordion.Panel" # Allows the browser's built-in page search to find and expand the panel contents. Overrides the `keep_mounted` prop and uses `hidden="until-found"` to hide the element without removing it from the DOM. Defaults to False. hidden_until_found: Var[bool] # Whether to keep the element in the DOM while the panel is closed. This prop is ignored when `hidden_until_found` is used. Defaults to False. keep_mounted: Var[bool] # The render prop. render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the accordion panel component.""" props["data-slot"] = "accordion-panel" cls.set_class_name(ClassNames.PANEL, props) return super().create(*children, **props)
on header component.""" props["data-slot"] = "accordion-header" cls.set_class_name(ClassNames.HEADER, props) return super().create(*children, **props) class AccordionTrigger(AccordionBaseComponent): """A button that opens and closes the corresponding panel.""" tag = "Accordion.Trigger" # 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] # The render prop. render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the accordion trigger component.""" props["data-slot"] = "accordion-trigger" cls.set_class_name(ClassNames.TRIGGER, props) return super().create(*children, **props) class AccordionPanel(AccordionBaseComponent): """A collapsible panel with the accordion item contents."""
# Allows the browser's built-in page search to find and expand the panel contents. Overrides the `keep_mounted` prop and uses `hidden="until-found"` to hide the element without removing it from the DOM. Defaults to False. hidden_until_found: Var[bool] # Whether to keep the element in the DOM while the panel is closed. This prop is ignored when `hidden_until_found` is used. Defaults to False. keep_mounted: Var[bool] # The render prop. render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the accordion panel component.""" props["data-slot"] = "accordion-panel" cls.set_class_name(ClassNames.PANEL, props) return super().create(*children, **props) class HighLevelAccordion(AccordionRoot): """High level wrapper for the Accordion component.""" items: Var[ITEMS_TYPE] | ITEMS_TYPE _item_props = {"on_open_change", "disabled"} _trigger_props = {"native_button"}
tag = "Accordion.Panel"
Var[bool] # The render prop. render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the accordion trigger component.""" props["data-slot"] = "accordion-trigger" cls.set_class_name(ClassNames.TRIGGER, props) return super().create(*children, **props) class AccordionPanel(AccordionBaseComponent): """A collapsible panel with the accordion item contents.""" tag = "Accordion.Panel" # Allows the browser's built-in page search to find and expand the panel contents. Overrides the `keep_mounted` prop and uses `hidden="until-found"` to hide the element without removing it from the DOM. Defaults to False. hidden_until_found: Var[bool] # Whether to keep the element in the DOM while the panel is closed. This prop is ignored when `hidden_until_found` is used. Defaults to False. keep_mounted: Var[bool] # The render prop. render_: Var[Component] @classmethod
class HighLevelAccordion(AccordionRoot): """High level wrapper for the Accordion component.""" items: Var[ITEMS_TYPE] | ITEMS_TYPE _item_props = {"on_open_change", "disabled"} _trigger_props = {"native_button"} _panel_props = {"hidden_until_found", "keep_mounted"} @classmethod def create( cls, items: Var[ITEMS_TYPE] | ITEMS_TYPE, **props, ) -> BaseUIComponent: """Create a high level accordion component. Args: items: List of dictionaries with 'trigger', 'content', and optional 'value' and 'disabled' keys. **props: Additional properties to apply to the accordion component. Returns: The accordion component with all necessary subcomponents. """ # Extract props for different parts item_props = {k: props.pop(k) for k in cls._item_props & props.keys()} trigger_props = {k: props.pop(k) for k in cls._trigger_props & props.keys()} pan
def create(cls, *children, **props) -> BaseUIComponent: """Create the accordion panel component.""" props["data-slot"] = "accordion-panel" cls.set_class_name(ClassNames.PANEL, props) return super().create(*children, **props)
ops) -> BaseUIComponent: """Create the accordion trigger component.""" props["data-slot"] = "accordion-trigger" cls.set_class_name(ClassNames.TRIGGER, props) return super().create(*children, **props) class AccordionPanel(AccordionBaseComponent): """A collapsible panel with the accordion item contents.""" tag = "Accordion.Panel" # Allows the browser's built-in page search to find and expand the panel contents. Overrides the `keep_mounted` prop and uses `hidden="until-found"` to hide the element without removing it from the DOM. Defaults to False. hidden_until_found: Var[bool] # Whether to keep the element in the DOM while the panel is closed. This prop is ignored when `hidden_until_found` is used. Defaults to False. keep_mounted: Var[bool] # The render prop. render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the accordion panel component."""
cls.set_class_name(ClassNames.PANEL, props) return super().create(*children, **props) class HighLevelAccordion(AccordionRoot): """High level wrapper for the Accordion component.""" items: Var[ITEMS_TYPE] | ITEMS_TYPE _item_props = {"on_open_change", "disabled"} _trigger_props = {"native_button"} _panel_props = {"hidden_until_found", "keep_mounted"} @classmethod def create( cls, items: Var[ITEMS_TYPE] | ITEMS_TYPE, **props, ) -> BaseUIComponent: """Create a high level accordion component. Args: items: List of dictionaries with 'trigger', 'content', and optional 'value' and 'disabled' keys. **props: Additional properties to apply to the accordion component. Returns: The accordion component with all necessary subcomponents. """ # Extract props for different parts item_props = {k: props.pop(k) for k in cls._item_props & props.ke
props["data-slot"] = "accordion-panel"
collapsible panel with the accordion item contents.""" tag = "Accordion.Panel" # Allows the browser's built-in page search to find and expand the panel contents. Overrides the `keep_mounted` prop and uses `hidden="until-found"` to hide the element without removing it from the DOM. Defaults to False. hidden_until_found: Var[bool] # Whether to keep the element in the DOM while the panel is closed. This prop is ignored when `hidden_until_found` is used. Defaults to False. keep_mounted: Var[bool] # The render prop. render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the accordion panel component.""" props["data-slot"] = "accordion-panel" cls.set_class_name(ClassNames.PANEL, props) return super().create(*children, **props) class HighLevelAccordion(AccordionRoot): """High level wrapper for the Accordion component.""" items: Var[ITEMS_TYPE] | ITEMS_TYPE
_trigger_props = {"native_button"} _panel_props = {"hidden_until_found", "keep_mounted"} @classmethod def create( cls, items: Var[ITEMS_TYPE] | ITEMS_TYPE, **props, ) -> BaseUIComponent: """Create a high level accordion component. Args: items: List of dictionaries with 'trigger', 'content', and optional 'value' and 'disabled' keys. **props: Additional properties to apply to the accordion component. Returns: The accordion component with all necessary subcomponents. """ # Extract props for different parts item_props = {k: props.pop(k) for k in cls._item_props & props.keys()} trigger_props = {k: props.pop(k) for k in cls._trigger_props & props.keys()} panel_props = {k: props.pop(k) for k in cls._panel_props & props.keys()} if isinstance(items, Var): accordion_items = foreach( items, lambda i
_item_props = {"on_open_change", "disabled"}
ts.""" tag = "Accordion.Panel" # Allows the browser's built-in page search to find and expand the panel contents. Overrides the `keep_mounted` prop and uses `hidden="until-found"` to hide the element without removing it from the DOM. Defaults to False. hidden_until_found: Var[bool] # Whether to keep the element in the DOM while the panel is closed. This prop is ignored when `hidden_until_found` is used. Defaults to False. keep_mounted: Var[bool] # The render prop. render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the accordion panel component.""" props["data-slot"] = "accordion-panel" cls.set_class_name(ClassNames.PANEL, props) return super().create(*children, **props) class HighLevelAccordion(AccordionRoot): """High level wrapper for the Accordion component.""" items: Var[ITEMS_TYPE] | ITEMS_TYPE _item_props = {"on_open_change", "disabled"}
_panel_props = {"hidden_until_found", "keep_mounted"} @classmethod def create( cls, items: Var[ITEMS_TYPE] | ITEMS_TYPE, **props, ) -> BaseUIComponent: """Create a high level accordion component. Args: items: List of dictionaries with 'trigger', 'content', and optional 'value' and 'disabled' keys. **props: Additional properties to apply to the accordion component. Returns: The accordion component with all necessary subcomponents. """ # Extract props for different parts item_props = {k: props.pop(k) for k in cls._item_props & props.keys()} trigger_props = {k: props.pop(k) for k in cls._trigger_props & props.keys()} panel_props = {k: props.pop(k) for k in cls._panel_props & props.keys()} if isinstance(items, Var): accordion_items = foreach( items, lambda item: cls._create_accordion_item_dynamic
_trigger_props = {"native_button"}
# Allows the browser's built-in page search to find and expand the panel contents. Overrides the `keep_mounted` prop and uses `hidden="until-found"` to hide the element without removing it from the DOM. Defaults to False. hidden_until_found: Var[bool] # Whether to keep the element in the DOM while the panel is closed. This prop is ignored when `hidden_until_found` is used. Defaults to False. keep_mounted: Var[bool] # The render prop. render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the accordion panel component.""" props["data-slot"] = "accordion-panel" cls.set_class_name(ClassNames.PANEL, props) return super().create(*children, **props) class HighLevelAccordion(AccordionRoot): """High level wrapper for the Accordion component.""" items: Var[ITEMS_TYPE] | ITEMS_TYPE _item_props = {"on_open_change", "disabled"} _trigger_props = {"native_button"}
@classmethod def create( cls, items: Var[ITEMS_TYPE] | ITEMS_TYPE, **props, ) -> BaseUIComponent: """Create a high level accordion component. Args: items: List of dictionaries with 'trigger', 'content', and optional 'value' and 'disabled' keys. **props: Additional properties to apply to the accordion component. Returns: The accordion component with all necessary subcomponents. """ # Extract props for different parts item_props = {k: props.pop(k) for k in cls._item_props & props.keys()} trigger_props = {k: props.pop(k) for k in cls._trigger_props & props.keys()} panel_props = {k: props.pop(k) for k in cls._panel_props & props.keys()} if isinstance(items, Var): accordion_items = foreach( items, lambda item: cls._create_accordion_item_dynamic( item, item_props, trigger_props, pan
_panel_props = {"hidden_until_found", "keep_mounted"}
anel component.""" props["data-slot"] = "accordion-panel" cls.set_class_name(ClassNames.PANEL, props) return super().create(*children, **props) class HighLevelAccordion(AccordionRoot): """High level wrapper for the Accordion component.""" items: Var[ITEMS_TYPE] | ITEMS_TYPE _item_props = {"on_open_change", "disabled"} _trigger_props = {"native_button"} _panel_props = {"hidden_until_found", "keep_mounted"} @classmethod def create( cls, items: Var[ITEMS_TYPE] | ITEMS_TYPE, **props, ) -> BaseUIComponent: """Create a high level accordion component. Args: items: List of dictionaries with 'trigger', 'content', and optional 'value' and 'disabled' keys. **props: Additional properties to apply to the accordion component. Returns: The accordion component with all necessary subcomponents. """ # Extract props for different parts
trigger_props = {k: props.pop(k) for k in cls._trigger_props & props.keys()} panel_props = {k: props.pop(k) for k in cls._panel_props & props.keys()} if isinstance(items, Var): accordion_items = foreach( items, lambda item: cls._create_accordion_item_dynamic( item, item_props, trigger_props, panel_props ), ) return AccordionRoot.create(accordion_items, **props) accordion_items = [ cls._create_accordion_item( item, index, item_props, trigger_props, panel_props ) for index, item in enumerate(items) ] return AccordionRoot.create(*accordion_items, **props) @classmethod def _create_trigger_icon(cls) -> Component: """Create the accordion trigger icon.""" return icon( "PlusSignIcon", class_name=ClassNames.TRIGGER_ICON, data_slot="
item_props = {k: props.pop(k) for k in cls._item_props & props.keys()}
et_class_name(ClassNames.PANEL, props) return super().create(*children, **props) class HighLevelAccordion(AccordionRoot): """High level wrapper for the Accordion component.""" items: Var[ITEMS_TYPE] | ITEMS_TYPE _item_props = {"on_open_change", "disabled"} _trigger_props = {"native_button"} _panel_props = {"hidden_until_found", "keep_mounted"} @classmethod def create( cls, items: Var[ITEMS_TYPE] | ITEMS_TYPE, **props, ) -> BaseUIComponent: """Create a high level accordion component. Args: items: List of dictionaries with 'trigger', 'content', and optional 'value' and 'disabled' keys. **props: Additional properties to apply to the accordion component. Returns: The accordion component with all necessary subcomponents. """ # Extract props for different parts item_props = {k: props.pop(k) for k in cls._item_props & props.keys()}
panel_props = {k: props.pop(k) for k in cls._panel_props & props.keys()} if isinstance(items, Var): accordion_items = foreach( items, lambda item: cls._create_accordion_item_dynamic( item, item_props, trigger_props, panel_props ), ) return AccordionRoot.create(accordion_items, **props) accordion_items = [ cls._create_accordion_item( item, index, item_props, trigger_props, panel_props ) for index, item in enumerate(items) ] return AccordionRoot.create(*accordion_items, **props) @classmethod def _create_trigger_icon(cls) -> Component: """Create the accordion trigger icon.""" return icon( "PlusSignIcon", class_name=ClassNames.TRIGGER_ICON, data_slot="accordion-trigger-icon", ) @classmethod def _create_accordion_item(
trigger_props = {k: props.pop(k) for k in cls._trigger_props & props.keys()}
ps) class HighLevelAccordion(AccordionRoot): """High level wrapper for the Accordion component.""" items: Var[ITEMS_TYPE] | ITEMS_TYPE _item_props = {"on_open_change", "disabled"} _trigger_props = {"native_button"} _panel_props = {"hidden_until_found", "keep_mounted"} @classmethod def create( cls, items: Var[ITEMS_TYPE] | ITEMS_TYPE, **props, ) -> BaseUIComponent: """Create a high level accordion component. Args: items: List of dictionaries with 'trigger', 'content', and optional 'value' and 'disabled' keys. **props: Additional properties to apply to the accordion component. Returns: The accordion component with all necessary subcomponents. """ # Extract props for different parts item_props = {k: props.pop(k) for k in cls._item_props & props.keys()} trigger_props = {k: props.pop(k) for k in cls._trigger_props & props.keys()}
if isinstance(items, Var): accordion_items = foreach( items, lambda item: cls._create_accordion_item_dynamic( item, item_props, trigger_props, panel_props ), ) return AccordionRoot.create(accordion_items, **props) accordion_items = [ cls._create_accordion_item( item, index, item_props, trigger_props, panel_props ) for index, item in enumerate(items) ] return AccordionRoot.create(*accordion_items, **props) @classmethod def _create_trigger_icon(cls) -> Component: """Create the accordion trigger icon.""" return icon( "PlusSignIcon", class_name=ClassNames.TRIGGER_ICON, data_slot="accordion-trigger-icon", ) @classmethod def _create_accordion_item( cls, item: dict[str, str | Component], index: int,
panel_props = {k: props.pop(k) for k in cls._panel_props & props.keys()}
ccordion component.""" items: Var[ITEMS_TYPE] | ITEMS_TYPE _item_props = {"on_open_change", "disabled"} _trigger_props = {"native_button"} _panel_props = {"hidden_until_found", "keep_mounted"} @classmethod def create( cls, items: Var[ITEMS_TYPE] | ITEMS_TYPE, **props, ) -> BaseUIComponent: """Create a high level accordion component. Args: items: List of dictionaries with 'trigger', 'content', and optional 'value' and 'disabled' keys. **props: Additional properties to apply to the accordion component. Returns: The accordion component with all necessary subcomponents. """ # Extract props for different parts item_props = {k: props.pop(k) for k in cls._item_props & props.keys()} trigger_props = {k: props.pop(k) for k in cls._trigger_props & props.keys()} panel_props = {k: props.pop(k) for k in cls._panel_props & props.keys()}
accordion_items = [ cls._create_accordion_item( item, index, item_props, trigger_props, panel_props ) for index, item in enumerate(items) ] return AccordionRoot.create(*accordion_items, **props) @classmethod def _create_trigger_icon(cls) -> Component: """Create the accordion trigger icon.""" return icon( "PlusSignIcon", class_name=ClassNames.TRIGGER_ICON, data_slot="accordion-trigger-icon", ) @classmethod def _create_accordion_item( cls, item: dict[str, str | Component], index: int, item_props: dict, trigger_props: dict, panel_props: dict, ) -> BaseUIComponent: """Create a single accordion item from a dictionary (for normal lists).""" return AccordionItem.create( AccordionHeader.create( AccordionTrigger.create( item.get
if isinstance(items, Var): accordion_items = foreach( items, lambda item: cls._create_accordion_item_dynamic( item, item_props, trigger_props, panel_props ), ) return AccordionRoot.create(accordion_items, **props)
ITEMS_TYPE] | ITEMS_TYPE _item_props = {"on_open_change", "disabled"} _trigger_props = {"native_button"} _panel_props = {"hidden_until_found", "keep_mounted"} @classmethod def create( cls, items: Var[ITEMS_TYPE] | ITEMS_TYPE, **props, ) -> BaseUIComponent: """Create a high level accordion component. Args: items: List of dictionaries with 'trigger', 'content', and optional 'value' and 'disabled' keys. **props: Additional properties to apply to the accordion component. Returns: The accordion component with all necessary subcomponents. """ # Extract props for different parts item_props = {k: props.pop(k) for k in cls._item_props & props.keys()} trigger_props = {k: props.pop(k) for k in cls._trigger_props & props.keys()} panel_props = {k: props.pop(k) for k in cls._panel_props & props.keys()} if isinstance(items, Var):
return AccordionRoot.create(accordion_items, **props) accordion_items = [ cls._create_accordion_item( item, index, item_props, trigger_props, panel_props ) for index, item in enumerate(items) ] return AccordionRoot.create(*accordion_items, **props) @classmethod def _create_trigger_icon(cls) -> Component: """Create the accordion trigger icon.""" return icon( "PlusSignIcon", class_name=ClassNames.TRIGGER_ICON, data_slot="accordion-trigger-icon", ) @classmethod def _create_accordion_item( cls, item: dict[str, str | Component], index: int, item_props: dict, trigger_props: dict, panel_props: dict, ) -> BaseUIComponent: """Create a single accordion item from a dictionary (for normal lists).""" return AccordionItem.create( AccordionHeader.create(
accordion_items = foreach( items, lambda item: cls._create_accordion_item_dynamic( item, item_props, trigger_props, panel_props ), )
-> BaseUIComponent: """Create a high level accordion component. Args: items: List of dictionaries with 'trigger', 'content', and optional 'value' and 'disabled' keys. **props: Additional properties to apply to the accordion component. Returns: The accordion component with all necessary subcomponents. """ # Extract props for different parts item_props = {k: props.pop(k) for k in cls._item_props & props.keys()} trigger_props = {k: props.pop(k) for k in cls._trigger_props & props.keys()} panel_props = {k: props.pop(k) for k in cls._panel_props & props.keys()} if isinstance(items, Var): accordion_items = foreach( items, lambda item: cls._create_accordion_item_dynamic( item, item_props, trigger_props, panel_props ), ) return AccordionRoot.create(accordion_items, **props)
return AccordionRoot.create(*accordion_items, **props) @classmethod def _create_trigger_icon(cls) -> Component: """Create the accordion trigger icon.""" return icon( "PlusSignIcon", class_name=ClassNames.TRIGGER_ICON, data_slot="accordion-trigger-icon", ) @classmethod def _create_accordion_item( cls, item: dict[str, str | Component], index: int, item_props: dict, trigger_props: dict, panel_props: dict, ) -> BaseUIComponent: """Create a single accordion item from a dictionary (for normal lists).""" return AccordionItem.create( AccordionHeader.create( AccordionTrigger.create( item.get("trigger"), cls._create_trigger_icon(), **trigger_props, ), ), AccordionPanel.create( Div.create(
accordion_items = [ cls._create_accordion_item( item, index, item_props, trigger_props, panel_props ) for index, item in enumerate(items) ]
Returns: The accordion component with all necessary subcomponents. """ # Extract props for different parts item_props = {k: props.pop(k) for k in cls._item_props & props.keys()} trigger_props = {k: props.pop(k) for k in cls._trigger_props & props.keys()} panel_props = {k: props.pop(k) for k in cls._panel_props & props.keys()} if isinstance(items, Var): accordion_items = foreach( items, lambda item: cls._create_accordion_item_dynamic( item, item_props, trigger_props, panel_props ), ) return AccordionRoot.create(accordion_items, **props) accordion_items = [ cls._create_accordion_item( item, index, item_props, trigger_props, panel_props ) for index, item in enumerate(items) ] return AccordionRoot.create(*accordion_items, **props) @classmethod
@classmethod def _create_accordion_item( cls, item: dict[str, str | Component], index: int, item_props: dict, trigger_props: dict, panel_props: dict, ) -> BaseUIComponent: """Create a single accordion item from a dictionary (for normal lists).""" return AccordionItem.create( AccordionHeader.create( AccordionTrigger.create( item.get("trigger"), cls._create_trigger_icon(), **trigger_props, ), ), AccordionPanel.create( Div.create( item.get("content"), class_name=ClassNames.PANEL_DIV, data_slot="accordion-panel-div", ), **panel_props, ), value=item.get("value", f"item-{index + 1}"), disabled=item.get("disabled", False), **item_props,
def _create_trigger_icon(cls) -> Component: """Create the accordion trigger icon.""" return icon( "PlusSignIcon", class_name=ClassNames.TRIGGER_ICON, data_slot="accordion-trigger-icon", )
rigger_props & props.keys()} panel_props = {k: props.pop(k) for k in cls._panel_props & props.keys()} if isinstance(items, Var): accordion_items = foreach( items, lambda item: cls._create_accordion_item_dynamic( item, item_props, trigger_props, panel_props ), ) return AccordionRoot.create(accordion_items, **props) accordion_items = [ cls._create_accordion_item( item, index, item_props, trigger_props, panel_props ) for index, item in enumerate(items) ] return AccordionRoot.create(*accordion_items, **props) @classmethod def _create_trigger_icon(cls) -> Component: """Create the accordion trigger icon.""" return icon( "PlusSignIcon", class_name=ClassNames.TRIGGER_ICON, data_slot="accordion-trigger-icon", ) @classmethod
@classmethod def _create_accordion_item_dynamic( cls, item: ObjectVar[dict[str, str | Component]], item_props: dict, trigger_props: dict, panel_props: dict, ) -> BaseUIComponent: """Create a single accordion item from a dictionary (for Var items).""" return AccordionItem.create( AccordionHeader.create( AccordionTrigger.create( item["trigger"], cls._create_trigger_icon(), **trigger_props, ), ), AccordionPanel.create( Div.create( item["content"], class_name=ClassNames.PANEL_DIV, data_slot="accordion-panel-div", ), **panel_props, ), value=item.get("value", ""), disabled=item.get("disabled", False).bool(), **item_props, ) class Acco
def _create_accordion_item( cls, item: dict[str, str | Component], index: int, item_props: dict, trigger_props: dict, panel_props: dict, ) -> BaseUIComponent: """Create a single accordion item from a dictionary (for normal lists).""" return AccordionItem.create( AccordionHeader.create( AccordionTrigger.create( item.get("trigger"), cls._create_trigger_icon(), **trigger_props, ), ), AccordionPanel.create( Div.create( item.get("content"), class_name=ClassNames.PANEL_DIV, data_slot="accordion-panel-div", ), **panel_props, ), value=item.get("value", f"item-{index + 1}"), disabled=item.get("disabled", False), **item_props, )
te_accordion_item( cls, item: dict[str, str | Component], index: int, item_props: dict, trigger_props: dict, panel_props: dict, ) -> BaseUIComponent: """Create a single accordion item from a dictionary (for normal lists).""" return AccordionItem.create( AccordionHeader.create( AccordionTrigger.create( item.get("trigger"), cls._create_trigger_icon(), **trigger_props, ), ), AccordionPanel.create( Div.create( item.get("content"), class_name=ClassNames.PANEL_DIV, data_slot="accordion-panel-div", ), **panel_props, ), value=item.get("value", f"item-{index + 1}"), disabled=item.get("disabled", False), **item_props, ) @classmethod
class Accordion(ComponentNamespace): """Namespace for Accordion components.""" root = staticmethod(AccordionRoot.create) item = staticmethod(AccordionItem.create) header = staticmethod(AccordionHeader.create) trigger = staticmethod(AccordionTrigger.create) panel = staticmethod(AccordionPanel.create) class_names = ClassNames __call__ = staticmethod(HighLevelAccordion.create) accordion = Accordion()
def _create_accordion_item_dynamic( cls, item: ObjectVar[dict[str, str | Component]], item_props: dict, trigger_props: dict, panel_props: dict, ) -> BaseUIComponent: """Create a single accordion item from a dictionary (for Var items).""" return AccordionItem.create( AccordionHeader.create( AccordionTrigger.create( item["trigger"], cls._create_trigger_icon(), **trigger_props, ), ), AccordionPanel.create( Div.create( item["content"], class_name=ClassNames.PANEL_DIV, data_slot="accordion-panel-div", ), **panel_props, ), value=item.get("value", ""), disabled=item.get("disabled", False).bool(), **item_props, )
) @classmethod def _create_accordion_item_dynamic( cls, item: ObjectVar[dict[str, str | Component]], item_props: dict, trigger_props: dict, panel_props: dict, ) -> BaseUIComponent: """Create a single accordion item from a dictionary (for Var items).""" return AccordionItem.create( AccordionHeader.create( AccordionTrigger.create( item["trigger"], cls._create_trigger_icon(), **trigger_props, ), ), AccordionPanel.create( Div.create( item["content"], class_name=ClassNames.PANEL_DIV, data_slot="accordion-panel-div", ), **panel_props, ), value=item.get("value", ""), disabled=item.get("disabled", False).bool(), **item_props, )
accordion = Accordion()
class Accordion(ComponentNamespace): """Namespace for Accordion components.""" root = staticmethod(AccordionRoot.create) item = staticmethod(AccordionItem.create) header = staticmethod(AccordionHeader.create) trigger = staticmethod(AccordionTrigger.create) panel = staticmethod(AccordionPanel.create) class_names = ClassNames __call__ = staticmethod(HighLevelAccordion.create)
item: ObjectVar[dict[str, str | Component]], item_props: dict, trigger_props: dict, panel_props: dict, ) -> BaseUIComponent: """Create a single accordion item from a dictionary (for Var items).""" return AccordionItem.create( AccordionHeader.create( AccordionTrigger.create( item["trigger"], cls._create_trigger_icon(), **trigger_props, ), ), AccordionPanel.create( Div.create( item["content"], class_name=ClassNames.PANEL_DIV, data_slot="accordion-panel-div", ), **panel_props, ), value=item.get("value", ""), disabled=item.get("disabled", False).bool(), **item_props, ) class Accordion(ComponentNamespace): """Namespace for Accordion components."""
item = staticmethod(AccordionItem.create) header = staticmethod(AccordionHeader.create) trigger = staticmethod(AccordionTrigger.create) panel = staticmethod(AccordionPanel.create) class_names = ClassNames __call__ = staticmethod(HighLevelAccordion.create) accordion = Accordion()
root = staticmethod(AccordionRoot.create)
item_props: dict, trigger_props: dict, panel_props: dict, ) -> BaseUIComponent: """Create a single accordion item from a dictionary (for Var items).""" return AccordionItem.create( AccordionHeader.create( AccordionTrigger.create( item["trigger"], cls._create_trigger_icon(), **trigger_props, ), ), AccordionPanel.create( Div.create( item["content"], class_name=ClassNames.PANEL_DIV, data_slot="accordion-panel-div", ), **panel_props, ), value=item.get("value", ""), disabled=item.get("disabled", False).bool(), **item_props, ) class Accordion(ComponentNamespace): """Namespace for Accordion components.""" root = staticmethod(AccordionRoot.create)
header = staticmethod(AccordionHeader.create) trigger = staticmethod(AccordionTrigger.create) panel = staticmethod(AccordionPanel.create) class_names = ClassNames __call__ = staticmethod(HighLevelAccordion.create) accordion = Accordion()
item = staticmethod(AccordionItem.create)
ps: dict, panel_props: dict, ) -> BaseUIComponent: """Create a single accordion item from a dictionary (for Var items).""" return AccordionItem.create( AccordionHeader.create( AccordionTrigger.create( item["trigger"], cls._create_trigger_icon(), **trigger_props, ), ), AccordionPanel.create( Div.create( item["content"], class_name=ClassNames.PANEL_DIV, data_slot="accordion-panel-div", ), **panel_props, ), value=item.get("value", ""), disabled=item.get("disabled", False).bool(), **item_props, ) class Accordion(ComponentNamespace): """Namespace for Accordion components.""" root = staticmethod(AccordionRoot.create) item = staticmethod(AccordionItem.create)
trigger = staticmethod(AccordionTrigger.create) panel = staticmethod(AccordionPanel.create) class_names = ClassNames __call__ = staticmethod(HighLevelAccordion.create) accordion = Accordion()
header = staticmethod(AccordionHeader.create)
UIComponent: """Create a single accordion item from a dictionary (for Var items).""" return AccordionItem.create( AccordionHeader.create( AccordionTrigger.create( item["trigger"], cls._create_trigger_icon(), **trigger_props, ), ), AccordionPanel.create( Div.create( item["content"], class_name=ClassNames.PANEL_DIV, data_slot="accordion-panel-div", ), **panel_props, ), value=item.get("value", ""), disabled=item.get("disabled", False).bool(), **item_props, ) class Accordion(ComponentNamespace): """Namespace for Accordion components.""" root = staticmethod(AccordionRoot.create) item = staticmethod(AccordionItem.create) header = staticmethod(AccordionHeader.create)
panel = staticmethod(AccordionPanel.create) class_names = ClassNames __call__ = staticmethod(HighLevelAccordion.create) accordion = Accordion()
trigger = staticmethod(AccordionTrigger.create)
em from a dictionary (for Var items).""" return AccordionItem.create( AccordionHeader.create( AccordionTrigger.create( item["trigger"], cls._create_trigger_icon(), **trigger_props, ), ), AccordionPanel.create( Div.create( item["content"], class_name=ClassNames.PANEL_DIV, data_slot="accordion-panel-div", ), **panel_props, ), value=item.get("value", ""), disabled=item.get("disabled", False).bool(), **item_props, ) class Accordion(ComponentNamespace): """Namespace for Accordion components.""" root = staticmethod(AccordionRoot.create) item = staticmethod(AccordionItem.create) header = staticmethod(AccordionHeader.create) trigger = staticmethod(AccordionTrigger.create)
class_names = ClassNames __call__ = staticmethod(HighLevelAccordion.create) accordion = Accordion()
panel = staticmethod(AccordionPanel.create)
return AccordionItem.create( AccordionHeader.create( AccordionTrigger.create( item["trigger"], cls._create_trigger_icon(), **trigger_props, ), ), AccordionPanel.create( Div.create( item["content"], class_name=ClassNames.PANEL_DIV, data_slot="accordion-panel-div", ), **panel_props, ), value=item.get("value", ""), disabled=item.get("disabled", False).bool(), **item_props, ) class Accordion(ComponentNamespace): """Namespace for Accordion components.""" root = staticmethod(AccordionRoot.create) item = staticmethod(AccordionItem.create) header = staticmethod(AccordionHeader.create) trigger = staticmethod(AccordionTrigger.create) panel = staticmethod(AccordionPanel.create)
__call__ = staticmethod(HighLevelAccordion.create) accordion = Accordion()
class_names = ClassNames
AccordionHeader.create( AccordionTrigger.create( item["trigger"], cls._create_trigger_icon(), **trigger_props, ), ), AccordionPanel.create( Div.create( item["content"], class_name=ClassNames.PANEL_DIV, data_slot="accordion-panel-div", ), **panel_props, ), value=item.get("value", ""), disabled=item.get("disabled", False).bool(), **item_props, ) class Accordion(ComponentNamespace): """Namespace for Accordion components.""" root = staticmethod(AccordionRoot.create) item = staticmethod(AccordionItem.create) header = staticmethod(AccordionHeader.create) trigger = staticmethod(AccordionTrigger.create) panel = staticmethod(AccordionPanel.create) class_names = ClassNames
accordion = Accordion()
__call__ = staticmethod(HighLevelAccordion.create)
AccordionTrigger.create( item["trigger"], cls._create_trigger_icon(), **trigger_props, ), ), AccordionPanel.create( Div.create( item["content"], class_name=ClassNames.PANEL_DIV, data_slot="accordion-panel-div", ), **panel_props, ), value=item.get("value", ""), disabled=item.get("disabled", False).bool(), **item_props, ) class Accordion(ComponentNamespace): """Namespace for Accordion components.""" root = staticmethod(AccordionRoot.create) item = staticmethod(AccordionItem.create) header = staticmethod(AccordionHeader.create) trigger = staticmethod(AccordionTrigger.create) panel = staticmethod(AccordionPanel.create) class_names = ClassNames __call__ = staticmethod(HighLevelAccordion.create)
accordion = Accordion()
"""Custom avatar 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 avatar components.""" ROOT = "shrink-0 inline-flex size-6 items-center justify-center overflow-hidden rounded-full bg-secondary-1 align-middle text-base font-medium text-secondary-12 select-none" IMAGE = "size-full object-cover shrink-0" FALLBACK = "flex size-full items-center justify-center text-sm animate-pulse bg-secondary-6" class AvatarBaseComponent(BaseUIComponent): """Base component for avatar components.""" library = f"{PACKAGE_NAME}/avatar" @property def import_var(self): """Return the import variable for the avatar component.""" return ImportVar(tag="Avatar", package_path="", install=False) class AvatarRoot(AvatarBaseComponent): """Displays a user's profile picture, initia
from reflex.components.component import Component, ComponentNamespace
"""Custom avatar 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 avatar components.""" ROOT = "shrink-0 inline-flex size-6 items-center justify-center overflow-hidden rounded-full bg-secondary-1 align-middle text-base font-medium text-secondary-12 select-none" IMAGE = "size-full object-cover shrink-0" FALLBACK = "flex size-full items-center justify-center text-sm animate-pulse bg-secondary-6" class AvatarBaseComponent(BaseUIComponent): """Base component for avatar components.""" library = f"{PACKAGE_NAME}/avatar" @property def import_var(self): """Return the import variable for the avatar component.""" return ImportVar(tag="Avatar", package_path="", install=False) class AvatarRoot(AvatarBaseComponent): """Displays a user's profile picture, initials, or fallback icon.""" tag = "Avatar.Root" # The component to render render_: Var[Compone
from reflex.utils.imports import ImportVar
"""Custom avatar 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 avatar components.""" ROOT = "shrink-0 inline-flex size-6 items-center justify-center overflow-hidden rounded-full bg-secondary-1 align-middle text-base font-medium text-secondary-12 select-none" IMAGE = "size-full object-cover shrink-0" FALLBACK = "flex size-full items-center justify-center text-sm animate-pulse bg-secondary-6" class AvatarBaseComponent(BaseUIComponent): """Base component for avatar components.""" library = f"{PACKAGE_NAME}/avatar" @property def import_var(self): """Return the import variable for the avatar component.""" return ImportVar(tag="Avatar", package_path="", install=False) class AvatarRoot(AvatarBaseComponent): """Displays a user's profile picture, initials, or fallback icon.""" tag = "Avatar.Root" # The component to render render_: Var[Component] @classmethod def cre
from reflex.vars.base import Var
"""Custom avatar 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 avatar components.""" ROOT = "shrink-0 inline-flex size-6 items-center justify-center overflow-hidden rounded-full bg-secondary-1 align-middle text-base font-medium text-secondary-12 select-none" IMAGE = "size-full object-cover shrink-0" FALLBACK = "flex size-full items-center justify-center text-sm animate-pulse bg-secondary-6" class AvatarBaseComponent(BaseUIComponent): """Base component for avatar components.""" library = f"{PACKAGE_NAME}/avatar" @property def import_var(self): """Return the import variable for the avatar component.""" return ImportVar(tag="Avatar", package_path="", install=False) class AvatarRoot(AvatarBaseComponent): """Displays a user's profile picture, initials, or fallback icon.""" tag = "Avatar.Root" # The component to render render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the a
from reflex_ui.components.base_ui import PACKAGE_NAME, BaseUIComponent
"""Custom avatar 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 avatar components."""
IMAGE = "size-full object-cover shrink-0" FALLBACK = "flex size-full items-center justify-center text-sm animate-pulse bg-secondary-6" class AvatarBaseComponent(BaseUIComponent): """Base component for avatar components.""" library = f"{PACKAGE_NAME}/avatar" @property def import_var(self): """Return the import variable for the avatar component.""" return ImportVar(tag="Avatar", package_path="", install=False) class AvatarRoot(AvatarBaseComponent): """Displays a user's profile picture, initials, or fallback icon.""" tag = "Avatar.Root" # The component to render render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the avatar root component.""" props["data-slot"] = "avatar" cls.set_class_name(ClassNames.ROOT, props) return super().create(*children, **props) class AvatarImage(AvatarBaseComponent): """The image to be displayed in th
ROOT = "shrink-0 inline-flex size-6 items-center justify-center overflow-hidden rounded-full bg-secondary-1 align-middle text-base font-medium text-secondary-12 select-none"
"""Custom avatar 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 avatar components.""" ROOT = "shrink-0 inline-flex size-6 items-center justify-center overflow-hidden rounded-full bg-secondary-1 align-middle text-base font-medium text-secondary-12 select-none"
FALLBACK = "flex size-full items-center justify-center text-sm animate-pulse bg-secondary-6" class AvatarBaseComponent(BaseUIComponent): """Base component for avatar components.""" library = f"{PACKAGE_NAME}/avatar" @property def import_var(self): """Return the import variable for the avatar component.""" return ImportVar(tag="Avatar", package_path="", install=False) class AvatarRoot(AvatarBaseComponent): """Displays a user's profile picture, initials, or fallback icon.""" tag = "Avatar.Root" # The component to render render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the avatar root component.""" props["data-slot"] = "avatar" cls.set_class_name(ClassNames.ROOT, props) return super().create(*children, **props) class AvatarImage(AvatarBaseComponent): """The image to be displayed in the avatar.""" tag = "Avatar.Image" #
IMAGE = "size-full object-cover shrink-0"
"""Custom avatar 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 avatar components.""" ROOT = "shrink-0 inline-flex size-6 items-center justify-center overflow-hidden rounded-full bg-secondary-1 align-middle text-base font-medium text-secondary-12 select-none" IMAGE = "size-full object-cover shrink-0"
class AvatarBaseComponent(BaseUIComponent): """Base component for avatar components.""" library = f"{PACKAGE_NAME}/avatar" @property def import_var(self): """Return the import variable for the avatar component.""" return ImportVar(tag="Avatar", package_path="", install=False) class AvatarRoot(AvatarBaseComponent): """Displays a user's profile picture, initials, or fallback icon.""" tag = "Avatar.Root" # The component to render render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the avatar root component.""" props["data-slot"] = "avatar" cls.set_class_name(ClassNames.ROOT, props) return super().create(*children, **props) class AvatarImage(AvatarBaseComponent): """The image to be displayed in the avatar.""" tag = "Avatar.Image" # The image source URL src: Var[str] # Callback when loading status changes on_loading
FALLBACK = "flex size-full items-center justify-center text-sm animate-pulse bg-secondary-6"
"""Custom avatar 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 avatar components.""" ROOT = "shrink-0 inline-flex size-6 items-center justify-center overflow-hidden rounded-full bg-secondary-1 align-middle text-base font-medium text-secondary-12 select-none" IMAGE = "size-full object-cover shrink-0" FALLBACK = "flex size-full items-center justify-center text-sm animate-pulse bg-secondary-6"
class AvatarRoot(AvatarBaseComponent): """Displays a user's profile picture, initials, or fallback icon.""" tag = "Avatar.Root" # The component to render render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the avatar root component.""" props["data-slot"] = "avatar" cls.set_class_name(ClassNames.ROOT, props) return super().create(*children, **props) class AvatarImage(AvatarBaseComponent): """The image to be displayed in the avatar.""" tag = "Avatar.Image" # The image source URL src: Var[str] # Callback when loading status changes on_loading_status_change: EventHandler[passthrough_event_spec(str)] # The component to render render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the avatar image component.""" props["data-slot"] = "avatar-image" cls.set_class_nam
class AvatarBaseComponent(BaseUIComponent): """Base component for avatar components.""" library = f"{PACKAGE_NAME}/avatar" @property def import_var(self): """Return the import variable for the avatar component.""" return ImportVar(tag="Avatar", package_path="", install=False)
"""Custom avatar 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 avatar components.""" ROOT = "shrink-0 inline-flex size-6 items-center justify-center overflow-hidden rounded-full bg-secondary-1 align-middle text-base font-medium text-secondary-12 select-none" IMAGE = "size-full object-cover shrink-0" FALLBACK = "flex size-full items-center justify-center text-sm animate-pulse bg-secondary-6" class AvatarBaseComponent(BaseUIComponent): """Base component for avatar components."""
@property def import_var(self): """Return the import variable for the avatar component.""" return ImportVar(tag="Avatar", package_path="", install=False) class AvatarRoot(AvatarBaseComponent): """Displays a user's profile picture, initials, or fallback icon.""" tag = "Avatar.Root" # The component to render render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the avatar root component.""" props["data-slot"] = "avatar" cls.set_class_name(ClassNames.ROOT, props) return super().create(*children, **props) class AvatarImage(AvatarBaseComponent): """The image to be displayed in the avatar.""" tag = "Avatar.Image" # The image source URL src: Var[str] # Callback when loading status changes on_loading_status_change: EventHandler[passthrough_event_spec(str)] # The component to render render_: Var[Component] @classmethod
library = f"{PACKAGE_NAME}/avatar"
"""Custom avatar 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 avatar components.""" ROOT = "shrink-0 inline-flex size-6 items-center justify-center overflow-hidden rounded-full bg-secondary-1 align-middle text-base font-medium text-secondary-12 select-none" IMAGE = "size-full object-cover shrink-0" FALLBACK = "flex size-full items-center justify-center text-sm animate-pulse bg-secondary-6" class AvatarBaseComponent(BaseUIComponent): """Base component for avatar components.""" library = f"{PACKAGE_NAME}/avatar" @property
class AvatarRoot(AvatarBaseComponent): """Displays a user's profile picture, initials, or fallback icon.""" tag = "Avatar.Root" # The component to render render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the avatar root component.""" props["data-slot"] = "avatar" cls.set_class_name(ClassNames.ROOT, props) return super().create(*children, **props) class AvatarImage(AvatarBaseComponent): """The image to be displayed in the avatar.""" tag = "Avatar.Image" # The image source URL src: Var[str] # Callback when loading status changes on_loading_status_change: EventHandler[passthrough_event_spec(str)] # The component to render render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the avatar image component.""" props["data-slot"] = "avatar-image" cls.set_class_nam
def import_var(self): """Return the import variable for the avatar component.""" return ImportVar(tag="Avatar", package_path="", install=False)
tHandler, 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 avatar components.""" ROOT = "shrink-0 inline-flex size-6 items-center justify-center overflow-hidden rounded-full bg-secondary-1 align-middle text-base font-medium text-secondary-12 select-none" IMAGE = "size-full object-cover shrink-0" FALLBACK = "flex size-full items-center justify-center text-sm animate-pulse bg-secondary-6" class AvatarBaseComponent(BaseUIComponent): """Base component for avatar components.""" library = f"{PACKAGE_NAME}/avatar" @property def import_var(self): """Return the import variable for the avatar component.""" return ImportVar(tag="Avatar", package_path="", install=False) class AvatarRoot(AvatarBaseComponent): """Displays a user's profile picture, initials, or fallback icon."""
# The component to render render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the avatar root component.""" props["data-slot"] = "avatar" cls.set_class_name(ClassNames.ROOT, props) return super().create(*children, **props) class AvatarImage(AvatarBaseComponent): """The image to be displayed in the avatar.""" tag = "Avatar.Image" # The image source URL src: Var[str] # Callback when loading status changes on_loading_status_change: EventHandler[passthrough_event_spec(str)] # The component to render render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the avatar image component.""" props["data-slot"] = "avatar-image" cls.set_class_name(ClassNames.IMAGE, props) return super().create(*children, **props) class AvatarFallback(AvatarBaseComponent): """Rendered w
tag = "Avatar.Root"
ort Var from reflex_ui.components.base_ui import PACKAGE_NAME, BaseUIComponent class ClassNames: """Class names for avatar components.""" ROOT = "shrink-0 inline-flex size-6 items-center justify-center overflow-hidden rounded-full bg-secondary-1 align-middle text-base font-medium text-secondary-12 select-none" IMAGE = "size-full object-cover shrink-0" FALLBACK = "flex size-full items-center justify-center text-sm animate-pulse bg-secondary-6" class AvatarBaseComponent(BaseUIComponent): """Base component for avatar components.""" library = f"{PACKAGE_NAME}/avatar" @property def import_var(self): """Return the import variable for the avatar component.""" return ImportVar(tag="Avatar", package_path="", install=False) class AvatarRoot(AvatarBaseComponent): """Displays a user's profile picture, initials, or fallback icon.""" tag = "Avatar.Root" # The component to render render_: Var[Component] @classmethod
class AvatarImage(AvatarBaseComponent): """The image to be displayed in the avatar.""" tag = "Avatar.Image" # The image source URL src: Var[str] # Callback when loading status changes on_loading_status_change: EventHandler[passthrough_event_spec(str)] # The component to render render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the avatar image component.""" props["data-slot"] = "avatar-image" cls.set_class_name(ClassNames.IMAGE, props) return super().create(*children, **props) class AvatarFallback(AvatarBaseComponent): """Rendered when the image fails to load or when no image is provided.""" tag = "Avatar.Fallback" # How long to wait before showing the fallback. Specified in milliseconds delay: Var[int] # The component to render render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent
def create(cls, *children, **props) -> BaseUIComponent: """Create the avatar root component.""" props["data-slot"] = "avatar" cls.set_class_name(ClassNames.ROOT, props) return super().create(*children, **props)
names for avatar components.""" ROOT = "shrink-0 inline-flex size-6 items-center justify-center overflow-hidden rounded-full bg-secondary-1 align-middle text-base font-medium text-secondary-12 select-none" IMAGE = "size-full object-cover shrink-0" FALLBACK = "flex size-full items-center justify-center text-sm animate-pulse bg-secondary-6" class AvatarBaseComponent(BaseUIComponent): """Base component for avatar components.""" library = f"{PACKAGE_NAME}/avatar" @property def import_var(self): """Return the import variable for the avatar component.""" return ImportVar(tag="Avatar", package_path="", install=False) class AvatarRoot(AvatarBaseComponent): """Displays a user's profile picture, initials, or fallback icon.""" tag = "Avatar.Root" # The component to render render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the avatar root component."""
cls.set_class_name(ClassNames.ROOT, props) return super().create(*children, **props) class AvatarImage(AvatarBaseComponent): """The image to be displayed in the avatar.""" tag = "Avatar.Image" # The image source URL src: Var[str] # Callback when loading status changes on_loading_status_change: EventHandler[passthrough_event_spec(str)] # The component to render render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the avatar image component.""" props["data-slot"] = "avatar-image" cls.set_class_name(ClassNames.IMAGE, props) return super().create(*children, **props) class AvatarFallback(AvatarBaseComponent): """Rendered when the image fails to load or when no image is provided.""" tag = "Avatar.Fallback" # How long to wait before showing the fallback. Specified in milliseconds delay: Var[int] # The component to render
props["data-slot"] = "avatar"
-full object-cover shrink-0" FALLBACK = "flex size-full items-center justify-center text-sm animate-pulse bg-secondary-6" class AvatarBaseComponent(BaseUIComponent): """Base component for avatar components.""" library = f"{PACKAGE_NAME}/avatar" @property def import_var(self): """Return the import variable for the avatar component.""" return ImportVar(tag="Avatar", package_path="", install=False) class AvatarRoot(AvatarBaseComponent): """Displays a user's profile picture, initials, or fallback icon.""" tag = "Avatar.Root" # The component to render render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the avatar root component.""" props["data-slot"] = "avatar" cls.set_class_name(ClassNames.ROOT, props) return super().create(*children, **props) class AvatarImage(AvatarBaseComponent): """The image to be displayed in the avatar."""
# The image source URL src: Var[str] # Callback when loading status changes on_loading_status_change: EventHandler[passthrough_event_spec(str)] # The component to render render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the avatar image component.""" props["data-slot"] = "avatar-image" cls.set_class_name(ClassNames.IMAGE, props) return super().create(*children, **props) class AvatarFallback(AvatarBaseComponent): """Rendered when the image fails to load or when no image is provided.""" tag = "Avatar.Fallback" # How long to wait before showing the fallback. Specified in milliseconds delay: Var[int] # The component to render render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the avatar fallback component.""" props["data-slot"] = "avatar-fallback" cls.set_cl
tag = "Avatar.Image"
@property def import_var(self): """Return the import variable for the avatar component.""" return ImportVar(tag="Avatar", package_path="", install=False) class AvatarRoot(AvatarBaseComponent): """Displays a user's profile picture, initials, or fallback icon.""" tag = "Avatar.Root" # The component to render render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the avatar root component.""" props["data-slot"] = "avatar" cls.set_class_name(ClassNames.ROOT, props) return super().create(*children, **props) class AvatarImage(AvatarBaseComponent): """The image to be displayed in the avatar.""" tag = "Avatar.Image" # The image source URL src: Var[str] # Callback when loading status changes on_loading_status_change: EventHandler[passthrough_event_spec(str)] # The component to render render_: Var[Component] @classmethod
class AvatarFallback(AvatarBaseComponent): """Rendered when the image fails to load or when no image is provided.""" tag = "Avatar.Fallback" # How long to wait before showing the fallback. Specified in milliseconds delay: Var[int] # The component to render render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the avatar fallback component.""" props["data-slot"] = "avatar-fallback" cls.set_class_name(ClassNames.FALLBACK, props) return super().create(*children, **props) class HighLevelAvatar(AvatarRoot): """High level wrapper for the Avatar component.""" # The image source URL src: Var[str] # Image props _image_props = {"src", "on_loading_status_change", "render_"} # Fallback props _fallback_props = {"delay"} @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the avatar component.""" #
def create(cls, *children, **props) -> BaseUIComponent: """Create the avatar image component.""" props["data-slot"] = "avatar-image" cls.set_class_name(ClassNames.IMAGE, props) return super().create(*children, **props)
eturn ImportVar(tag="Avatar", package_path="", install=False) class AvatarRoot(AvatarBaseComponent): """Displays a user's profile picture, initials, or fallback icon.""" tag = "Avatar.Root" # The component to render render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the avatar root component.""" props["data-slot"] = "avatar" cls.set_class_name(ClassNames.ROOT, props) return super().create(*children, **props) class AvatarImage(AvatarBaseComponent): """The image to be displayed in the avatar.""" tag = "Avatar.Image" # The image source URL src: Var[str] # Callback when loading status changes on_loading_status_change: EventHandler[passthrough_event_spec(str)] # The component to render render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the avatar image component."""
cls.set_class_name(ClassNames.IMAGE, props) return super().create(*children, **props) class AvatarFallback(AvatarBaseComponent): """Rendered when the image fails to load or when no image is provided.""" tag = "Avatar.Fallback" # How long to wait before showing the fallback. Specified in milliseconds delay: Var[int] # The component to render render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the avatar fallback component.""" props["data-slot"] = "avatar-fallback" cls.set_class_name(ClassNames.FALLBACK, props) return super().create(*children, **props) class HighLevelAvatar(AvatarRoot): """High level wrapper for the Avatar component.""" # The image source URL src: Var[str] # Image props _image_props = {"src", "on_loading_status_change", "render_"} # Fallback props _fallback_props = {"delay"} @classmethod def cr
props["data-slot"] = "avatar-image"
classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the avatar root component.""" props["data-slot"] = "avatar" cls.set_class_name(ClassNames.ROOT, props) return super().create(*children, **props) class AvatarImage(AvatarBaseComponent): """The image to be displayed in the avatar.""" tag = "Avatar.Image" # The image source URL src: Var[str] # Callback when loading status changes on_loading_status_change: EventHandler[passthrough_event_spec(str)] # The component to render render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the avatar image component.""" props["data-slot"] = "avatar-image" cls.set_class_name(ClassNames.IMAGE, props) return super().create(*children, **props) class AvatarFallback(AvatarBaseComponent): """Rendered when the image fails to load or when no image is provided."""
# How long to wait before showing the fallback. Specified in milliseconds delay: Var[int] # The component to render render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the avatar fallback component.""" props["data-slot"] = "avatar-fallback" cls.set_class_name(ClassNames.FALLBACK, props) return super().create(*children, **props) class HighLevelAvatar(AvatarRoot): """High level wrapper for the Avatar component.""" # The image source URL src: Var[str] # Image props _image_props = {"src", "on_loading_status_change", "render_"} # Fallback props _fallback_props = {"delay"} @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the avatar component.""" # Extract props for each subcomponent image_props = {k: props.pop(k) for k in cls._image_props & props.keys()} fallback_props = {k: props
tag = "Avatar.Fallback"
ops) return super().create(*children, **props) class AvatarImage(AvatarBaseComponent): """The image to be displayed in the avatar.""" tag = "Avatar.Image" # The image source URL src: Var[str] # Callback when loading status changes on_loading_status_change: EventHandler[passthrough_event_spec(str)] # The component to render render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the avatar image component.""" props["data-slot"] = "avatar-image" cls.set_class_name(ClassNames.IMAGE, props) return super().create(*children, **props) class AvatarFallback(AvatarBaseComponent): """Rendered when the image fails to load or when no image is provided.""" tag = "Avatar.Fallback" # How long to wait before showing the fallback. Specified in milliseconds delay: Var[int] # The component to render render_: Var[Component] @classmethod
class HighLevelAvatar(AvatarRoot): """High level wrapper for the Avatar component.""" # The image source URL src: Var[str] # Image props _image_props = {"src", "on_loading_status_change", "render_"} # Fallback props _fallback_props = {"delay"} @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the avatar component.""" # Extract props for each subcomponent image_props = {k: props.pop(k) for k in cls._image_props & props.keys()} fallback_props = {k: props.pop(k) for k in cls._fallback_props & props.keys()} return AvatarRoot.create( AvatarImage.create(**image_props), AvatarFallback.create(**fallback_props), *children, **props, ) class Avatar(ComponentNamespace): """Namespace for Avatar components.""" root = staticmethod(AvatarRoot.create) image = staticmethod(AvatarImage.create) fallback = staticmethod(Av
def create(cls, *children, **props) -> BaseUIComponent: """Create the avatar fallback component.""" props["data-slot"] = "avatar-fallback" cls.set_class_name(ClassNames.FALLBACK, props) return super().create(*children, **props)
be displayed in the avatar.""" tag = "Avatar.Image" # The image source URL src: Var[str] # Callback when loading status changes on_loading_status_change: EventHandler[passthrough_event_spec(str)] # The component to render render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the avatar image component.""" props["data-slot"] = "avatar-image" cls.set_class_name(ClassNames.IMAGE, props) return super().create(*children, **props) class AvatarFallback(AvatarBaseComponent): """Rendered when the image fails to load or when no image is provided.""" tag = "Avatar.Fallback" # How long to wait before showing the fallback. Specified in milliseconds delay: Var[int] # The component to render render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the avatar fallback component."""
cls.set_class_name(ClassNames.FALLBACK, props) return super().create(*children, **props) class HighLevelAvatar(AvatarRoot): """High level wrapper for the Avatar component.""" # The image source URL src: Var[str] # Image props _image_props = {"src", "on_loading_status_change", "render_"} # Fallback props _fallback_props = {"delay"} @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the avatar component.""" # Extract props for each subcomponent image_props = {k: props.pop(k) for k in cls._image_props & props.keys()} fallback_props = {k: props.pop(k) for k in cls._fallback_props & props.keys()} return AvatarRoot.create( AvatarImage.create(**image_props), AvatarFallback.create(**fallback_props), *children, **props, ) class Avatar(ComponentNamespace): """Namespace for Avatar components.""" root = st
props["data-slot"] = "avatar-fallback"
create(cls, *children, **props) -> BaseUIComponent: """Create the avatar image component.""" props["data-slot"] = "avatar-image" cls.set_class_name(ClassNames.IMAGE, props) return super().create(*children, **props) class AvatarFallback(AvatarBaseComponent): """Rendered when the image fails to load or when no image is provided.""" tag = "Avatar.Fallback" # How long to wait before showing the fallback. Specified in milliseconds delay: Var[int] # The component to render render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the avatar fallback component.""" props["data-slot"] = "avatar-fallback" cls.set_class_name(ClassNames.FALLBACK, props) return super().create(*children, **props) class HighLevelAvatar(AvatarRoot): """High level wrapper for the Avatar component.""" # The image source URL src: Var[str] # Image props
# Fallback props _fallback_props = {"delay"} @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the avatar component.""" # Extract props for each subcomponent image_props = {k: props.pop(k) for k in cls._image_props & props.keys()} fallback_props = {k: props.pop(k) for k in cls._fallback_props & props.keys()} return AvatarRoot.create( AvatarImage.create(**image_props), AvatarFallback.create(**fallback_props), *children, **props, ) class Avatar(ComponentNamespace): """Namespace for Avatar components.""" root = staticmethod(AvatarRoot.create) image = staticmethod(AvatarImage.create) fallback = staticmethod(AvatarFallback.create) class_names = ClassNames __call__ = staticmethod(HighLevelAvatar.create) avatar = Avatar()
_image_props = {"src", "on_loading_status_change", "render_"}
omponent.""" props["data-slot"] = "avatar-image" cls.set_class_name(ClassNames.IMAGE, props) return super().create(*children, **props) class AvatarFallback(AvatarBaseComponent): """Rendered when the image fails to load or when no image is provided.""" tag = "Avatar.Fallback" # How long to wait before showing the fallback. Specified in milliseconds delay: Var[int] # The component to render render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the avatar fallback component.""" props["data-slot"] = "avatar-fallback" cls.set_class_name(ClassNames.FALLBACK, props) return super().create(*children, **props) class HighLevelAvatar(AvatarRoot): """High level wrapper for the Avatar component.""" # The image source URL src: Var[str] # Image props _image_props = {"src", "on_loading_status_change", "render_"} # Fallback props
@classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the avatar component.""" # Extract props for each subcomponent image_props = {k: props.pop(k) for k in cls._image_props & props.keys()} fallback_props = {k: props.pop(k) for k in cls._fallback_props & props.keys()} return AvatarRoot.create( AvatarImage.create(**image_props), AvatarFallback.create(**fallback_props), *children, **props, ) class Avatar(ComponentNamespace): """Namespace for Avatar components.""" root = staticmethod(AvatarRoot.create) image = staticmethod(AvatarImage.create) fallback = staticmethod(AvatarFallback.create) class_names = ClassNames __call__ = staticmethod(HighLevelAvatar.create) avatar = Avatar()
_fallback_props = {"delay"}
"""Rendered when the image fails to load or when no image is provided.""" tag = "Avatar.Fallback" # How long to wait before showing the fallback. Specified in milliseconds delay: Var[int] # The component to render render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the avatar fallback component.""" props["data-slot"] = "avatar-fallback" cls.set_class_name(ClassNames.FALLBACK, props) return super().create(*children, **props) class HighLevelAvatar(AvatarRoot): """High level wrapper for the Avatar component.""" # The image source URL src: Var[str] # Image props _image_props = {"src", "on_loading_status_change", "render_"} # Fallback props _fallback_props = {"delay"} @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the avatar component.""" # Extract props for each subcomponent
fallback_props = {k: props.pop(k) for k in cls._fallback_props & props.keys()} return AvatarRoot.create( AvatarImage.create(**image_props), AvatarFallback.create(**fallback_props), *children, **props, ) class Avatar(ComponentNamespace): """Namespace for Avatar components.""" root = staticmethod(AvatarRoot.create) image = staticmethod(AvatarImage.create) fallback = staticmethod(AvatarFallback.create) class_names = ClassNames __call__ = staticmethod(HighLevelAvatar.create) avatar = Avatar()
image_props = {k: props.pop(k) for k in cls._image_props & props.keys()}
tag = "Avatar.Fallback" # How long to wait before showing the fallback. Specified in milliseconds delay: Var[int] # The component to render render_: Var[Component] @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the avatar fallback component.""" props["data-slot"] = "avatar-fallback" cls.set_class_name(ClassNames.FALLBACK, props) return super().create(*children, **props) class HighLevelAvatar(AvatarRoot): """High level wrapper for the Avatar component.""" # The image source URL src: Var[str] # Image props _image_props = {"src", "on_loading_status_change", "render_"} # Fallback props _fallback_props = {"delay"} @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the avatar component.""" # Extract props for each subcomponent image_props = {k: props.pop(k) for k in cls._image_props & props.keys()}
return AvatarRoot.create( AvatarImage.create(**image_props), AvatarFallback.create(**fallback_props), *children, **props, ) class Avatar(ComponentNamespace): """Namespace for Avatar components.""" root = staticmethod(AvatarRoot.create) image = staticmethod(AvatarImage.create) fallback = staticmethod(AvatarFallback.create) class_names = ClassNames __call__ = staticmethod(HighLevelAvatar.create) avatar = Avatar()
fallback_props = {k: props.pop(k) for k in cls._fallback_props & props.keys()}
"""Create the avatar fallback component.""" props["data-slot"] = "avatar-fallback" cls.set_class_name(ClassNames.FALLBACK, props) return super().create(*children, **props) class HighLevelAvatar(AvatarRoot): """High level wrapper for the Avatar component.""" # The image source URL src: Var[str] # Image props _image_props = {"src", "on_loading_status_change", "render_"} # Fallback props _fallback_props = {"delay"} @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the avatar component.""" # Extract props for each subcomponent image_props = {k: props.pop(k) for k in cls._image_props & props.keys()} fallback_props = {k: props.pop(k) for k in cls._fallback_props & props.keys()} return AvatarRoot.create( AvatarImage.create(**image_props), AvatarFallback.create(**fallback_props), *children, **props, )
avatar = Avatar()
class Avatar(ComponentNamespace): """Namespace for Avatar components.""" root = staticmethod(AvatarRoot.create) image = staticmethod(AvatarImage.create) fallback = staticmethod(AvatarFallback.create) class_names = ClassNames __call__ = staticmethod(HighLevelAvatar.create)
fallback" cls.set_class_name(ClassNames.FALLBACK, props) return super().create(*children, **props) class HighLevelAvatar(AvatarRoot): """High level wrapper for the Avatar component.""" # The image source URL src: Var[str] # Image props _image_props = {"src", "on_loading_status_change", "render_"} # Fallback props _fallback_props = {"delay"} @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the avatar component.""" # Extract props for each subcomponent image_props = {k: props.pop(k) for k in cls._image_props & props.keys()} fallback_props = {k: props.pop(k) for k in cls._fallback_props & props.keys()} return AvatarRoot.create( AvatarImage.create(**image_props), AvatarFallback.create(**fallback_props), *children, **props, ) class Avatar(ComponentNamespace): """Namespace for Avatar components."""
image = staticmethod(AvatarImage.create) fallback = staticmethod(AvatarFallback.create) class_names = ClassNames __call__ = staticmethod(HighLevelAvatar.create) avatar = Avatar()
root = staticmethod(AvatarRoot.create)
ames.FALLBACK, props) return super().create(*children, **props) class HighLevelAvatar(AvatarRoot): """High level wrapper for the Avatar component.""" # The image source URL src: Var[str] # Image props _image_props = {"src", "on_loading_status_change", "render_"} # Fallback props _fallback_props = {"delay"} @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the avatar component.""" # Extract props for each subcomponent image_props = {k: props.pop(k) for k in cls._image_props & props.keys()} fallback_props = {k: props.pop(k) for k in cls._fallback_props & props.keys()} return AvatarRoot.create( AvatarImage.create(**image_props), AvatarFallback.create(**fallback_props), *children, **props, ) class Avatar(ComponentNamespace): """Namespace for Avatar components.""" root = staticmethod(AvatarRoot.create)
fallback = staticmethod(AvatarFallback.create) class_names = ClassNames __call__ = staticmethod(HighLevelAvatar.create) avatar = Avatar()
image = staticmethod(AvatarImage.create)
create(*children, **props) class HighLevelAvatar(AvatarRoot): """High level wrapper for the Avatar component.""" # The image source URL src: Var[str] # Image props _image_props = {"src", "on_loading_status_change", "render_"} # Fallback props _fallback_props = {"delay"} @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the avatar component.""" # Extract props for each subcomponent image_props = {k: props.pop(k) for k in cls._image_props & props.keys()} fallback_props = {k: props.pop(k) for k in cls._fallback_props & props.keys()} return AvatarRoot.create( AvatarImage.create(**image_props), AvatarFallback.create(**fallback_props), *children, **props, ) class Avatar(ComponentNamespace): """Namespace for Avatar components.""" root = staticmethod(AvatarRoot.create) image = staticmethod(AvatarImage.create)
class_names = ClassNames __call__ = staticmethod(HighLevelAvatar.create) avatar = Avatar()
fallback = staticmethod(AvatarFallback.create)
AvatarRoot): """High level wrapper for the Avatar component.""" # The image source URL src: Var[str] # Image props _image_props = {"src", "on_loading_status_change", "render_"} # Fallback props _fallback_props = {"delay"} @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the avatar component.""" # Extract props for each subcomponent image_props = {k: props.pop(k) for k in cls._image_props & props.keys()} fallback_props = {k: props.pop(k) for k in cls._fallback_props & props.keys()} return AvatarRoot.create( AvatarImage.create(**image_props), AvatarFallback.create(**fallback_props), *children, **props, ) class Avatar(ComponentNamespace): """Namespace for Avatar components.""" root = staticmethod(AvatarRoot.create) image = staticmethod(AvatarImage.create) fallback = staticmethod(AvatarFallback.create)
__call__ = staticmethod(HighLevelAvatar.create) avatar = Avatar()
class_names = ClassNames
l wrapper for the Avatar component.""" # The image source URL src: Var[str] # Image props _image_props = {"src", "on_loading_status_change", "render_"} # Fallback props _fallback_props = {"delay"} @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the avatar component.""" # Extract props for each subcomponent image_props = {k: props.pop(k) for k in cls._image_props & props.keys()} fallback_props = {k: props.pop(k) for k in cls._fallback_props & props.keys()} return AvatarRoot.create( AvatarImage.create(**image_props), AvatarFallback.create(**fallback_props), *children, **props, ) class Avatar(ComponentNamespace): """Namespace for Avatar components.""" root = staticmethod(AvatarRoot.create) image = staticmethod(AvatarImage.create) fallback = staticmethod(AvatarFallback.create) class_names = ClassNames
avatar = Avatar()
__call__ = staticmethod(HighLevelAvatar.create)
image source URL src: Var[str] # Image props _image_props = {"src", "on_loading_status_change", "render_"} # Fallback props _fallback_props = {"delay"} @classmethod def create(cls, *children, **props) -> BaseUIComponent: """Create the avatar component.""" # Extract props for each subcomponent image_props = {k: props.pop(k) for k in cls._image_props & props.keys()} fallback_props = {k: props.pop(k) for k in cls._fallback_props & props.keys()} return AvatarRoot.create( AvatarImage.create(**image_props), AvatarFallback.create(**fallback_props), *children, **props, ) class Avatar(ComponentNamespace): """Namespace for Avatar components.""" root = staticmethod(AvatarRoot.create) image = staticmethod(AvatarImage.create) fallback = staticmethod(AvatarFallback.create) class_names = ClassNames __call__ = staticmethod(HighLevelAvatar.create)
avatar = Avatar()
"""Badge component."""
from reflex.components.el import Span from reflex.vars.base import Var from reflex_ui.components.component import CoreComponent BaseColorType = Literal[ "primary", "secondary", "info", "success", "warning", "destructive", "gray", "mauve", "slate", "sage", "olive", "sand", "tomato", "red", "ruby", "crimson", "pink", "plum", "purple", "violet", "iris", "indigo", "blue", "cyan", "teal", "jade", "green", "grass", "brown", "orange", "sky", "mint", "lime", "yellow", "amber", "gold", "bronze", ] LiteralBadgeVariant = Literal["solid", "soft"] LiteralBadgeSize = Literal["xs", "sm", "md"] DEFAULT_BASE_CLASSES = "inline-flex items-center font-medium [&_svg]:pointer-events-none [&_svg]:shrink-0 gap-1.5" # Light colors that need dark text on solid backgrounds for better contrast LIGHT_COLORS = {"sky", "mint", "lime", "yellow", "amber", "secondary"
from typing import Literal
"""Badge component.""" from typing import Literal
from reflex.vars.base import Var from reflex_ui.components.component import CoreComponent BaseColorType = Literal[ "primary", "secondary", "info", "success", "warning", "destructive", "gray", "mauve", "slate", "sage", "olive", "sand", "tomato", "red", "ruby", "crimson", "pink", "plum", "purple", "violet", "iris", "indigo", "blue", "cyan", "teal", "jade", "green", "grass", "brown", "orange", "sky", "mint", "lime", "yellow", "amber", "gold", "bronze", ] LiteralBadgeVariant = Literal["solid", "soft"] LiteralBadgeSize = Literal["xs", "sm", "md"] DEFAULT_BASE_CLASSES = "inline-flex items-center font-medium [&_svg]:pointer-events-none [&_svg]:shrink-0 gap-1.5" # Light colors that need dark text on solid backgrounds for better contrast LIGHT_COLORS = {"sky", "mint", "lime", "yellow", "amber", "secondary"} BADGE_VARIANTS = { "size": {
from reflex.components.el import Span
"""Badge component.""" from typing import Literal from reflex.components.el import Span from reflex.vars.base import Var
BaseColorType = Literal[ "primary", "secondary", "info", "success", "warning", "destructive", "gray", "mauve", "slate", "sage", "olive", "sand", "tomato", "red", "ruby", "crimson", "pink", "plum", "purple", "violet", "iris", "indigo", "blue", "cyan", "teal", "jade", "green", "grass", "brown", "orange", "sky", "mint", "lime", "yellow", "amber", "gold", "bronze", ] LiteralBadgeVariant = Literal["solid", "soft"] LiteralBadgeSize = Literal["xs", "sm", "md"] DEFAULT_BASE_CLASSES = "inline-flex items-center font-medium [&_svg]:pointer-events-none [&_svg]:shrink-0 gap-1.5" # Light colors that need dark text on solid backgrounds for better contrast LIGHT_COLORS = {"sky", "mint", "lime", "yellow", "amber", "secondary"} BADGE_VARIANTS = { "size": { "xs": "px-1.5 py-0.5 h-4 rounded-ui-xss text-[11px] [&_svg]:size-3", "sm": "px
from reflex_ui.components.component import CoreComponent
"""Badge component.""" from typing import Literal from reflex.components.el import Span from reflex.vars.base import Var from reflex_ui.components.component import CoreComponent BaseColorType = Literal[ "primary", "secondary", "info", "success", "warning", "destructive", "gray", "mauve", "slate", "sage", "olive", "sand", "tomato", "red", "ruby", "crimson", "pink", "plum", "purple", "violet", "iris", "indigo", "blue", "cyan", "teal", "jade", "green", "grass", "brown", "orange", "sky", "mint", "lime", "yellow", "amber", "gold", "bronze", ]
LiteralBadgeSize = Literal["xs", "sm", "md"] DEFAULT_BASE_CLASSES = "inline-flex items-center font-medium [&_svg]:pointer-events-none [&_svg]:shrink-0 gap-1.5" # Light colors that need dark text on solid backgrounds for better contrast LIGHT_COLORS = {"sky", "mint", "lime", "yellow", "amber", "secondary"} BADGE_VARIANTS = { "size": { "xs": "px-1.5 py-0.5 h-4 rounded-ui-xss text-[11px] [&_svg]:size-3", "sm": "px-1.5 py-0.5 h-5 rounded-ui-xs text-xs [&_svg]:size-3.5", "md": "px-2 py-0.5 h-6 rounded-ui-sm text-sm [&_svg]:size-4", } } def get_color_classes(color: str, variant: LiteralBadgeVariant) -> str: """Get the color-specific classes based on color and variant.""" if variant == "solid": text_color = "text-black/90" if color in LIGHT_COLORS else "text-white" return f"border-transparent bg-{color}-9 {text_color}" # Soft variant return f"border-transparent bg-{color}-3 text-{color}-11" def get_badge_classes( colo
LiteralBadgeVariant = Literal["solid", "soft"]
"""Badge component.""" from typing import Literal from reflex.components.el import Span from reflex.vars.base import Var from reflex_ui.components.component import CoreComponent BaseColorType = Literal[ "primary", "secondary", "info", "success", "warning", "destructive", "gray", "mauve", "slate", "sage", "olive", "sand", "tomato", "red", "ruby", "crimson", "pink", "plum", "purple", "violet", "iris", "indigo", "blue", "cyan", "teal", "jade", "green", "grass", "brown", "orange", "sky", "mint", "lime", "yellow", "amber", "gold", "bronze", ] LiteralBadgeVariant = Literal["solid", "soft"]
DEFAULT_BASE_CLASSES = "inline-flex items-center font-medium [&_svg]:pointer-events-none [&_svg]:shrink-0 gap-1.5" # Light colors that need dark text on solid backgrounds for better contrast LIGHT_COLORS = {"sky", "mint", "lime", "yellow", "amber", "secondary"} BADGE_VARIANTS = { "size": { "xs": "px-1.5 py-0.5 h-4 rounded-ui-xss text-[11px] [&_svg]:size-3", "sm": "px-1.5 py-0.5 h-5 rounded-ui-xs text-xs [&_svg]:size-3.5", "md": "px-2 py-0.5 h-6 rounded-ui-sm text-sm [&_svg]:size-4", } } def get_color_classes(color: str, variant: LiteralBadgeVariant) -> str: """Get the color-specific classes based on color and variant.""" if variant == "solid": text_color = "text-black/90" if color in LIGHT_COLORS else "text-white" return f"border-transparent bg-{color}-9 {text_color}" # Soft variant return f"border-transparent bg-{color}-3 text-{color}-11" def get_badge_classes( color: str, variant: LiteralBadgeVariant, size: L
LiteralBadgeSize = Literal["xs", "sm", "md"]
"""Badge component.""" from typing import Literal from reflex.components.el import Span from reflex.vars.base import Var from reflex_ui.components.component import CoreComponent BaseColorType = Literal[ "primary", "secondary", "info", "success", "warning", "destructive", "gray", "mauve", "slate", "sage", "olive", "sand", "tomato", "red", "ruby", "crimson", "pink", "plum", "purple", "violet", "iris", "indigo", "blue", "cyan", "teal", "jade", "green", "grass", "brown", "orange", "sky", "mint", "lime", "yellow", "amber", "gold", "bronze", ] LiteralBadgeVariant = Literal["solid", "soft"] LiteralBadgeSize = Literal["xs", "sm", "md"]
# Light colors that need dark text on solid backgrounds for better contrast LIGHT_COLORS = {"sky", "mint", "lime", "yellow", "amber", "secondary"} BADGE_VARIANTS = { "size": { "xs": "px-1.5 py-0.5 h-4 rounded-ui-xss text-[11px] [&_svg]:size-3", "sm": "px-1.5 py-0.5 h-5 rounded-ui-xs text-xs [&_svg]:size-3.5", "md": "px-2 py-0.5 h-6 rounded-ui-sm text-sm [&_svg]:size-4", } } def get_color_classes(color: str, variant: LiteralBadgeVariant) -> str: """Get the color-specific classes based on color and variant.""" if variant == "solid": text_color = "text-black/90" if color in LIGHT_COLORS else "text-white" return f"border-transparent bg-{color}-9 {text_color}" # Soft variant return f"border-transparent bg-{color}-3 text-{color}-11" def get_badge_classes( color: str, variant: LiteralBadgeVariant, size: LiteralBadgeSize ) -> str: """Get the complete badge class string.""" color_classes = get_color_classes(color
DEFAULT_BASE_CLASSES = "inline-flex items-center font-medium [&_svg]:pointer-events-none [&_svg]:shrink-0 gap-1.5"
"""Badge component.""" from typing import Literal from reflex.components.el import Span from reflex.vars.base import Var from reflex_ui.components.component import CoreComponent BaseColorType = Literal[ "primary", "secondary", "info", "success", "warning", "destructive", "gray", "mauve", "slate", "sage", "olive", "sand", "tomato", "red", "ruby", "crimson", "pink", "plum", "purple", "violet", "iris", "indigo", "blue", "cyan", "teal", "jade", "green", "grass", "brown", "orange", "sky", "mint", "lime", "yellow", "amber", "gold", "bronze", ] LiteralBadgeVariant = Literal["solid", "soft"] LiteralBadgeSize = Literal["xs", "sm", "md"] DEFAULT_BASE_CLASSES = "inline-flex items-center font-medium [&_svg]:pointer-events-none [&_svg]:shrink-0 gap-1.5" # Light colors that need dark text on solid backgrounds for better contrast
BADGE_VARIANTS = { "size": { "xs": "px-1.5 py-0.5 h-4 rounded-ui-xss text-[11px] [&_svg]:size-3", "sm": "px-1.5 py-0.5 h-5 rounded-ui-xs text-xs [&_svg]:size-3.5", "md": "px-2 py-0.5 h-6 rounded-ui-sm text-sm [&_svg]:size-4", } } def get_color_classes(color: str, variant: LiteralBadgeVariant) -> str: """Get the color-specific classes based on color and variant.""" if variant == "solid": text_color = "text-black/90" if color in LIGHT_COLORS else "text-white" return f"border-transparent bg-{color}-9 {text_color}" # Soft variant return f"border-transparent bg-{color}-3 text-{color}-11" def get_badge_classes( color: str, variant: LiteralBadgeVariant, size: LiteralBadgeSize ) -> str: """Get the complete badge class string.""" color_classes = get_color_classes(color, variant) size_classes = BADGE_VARIANTS["size"][size] return f"{DEFAULT_BASE_CLASSES} {size_classes} {color_classes}" class Badge(Span,
LIGHT_COLORS = {"sky", "mint", "lime", "yellow", "amber", "secondary"}
rom reflex.components.el import Span from reflex.vars.base import Var from reflex_ui.components.component import CoreComponent BaseColorType = Literal[ "primary", "secondary", "info", "success", "warning", "destructive", "gray", "mauve", "slate", "sage", "olive", "sand", "tomato", "red", "ruby", "crimson", "pink", "plum", "purple", "violet", "iris", "indigo", "blue", "cyan", "teal", "jade", "green", "grass", "brown", "orange", "sky", "mint", "lime", "yellow", "amber", "gold", "bronze", ] LiteralBadgeVariant = Literal["solid", "soft"] LiteralBadgeSize = Literal["xs", "sm", "md"] DEFAULT_BASE_CLASSES = "inline-flex items-center font-medium [&_svg]:pointer-events-none [&_svg]:shrink-0 gap-1.5" # Light colors that need dark text on solid backgrounds for better contrast LIGHT_COLORS = {"sky", "mint", "lime", "yellow", "amber", "secondary"}
def get_color_classes(color: str, variant: LiteralBadgeVariant) -> str: """Get the color-specific classes based on color and variant.""" if variant == "solid": text_color = "text-black/90" if color in LIGHT_COLORS else "text-white" return f"border-transparent bg-{color}-9 {text_color}" # Soft variant return f"border-transparent bg-{color}-3 text-{color}-11" def get_badge_classes( color: str, variant: LiteralBadgeVariant, size: LiteralBadgeSize ) -> str: """Get the complete badge class string.""" color_classes = get_color_classes(color, variant) size_classes = BADGE_VARIANTS["size"][size] return f"{DEFAULT_BASE_CLASSES} {size_classes} {color_classes}" class Badge(Span, CoreComponent): """A badge component that displays a label.""" # Badge color color: BaseColorType | Var[str] # Badge variant variant: Var[LiteralBadgeVariant] # Badge size size: Var[LiteralBadgeSize] @classmethod def create
BADGE_VARIANTS = { "size": { "xs": "px-1.5 py-0.5 h-4 rounded-ui-xss text-[11px] [&_svg]:size-3", "sm": "px-1.5 py-0.5 h-5 rounded-ui-xs text-xs [&_svg]:size-3.5", "md": "px-2 py-0.5 h-6 rounded-ui-sm text-sm [&_svg]:size-4", } }
", "violet", "iris", "indigo", "blue", "cyan", "teal", "jade", "green", "grass", "brown", "orange", "sky", "mint", "lime", "yellow", "amber", "gold", "bronze", ] LiteralBadgeVariant = Literal["solid", "soft"] LiteralBadgeSize = Literal["xs", "sm", "md"] DEFAULT_BASE_CLASSES = "inline-flex items-center font-medium [&_svg]:pointer-events-none [&_svg]:shrink-0 gap-1.5" # Light colors that need dark text on solid backgrounds for better contrast LIGHT_COLORS = {"sky", "mint", "lime", "yellow", "amber", "secondary"} BADGE_VARIANTS = { "size": { "xs": "px-1.5 py-0.5 h-4 rounded-ui-xss text-[11px] [&_svg]:size-3", "sm": "px-1.5 py-0.5 h-5 rounded-ui-xs text-xs [&_svg]:size-3.5", "md": "px-2 py-0.5 h-6 rounded-ui-sm text-sm [&_svg]:size-4", } } def get_color_classes(color: str, variant: LiteralBadgeVariant) -> str: """Get the color-specific classes based on color and variant."""
# Soft variant return f"border-transparent bg-{color}-3 text-{color}-11" def get_badge_classes( color: str, variant: LiteralBadgeVariant, size: LiteralBadgeSize ) -> str: """Get the complete badge class string.""" color_classes = get_color_classes(color, variant) size_classes = BADGE_VARIANTS["size"][size] return f"{DEFAULT_BASE_CLASSES} {size_classes} {color_classes}" class Badge(Span, CoreComponent): """A badge component that displays a label.""" # Badge color color: BaseColorType | Var[str] # Badge variant variant: Var[LiteralBadgeVariant] # Badge size size: Var[LiteralBadgeSize] @classmethod def create(cls, *children, **props) -> Span: """Create the badge component.""" variant = props.pop("variant", "solid") color = props.pop("color", "primary") size = props.pop("size", "sm") cls.set_class_name(get_badge_classes(color, variant, size), props) return super().cre
if variant == "solid": text_color = "text-black/90" if color in LIGHT_COLORS else "text-white" return f"border-transparent bg-{color}-9 {text_color}"
"indigo", "blue", "cyan", "teal", "jade", "green", "grass", "brown", "orange", "sky", "mint", "lime", "yellow", "amber", "gold", "bronze", ] LiteralBadgeVariant = Literal["solid", "soft"] LiteralBadgeSize = Literal["xs", "sm", "md"] DEFAULT_BASE_CLASSES = "inline-flex items-center font-medium [&_svg]:pointer-events-none [&_svg]:shrink-0 gap-1.5" # Light colors that need dark text on solid backgrounds for better contrast LIGHT_COLORS = {"sky", "mint", "lime", "yellow", "amber", "secondary"} BADGE_VARIANTS = { "size": { "xs": "px-1.5 py-0.5 h-4 rounded-ui-xss text-[11px] [&_svg]:size-3", "sm": "px-1.5 py-0.5 h-5 rounded-ui-xs text-xs [&_svg]:size-3.5", "md": "px-2 py-0.5 h-6 rounded-ui-sm text-sm [&_svg]:size-4", } } def get_color_classes(color: str, variant: LiteralBadgeVariant) -> str: """Get the color-specific classes based on color and variant.""" if variant == "solid":
return f"border-transparent bg-{color}-9 {text_color}" # Soft variant return f"border-transparent bg-{color}-3 text-{color}-11" def get_badge_classes( color: str, variant: LiteralBadgeVariant, size: LiteralBadgeSize ) -> str: """Get the complete badge class string.""" color_classes = get_color_classes(color, variant) size_classes = BADGE_VARIANTS["size"][size] return f"{DEFAULT_BASE_CLASSES} {size_classes} {color_classes}" class Badge(Span, CoreComponent): """A badge component that displays a label.""" # Badge color color: BaseColorType | Var[str] # Badge variant variant: Var[LiteralBadgeVariant] # Badge size size: Var[LiteralBadgeSize] @classmethod def create(cls, *children, **props) -> Span: """Create the badge component.""" variant = props.pop("variant", "solid") color = props.pop("color", "primary") size = props.pop("size", "sm") cls.set_class_name(get_badge_cl
text_color = "text-black/90" if color in LIGHT_COLORS else "text-white"
r-events-none [&_svg]:shrink-0 gap-1.5" # Light colors that need dark text on solid backgrounds for better contrast LIGHT_COLORS = {"sky", "mint", "lime", "yellow", "amber", "secondary"} BADGE_VARIANTS = { "size": { "xs": "px-1.5 py-0.5 h-4 rounded-ui-xss text-[11px] [&_svg]:size-3", "sm": "px-1.5 py-0.5 h-5 rounded-ui-xs text-xs [&_svg]:size-3.5", "md": "px-2 py-0.5 h-6 rounded-ui-sm text-sm [&_svg]:size-4", } } def get_color_classes(color: str, variant: LiteralBadgeVariant) -> str: """Get the color-specific classes based on color and variant.""" if variant == "solid": text_color = "text-black/90" if color in LIGHT_COLORS else "text-white" return f"border-transparent bg-{color}-9 {text_color}" # Soft variant return f"border-transparent bg-{color}-3 text-{color}-11" def get_badge_classes( color: str, variant: LiteralBadgeVariant, size: LiteralBadgeSize ) -> str: """Get the complete badge class string."""
size_classes = BADGE_VARIANTS["size"][size] return f"{DEFAULT_BASE_CLASSES} {size_classes} {color_classes}" class Badge(Span, CoreComponent): """A badge component that displays a label.""" # Badge color color: BaseColorType | Var[str] # Badge variant variant: Var[LiteralBadgeVariant] # Badge size size: Var[LiteralBadgeSize] @classmethod def create(cls, *children, **props) -> Span: """Create the badge component.""" variant = props.pop("variant", "solid") color = props.pop("color", "primary") size = props.pop("size", "sm") cls.set_class_name(get_badge_classes(color, variant, size), props) return super().create(*children, **props) def _exclude_props(self) -> list[str]: return [*super()._exclude_props(), "color", "variant", "size"] badge = Badge.create
color_classes = get_color_classes(color, variant)
s that need dark text on solid backgrounds for better contrast LIGHT_COLORS = {"sky", "mint", "lime", "yellow", "amber", "secondary"} BADGE_VARIANTS = { "size": { "xs": "px-1.5 py-0.5 h-4 rounded-ui-xss text-[11px] [&_svg]:size-3", "sm": "px-1.5 py-0.5 h-5 rounded-ui-xs text-xs [&_svg]:size-3.5", "md": "px-2 py-0.5 h-6 rounded-ui-sm text-sm [&_svg]:size-4", } } def get_color_classes(color: str, variant: LiteralBadgeVariant) -> str: """Get the color-specific classes based on color and variant.""" if variant == "solid": text_color = "text-black/90" if color in LIGHT_COLORS else "text-white" return f"border-transparent bg-{color}-9 {text_color}" # Soft variant return f"border-transparent bg-{color}-3 text-{color}-11" def get_badge_classes( color: str, variant: LiteralBadgeVariant, size: LiteralBadgeSize ) -> str: """Get the complete badge class string.""" color_classes = get_color_classes(color, variant)
return f"{DEFAULT_BASE_CLASSES} {size_classes} {color_classes}" class Badge(Span, CoreComponent): """A badge component that displays a label.""" # Badge color color: BaseColorType | Var[str] # Badge variant variant: Var[LiteralBadgeVariant] # Badge size size: Var[LiteralBadgeSize] @classmethod def create(cls, *children, **props) -> Span: """Create the badge component.""" variant = props.pop("variant", "solid") color = props.pop("color", "primary") size = props.pop("size", "sm") cls.set_class_name(get_badge_classes(color, variant, size), props) return super().create(*children, **props) def _exclude_props(self) -> list[str]: return [*super()._exclude_props(), "color", "variant", "size"] badge = Badge.create
size_classes = BADGE_VARIANTS["size"][size]
the color-specific classes based on color and variant.""" if variant == "solid": text_color = "text-black/90" if color in LIGHT_COLORS else "text-white" return f"border-transparent bg-{color}-9 {text_color}" # Soft variant return f"border-transparent bg-{color}-3 text-{color}-11" def get_badge_classes( color: str, variant: LiteralBadgeVariant, size: LiteralBadgeSize ) -> str: """Get the complete badge class string.""" color_classes = get_color_classes(color, variant) size_classes = BADGE_VARIANTS["size"][size] return f"{DEFAULT_BASE_CLASSES} {size_classes} {color_classes}" class Badge(Span, CoreComponent): """A badge component that displays a label.""" # Badge color color: BaseColorType | Var[str] # Badge variant variant: Var[LiteralBadgeVariant] # Badge size size: Var[LiteralBadgeSize] @classmethod def create(cls, *children, **props) -> Span: """Create the badge component."""
color = props.pop("color", "primary") size = props.pop("size", "sm") cls.set_class_name(get_badge_classes(color, variant, size), props) return super().create(*children, **props) def _exclude_props(self) -> list[str]: return [*super()._exclude_props(), "color", "variant", "size"] badge = Badge.create
variant = props.pop("variant", "solid")
ariant.""" if variant == "solid": text_color = "text-black/90" if color in LIGHT_COLORS else "text-white" return f"border-transparent bg-{color}-9 {text_color}" # Soft variant return f"border-transparent bg-{color}-3 text-{color}-11" def get_badge_classes( color: str, variant: LiteralBadgeVariant, size: LiteralBadgeSize ) -> str: """Get the complete badge class string.""" color_classes = get_color_classes(color, variant) size_classes = BADGE_VARIANTS["size"][size] return f"{DEFAULT_BASE_CLASSES} {size_classes} {color_classes}" class Badge(Span, CoreComponent): """A badge component that displays a label.""" # Badge color color: BaseColorType | Var[str] # Badge variant variant: Var[LiteralBadgeVariant] # Badge size size: Var[LiteralBadgeSize] @classmethod def create(cls, *children, **props) -> Span: """Create the badge component.""" variant = props.pop("variant", "solid")
size = props.pop("size", "sm") cls.set_class_name(get_badge_classes(color, variant, size), props) return super().create(*children, **props) def _exclude_props(self) -> list[str]: return [*super()._exclude_props(), "color", "variant", "size"] badge = Badge.create
color = props.pop("color", "primary")
text_color = "text-black/90" if color in LIGHT_COLORS else "text-white" return f"border-transparent bg-{color}-9 {text_color}" # Soft variant return f"border-transparent bg-{color}-3 text-{color}-11" def get_badge_classes( color: str, variant: LiteralBadgeVariant, size: LiteralBadgeSize ) -> str: """Get the complete badge class string.""" color_classes = get_color_classes(color, variant) size_classes = BADGE_VARIANTS["size"][size] return f"{DEFAULT_BASE_CLASSES} {size_classes} {color_classes}" class Badge(Span, CoreComponent): """A badge component that displays a label.""" # Badge color color: BaseColorType | Var[str] # Badge variant variant: Var[LiteralBadgeVariant] # Badge size size: Var[LiteralBadgeSize] @classmethod def create(cls, *children, **props) -> Span: """Create the badge component.""" variant = props.pop("variant", "solid") color = props.pop("color", "primary")
cls.set_class_name(get_badge_classes(color, variant, size), props) return super().create(*children, **props) def _exclude_props(self) -> list[str]: return [*super()._exclude_props(), "color", "variant", "size"] badge = Badge.create
size = props.pop("size", "sm")
n f"border-transparent bg-{color}-3 text-{color}-11" def get_badge_classes( color: str, variant: LiteralBadgeVariant, size: LiteralBadgeSize ) -> str: """Get the complete badge class string.""" color_classes = get_color_classes(color, variant) size_classes = BADGE_VARIANTS["size"][size] return f"{DEFAULT_BASE_CLASSES} {size_classes} {color_classes}" class Badge(Span, CoreComponent): """A badge component that displays a label.""" # Badge color color: BaseColorType | Var[str] # Badge variant variant: Var[LiteralBadgeVariant] # Badge size size: Var[LiteralBadgeSize] @classmethod def create(cls, *children, **props) -> Span: """Create the badge component.""" variant = props.pop("variant", "solid") color = props.pop("color", "primary") size = props.pop("size", "sm") cls.set_class_name(get_badge_classes(color, variant, size), props) return super().create(*children, **props)
badge = Badge.create
def _exclude_props(self) -> list[str]: return [*super()._exclude_props(), "color", "variant", "size"]
dgeVariant, size: LiteralBadgeSize ) -> str: """Get the complete badge class string.""" color_classes = get_color_classes(color, variant) size_classes = BADGE_VARIANTS["size"][size] return f"{DEFAULT_BASE_CLASSES} {size_classes} {color_classes}" class Badge(Span, CoreComponent): """A badge component that displays a label.""" # Badge color color: BaseColorType | Var[str] # Badge variant variant: Var[LiteralBadgeVariant] # Badge size size: Var[LiteralBadgeSize] @classmethod def create(cls, *children, **props) -> Span: """Create the badge component.""" variant = props.pop("variant", "solid") color = props.pop("color", "primary") size = props.pop("size", "sm") cls.set_class_name(get_badge_classes(color, variant, size), props) return super().create(*children, **props) def _exclude_props(self) -> list[str]: return [*super()._exclude_props(), "color", "variant", "size"]
badge = Badge.create