Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is_selected not work in rx.tab #1683

Closed
ltm920716 opened this issue Aug 26, 2023 · 3 comments
Closed

is_selected not work in rx.tab #1683

ltm920716 opened this issue Aug 26, 2023 · 3 comments

Comments

@ltm920716
Copy link

Describe the bug
Hi, I want to get a automatic switching effect in rx.tab, but param ‘is_selected’ seems not work,perhaps my code was written incorrectly

To Reproduce
Steps to reproduce the behavior:

rx.tabs(
            rx.tab_list(
                rx.tab(
                    "Pipelines",
                    is_selected=False,   # State.selected_p
                    custom_attrs={'isSelected': False}
                ),
                rx.tab(
                    "New",
                    is_selected=True,   # State.selected_n
                    custom_attrs={'isSelected': True}
                )
            ),
            rx.tab_panels(
                rx.tab_panel(
                    node_list()
                ),
                rx.tab_panel(
                    rx.cond(
                        State.init_node_page,
                        new_node_page(),
                        init_prompt_page()
                    )
                )
            ),
            align="center",
            is_fitted=True
        ),

image

Expected behavior
In my test code,I think it should show the ‘New’ Panel, that is right?

Additional context
actually,I want to do some operation in the ‘New’ panel, and then I expect it could automatic switch to the ‘Pipeline’ panel when I click ‘done’ button,I want to control this behavior by is_selected, but it not work

@simechnet
Copy link

same requirement, do you get a solution?

@ltm920716
Copy link
Author

@pmxiao not yet

there is a 'default_index' param in rx.tabs could show fix index page onloading first,
about ’ is_selected‘ param in rx.tab,I think that could be done by custom another component to implement this

by the way,I noticed that reflex can not deal with long-time async call,it means UI will be blocked before current action done,so wait until new update

#1676
#1340

@masenf
Copy link
Collaborator

masenf commented Jun 7, 2024

The new radix tabs component (introduced in 0.3.0) supports setting the active tab with the controlled value prop: https://reflex.dev/docs/library/disclosure/tabs/

Each tab has an id and when that id is set for value, the given tab content will be selected and displayed, this can be controlled via state.

@masenf masenf closed this as completed Jun 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants