`). Defaults to True.
+ native_button: Var[bool]
+
+ # The render prop.
+ render_: Var[Component]
+
+ @classmethod
+ def create(cls, *children, **props) -> BaseUIComponent:
+ """Create the collapsible trigger component."""
+ props["data-slot"] = "collapsible-trigger"
+ cls.set_class_name(ClassNames.TRIGGER, props)
+ return super().create(*children, **props)
+
+
+class CollapsiblePanel(CollapsibleBaseComponent):
+ """A panel with the collapsible contents. Renders a
element."""
+
+ tag = "Collapsible.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 hidden. This prop is ignored when `hidden_until_found` is used. Defaults to False.
+ keep_mounted: Var[bool]
+
+ # Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render.
+ render_: Var[Component]
+
+ @classmethod
+ def create(cls, *children, **props) -> BaseUIComponent:
+ """Create the collapsible panel component."""
+ props["data-slot"] = "collapsible-panel"
+ cls.set_class_name(ClassNames.PANEL, props)
+ return super().create(*children, **props)
+
+
+class HighLevelCollapsible(CollapsibleRoot):
+ """High level collapsible component."""
+
+ # The trigger component.
+ trigger: Var[Component | None]
+
+ # The content component.
+ content: Var[str | Component | None]
+
+ @classmethod
+ def create(cls, *children, **props) -> BaseUIComponent:
+ """Create the collapsible component."""
+ trigger = props.pop("trigger", None)
+ content = props.pop("content", None)
+
+ return CollapsibleRoot.create(
+ CollapsibleTrigger.create(render_=trigger) if trigger else None,
+ CollapsiblePanel.create(
+ content,
+ *children,
+ ),
+ **props,
+ )
+
+ def _exclude_props(self) -> list[str]:
+ return [
+ *super()._exclude_props(),
+ "trigger",
+ "content",
+ ]
+
+
+class Collapsible(ComponentNamespace):
+ """Namespace for Collapsible components."""
+
+ root = staticmethod(CollapsibleRoot.create)
+ trigger = staticmethod(CollapsibleTrigger.create)
+ panel = staticmethod(CollapsiblePanel.create)
+ __call__ = staticmethod(HighLevelCollapsible.create)
+
+
+collapsible = Collapsible()
diff --git a/reflex_ui/components/base/collapsible.pyi b/reflex_ui/components/base/collapsible.pyi
new file mode 100644
index 0000000..9674454
--- /dev/null
+++ b/reflex_ui/components/base/collapsible.pyi
@@ -0,0 +1,288 @@
+"""Stub file for reflex_ui/components/base/collapsible.py"""
+
+# ------------------- DO NOT EDIT ----------------------
+# This file was generated by `reflex/utils/pyi_generator.py`!
+# ------------------------------------------------------
+from collections.abc import Mapping, Sequence
+from typing import Any
+
+from reflex.components.component import Component, ComponentNamespace
+from reflex.components.core.breakpoints import Breakpoints
+from reflex.event import EventType, PointerEventInfo
+from reflex.vars.base import Var
+
+from reflex_ui.components.base_ui import BaseUIComponent
+
+class ClassNames:
+ ROOT = "flex flex-col justify-center text-secondary-12"
+ TRIGGER = "group flex items-center gap-2"
+ PANEL = "flex h-[var(--collapsible-panel-height)] flex-col justify-end overflow-hidden text-sm transition-all ease-out data-[ending-style]:h-0 data-[starting-style]:h-0"
+
+class CollapsibleBaseComponent(BaseUIComponent):
+ @property
+ def import_var(self): ...
+ @classmethod
+ def create(
+ cls,
+ *children,
+ unstyled: Var[bool] | bool | None = None,
+ style: Sequence[Mapping[str, Any]]
+ | Mapping[str, Any]
+ | Var[Mapping[str, Any]]
+ | Breakpoints
+ | None = None,
+ key: Any | None = None,
+ id: Any | None = None,
+ ref: Var | None = None,
+ class_name: Any | None = None,
+ autofocus: bool | None = None,
+ custom_attrs: dict[str, Var | Any] | None = None,
+ on_blur: EventType[()] | None = None,
+ on_click: EventType[()] | EventType[PointerEventInfo] | None = None,
+ on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None,
+ on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None,
+ on_focus: EventType[()] | None = None,
+ on_mount: EventType[()] | None = None,
+ on_mouse_down: EventType[()] | None = None,
+ on_mouse_enter: EventType[()] | None = None,
+ on_mouse_leave: EventType[()] | None = None,
+ on_mouse_move: EventType[()] | None = None,
+ on_mouse_out: EventType[()] | None = None,
+ on_mouse_over: EventType[()] | None = None,
+ on_mouse_up: EventType[()] | None = None,
+ on_scroll: EventType[()] | None = None,
+ on_scroll_end: EventType[()] | None = None,
+ on_unmount: EventType[()] | None = None,
+ **props,
+ ) -> CollapsibleBaseComponent:
+ """Create the component.
+
+ Args:
+ *children: The children of the component.
+ unstyled: Whether the component should be unstyled
+ style: The style of the component.
+ key: A unique key for the component.
+ id: The id for the component.
+ ref: The Var to pass as the ref to the component.
+ class_name: The class name for the component.
+ autofocus: Whether the component should take the focus once the page is loaded
+ custom_attrs: custom attribute
+ **props: The props of the component.
+
+ Returns:
+ The component.
+ """
+
+class CollapsibleRoot(CollapsibleBaseComponent):
+ @classmethod
+ def create(
+ cls,
+ *children,
+ default_open: Var[bool] | bool | None = None,
+ open: Var[bool] | bool | None = None,
+ disabled: Var[bool] | bool | None = None,
+ render_: Component | Var[Component] | None = None,
+ unstyled: Var[bool] | bool | None = None,
+ style: Sequence[Mapping[str, Any]]
+ | Mapping[str, Any]
+ | Var[Mapping[str, Any]]
+ | Breakpoints
+ | None = None,
+ key: Any | None = None,
+ id: Any | None = None,
+ ref: Var | None = None,
+ class_name: Any | None = None,
+ autofocus: bool | None = None,
+ custom_attrs: dict[str, Var | Any] | None = None,
+ on_blur: EventType[()] | None = None,
+ on_click: EventType[()] | EventType[PointerEventInfo] | None = None,
+ on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None,
+ on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None,
+ on_focus: EventType[()] | None = None,
+ on_mount: EventType[()] | None = None,
+ on_mouse_down: EventType[()] | None = None,
+ on_mouse_enter: EventType[()] | None = None,
+ on_mouse_leave: EventType[()] | None = None,
+ on_mouse_move: EventType[()] | None = None,
+ on_mouse_out: EventType[()] | None = None,
+ on_mouse_over: EventType[()] | None = None,
+ on_mouse_up: EventType[()] | None = None,
+ on_open_change: EventType[()] | EventType[bool] | None = None,
+ on_scroll: EventType[()] | None = None,
+ on_scroll_end: EventType[()] | None = None,
+ on_unmount: EventType[()] | None = None,
+ **props,
+ ) -> CollapsibleRoot:
+ """Create the collapsible root component."""
+
+class CollapsibleTrigger(CollapsibleBaseComponent):
+ @classmethod
+ def create(
+ cls,
+ *children,
+ native_button: Var[bool] | bool | None = None,
+ render_: Component | Var[Component] | None = None,
+ unstyled: Var[bool] | bool | None = None,
+ style: Sequence[Mapping[str, Any]]
+ | Mapping[str, Any]
+ | Var[Mapping[str, Any]]
+ | Breakpoints
+ | None = None,
+ key: Any | None = None,
+ id: Any | None = None,
+ ref: Var | None = None,
+ class_name: Any | None = None,
+ autofocus: bool | None = None,
+ custom_attrs: dict[str, Var | Any] | None = None,
+ on_blur: EventType[()] | None = None,
+ on_click: EventType[()] | EventType[PointerEventInfo] | None = None,
+ on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None,
+ on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None,
+ on_focus: EventType[()] | None = None,
+ on_mount: EventType[()] | None = None,
+ on_mouse_down: EventType[()] | None = None,
+ on_mouse_enter: EventType[()] | None = None,
+ on_mouse_leave: EventType[()] | None = None,
+ on_mouse_move: EventType[()] | None = None,
+ on_mouse_out: EventType[()] | None = None,
+ on_mouse_over: EventType[()] | None = None,
+ on_mouse_up: EventType[()] | None = None,
+ on_scroll: EventType[()] | None = None,
+ on_scroll_end: EventType[()] | None = None,
+ on_unmount: EventType[()] | None = None,
+ **props,
+ ) -> CollapsibleTrigger:
+ """Create the collapsible trigger component."""
+
+class CollapsiblePanel(CollapsibleBaseComponent):
+ @classmethod
+ def create(
+ cls,
+ *children,
+ hidden_until_found: Var[bool] | bool | None = None,
+ keep_mounted: Var[bool] | bool | None = None,
+ render_: Component | Var[Component] | None = None,
+ unstyled: Var[bool] | bool | None = None,
+ style: Sequence[Mapping[str, Any]]
+ | Mapping[str, Any]
+ | Var[Mapping[str, Any]]
+ | Breakpoints
+ | None = None,
+ key: Any | None = None,
+ id: Any | None = None,
+ ref: Var | None = None,
+ class_name: Any | None = None,
+ autofocus: bool | None = None,
+ custom_attrs: dict[str, Var | Any] | None = None,
+ on_blur: EventType[()] | None = None,
+ on_click: EventType[()] | EventType[PointerEventInfo] | None = None,
+ on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None,
+ on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None,
+ on_focus: EventType[()] | None = None,
+ on_mount: EventType[()] | None = None,
+ on_mouse_down: EventType[()] | None = None,
+ on_mouse_enter: EventType[()] | None = None,
+ on_mouse_leave: EventType[()] | None = None,
+ on_mouse_move: EventType[()] | None = None,
+ on_mouse_out: EventType[()] | None = None,
+ on_mouse_over: EventType[()] | None = None,
+ on_mouse_up: EventType[()] | None = None,
+ on_scroll: EventType[()] | None = None,
+ on_scroll_end: EventType[()] | None = None,
+ on_unmount: EventType[()] | None = None,
+ **props,
+ ) -> CollapsiblePanel:
+ """Create the collapsible panel component."""
+
+class HighLevelCollapsible(CollapsibleRoot):
+ @classmethod
+ def create(
+ cls,
+ *children,
+ trigger: Component | Var[Component | None] | None = None,
+ content: Component | Var[Component | str | None] | str | None = None,
+ default_open: Var[bool] | bool | None = None,
+ open: Var[bool] | bool | None = None,
+ disabled: Var[bool] | bool | None = None,
+ render_: Component | Var[Component] | None = None,
+ unstyled: Var[bool] | bool | None = None,
+ style: Sequence[Mapping[str, Any]]
+ | Mapping[str, Any]
+ | Var[Mapping[str, Any]]
+ | Breakpoints
+ | None = None,
+ key: Any | None = None,
+ id: Any | None = None,
+ ref: Var | None = None,
+ class_name: Any | None = None,
+ autofocus: bool | None = None,
+ custom_attrs: dict[str, Var | Any] | None = None,
+ on_blur: EventType[()] | None = None,
+ on_click: EventType[()] | EventType[PointerEventInfo] | None = None,
+ on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None,
+ on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None,
+ on_focus: EventType[()] | None = None,
+ on_mount: EventType[()] | None = None,
+ on_mouse_down: EventType[()] | None = None,
+ on_mouse_enter: EventType[()] | None = None,
+ on_mouse_leave: EventType[()] | None = None,
+ on_mouse_move: EventType[()] | None = None,
+ on_mouse_out: EventType[()] | None = None,
+ on_mouse_over: EventType[()] | None = None,
+ on_mouse_up: EventType[()] | None = None,
+ on_open_change: EventType[()] | EventType[bool] | None = None,
+ on_scroll: EventType[()] | None = None,
+ on_scroll_end: EventType[()] | None = None,
+ on_unmount: EventType[()] | None = None,
+ **props,
+ ) -> HighLevelCollapsible:
+ """Create the collapsible component."""
+
+class Collapsible(ComponentNamespace):
+ root = staticmethod(CollapsibleRoot.create)
+ trigger = staticmethod(CollapsibleTrigger.create)
+ panel = staticmethod(CollapsiblePanel.create)
+
+ @staticmethod
+ def __call__(
+ *children,
+ trigger: Component | Var[Component | None] | None = None,
+ content: Component | Var[Component | str | None] | str | None = None,
+ default_open: Var[bool] | bool | None = None,
+ open: Var[bool] | bool | None = None,
+ disabled: Var[bool] | bool | None = None,
+ render_: Component | Var[Component] | None = None,
+ unstyled: Var[bool] | bool | None = None,
+ style: Sequence[Mapping[str, Any]]
+ | Mapping[str, Any]
+ | Var[Mapping[str, Any]]
+ | Breakpoints
+ | None = None,
+ key: Any | None = None,
+ id: Any | None = None,
+ ref: Var | None = None,
+ class_name: Any | None = None,
+ autofocus: bool | None = None,
+ custom_attrs: dict[str, Var | Any] | None = None,
+ on_blur: EventType[()] | None = None,
+ on_click: EventType[()] | EventType[PointerEventInfo] | None = None,
+ on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None,
+ on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None,
+ on_focus: EventType[()] | None = None,
+ on_mount: EventType[()] | None = None,
+ on_mouse_down: EventType[()] | None = None,
+ on_mouse_enter: EventType[()] | None = None,
+ on_mouse_leave: EventType[()] | None = None,
+ on_mouse_move: EventType[()] | None = None,
+ on_mouse_out: EventType[()] | None = None,
+ on_mouse_over: EventType[()] | None = None,
+ on_mouse_up: EventType[()] | None = None,
+ on_open_change: EventType[()] | EventType[bool] | None = None,
+ on_scroll: EventType[()] | None = None,
+ on_scroll_end: EventType[()] | None = None,
+ on_unmount: EventType[()] | None = None,
+ **props,
+ ) -> HighLevelCollapsible:
+ """Create the collapsible component."""
+
+collapsible = Collapsible()