diff --git a/nicegui/elements/stepper.py b/nicegui/elements/stepper.py index 4e6028a99..d5c736a4b 100644 --- a/nicegui/elements/stepper.py +++ b/nicegui/elements/stepper.py @@ -13,16 +13,23 @@ class Stepper(ValueElement): def __init__(self, *, value: Union[str, Step, None] = None, on_value_change: Optional[Callable[..., Any]] = None, + keep_alive: bool = True, ) -> None: """Stepper This element represents `Quasar's QStepper `_ component. It contains individual steps. + To avoid issues with dynamic elements when switching steps, + this element uses Vue's `keep-alive `_ component. + If client-side performance is an issue, you can disable this feature. + :param value: `ui.step` or name of the step to be initially selected (default: `None` meaning the first step) :param on_value_change: callback to be executed when the selected step changes + :param keep_alive: whether to use Vue's keep-alive component on the content (default: `True`) """ super().__init__(tag='q-stepper', value=value, on_value_change=on_value_change) + self._props['keep-alive'] = keep_alive def _value_to_model_value(self, value: Any) -> Any: return value._props['name'] if isinstance(value, Step) else value # pylint: disable=protected-access