express.ui.update_navs(id, selected=None, session=None)

Change the value of a navs container on the client.


id: str

An input id.

selected: Optional[str] = None

The values that should be initially selected, if any.

session: Optional[Session] = None

A Session instance. If not provided, it is inferred via get_current_session.


The input updater functions send a message to the client, telling it to change the settings of an input object. The messages are collected and sent after all the observers (including outputs) have finished running.

The syntax of these functions is similar to the functions that created the inputs in the first place. For example, input_numeric and update_numeric take a similar set of arguments.

Any arguments with None values will be ignored; they will not result in any changes to the input object on the client.

For update_radio_buttons, update_checkbox_group, and update_select, the set of choices can be cleared by using choices=[]. Similarly, for these inputs, the selected item can be cleared by using selected=[].

See Also


#| standalone: true
#| components: [editor, viewer]
#| layout: vertical
#| viewerHeight: 400

## file:
from shiny import reactive
from import input, ui

with ui.sidebar():
    ui.input_slider("controller", "Controller", min=1, max=3, value=1)

with ui.navset_card_tab(id="inTabset"):
    with ui.nav_panel("Panel 1", value="panel1"):
        "Panel 1 content"
    with ui.nav_panel("Panel 2", value="panel2"):
        "Panel 2 content"
    with ui.nav_panel("Panel 3", value="panel3"):
        "Panel 3 content"

def _():
    ui.update_navs("inTabset", selected="panel" + str(input.controller()))