EVOLUTION-MANAGER
Edit File: nav_select.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Dynamically update nav containers</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for nav_select {bslib}"><tr><td>nav_select {bslib}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Dynamically update nav containers</h2> <h3>Description</h3> <p>Functions for dynamically updating nav containers (e.g., select, insert, and remove nav items). These functions require an <code>id</code> on the nav container to be specified. </p> <h3>Usage</h3> <pre> nav_select(id, selected = NULL, session = getDefaultReactiveDomain()) nav_insert( id, nav, target = NULL, position = c("after", "before"), select = FALSE, session = getDefaultReactiveDomain() ) nav_remove(id, target, session = getDefaultReactiveDomain()) nav_show(id, target, select = FALSE, session = getDefaultReactiveDomain()) nav_hide(id, target, session = getDefaultReactiveDomain()) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>id</code></td> <td> <p>a character string used to identify the nav container.</p> </td></tr> <tr valign="top"><td><code>selected</code></td> <td> <p>a character string used to identify a particular <code><a href="nav.html">nav()</a></code> item.</p> </td></tr> <tr valign="top"><td><code>session</code></td> <td> <p>a shiny session object (the default should almost always be used).</p> </td></tr> <tr valign="top"><td><code>nav</code></td> <td> <p>a <code><a href="nav.html">nav()</a></code> item.</p> </td></tr> <tr valign="top"><td><code>target</code></td> <td> <p>The <code>value</code> of an existing <code>nav()</code> item, next to which tab will be added. If removing: the <code>value</code> of the <code>nav()</code> item that you want to remove.</p> </td></tr> <tr valign="top"><td><code>position</code></td> <td> <p>Should <code>nav</code> be added before or after the target?</p> </td></tr> <tr valign="top"><td><code>select</code></td> <td> <p>Should <code>nav</code> be selected upon being inserted?</p> </td></tr> </table> <h3>See Also</h3> <p><code><a href="nav.html">nav()</a></code>, <code><a href="navs.html">navs_tab()</a></code>. </p> <h3>Examples</h3> <pre> can_browse <- function() interactive() && require("shiny") # Selecting a tab if (can_browse()) { shinyApp( page_fluid( radioButtons("item", "Choose", c("A", "B")), navs_hidden( id = "container", nav_content("A", "a"), nav_content("B", "b") ) ), function(input, output) { observe(nav_select("container", input$item)) } ) } # Inserting and removing if (can_browse()) { ui <- page_fluid( actionButton("add", "Add 'Dynamic' tab"), actionButton("remove", "Remove 'Foo' tab"), navs_tab( id = "tabs", nav("Hello", "hello"), nav("Foo", "foo"), nav("Bar", "bar tab") ) ) server <- function(input, output) { observeEvent(input$add, { nav_insert( "tabs", target = "Bar", select = TRUE, nav("Dynamic", "Dynamically added content") ) }) observeEvent(input$remove, { nav_remove("tabs", target = "Foo") }) } shinyApp(ui, server) } </pre> <hr /><div style="text-align: center;">[Package <em>bslib</em> version 0.4.0 <a href="00Index.html">Index</a>]</div> </body></html>