Dynamically update/modify accordion()
s in a Shiny app. To be updated
programmatically, the accordion()
must have an id
. These functions
require an active Shiny session and only work with a running Shiny app.
accordion_panel_set(id, values, session = get_current_session())accordion_panel_open(id, values, session = get_current_session())
accordion_panel_close(id, values, session = get_current_session())
accordion_panel_insert(
id,
panel,
target = NULL,
position = c("after", "before"),
session = get_current_session()
)
accordion_panel_remove(id, target, session = get_current_session())
accordion_panel_update(
id,
target,
...,
title = NULL,
value = NULL,
icon = NULL,
session = get_current_session()
)
an character string that matches an existing accordion()
's id
.
either a character string (used to identify particular
accordion_panel()
s by their value
) or TRUE
(i.e., all values
).
a shiny session object (the default should almost always be used).
an accordion_panel()
.
The value
of an existing panel to insert next to. If
removing: the value
of the accordion_panel()
to remove.
Should panel
be added before or after the target? When
target
is NULL
(the default), "after"
will append after the last
panel and "before"
will prepend before the first panel.
Named arguments become attributes on the <div class="accordion">
element. Unnamed arguments should be accordion_panel()
s.
A title to appear in the accordion_panel()
's header.
A character string that uniquely identifies this panel.
A htmltools::tag child (e.g., bsicons::bs_icon()
) which is positioned just before the title
.
accordion_panel_set()
: same as accordion_panel_open()
, except it
also closes any currently open panels.
accordion_panel_open()
: open accordion_panel()
s.
accordion_panel_close()
: close accordion_panel()
s.
accordion_panel_insert()
: insert a new accordion_panel()
accordion_panel_remove()
: remove accordion_panel()
s.
accordion_panel_update()
: update a accordion_panel()
.
accordion()
and accordion_panel()
create the accordion
component.