R6Class
expanding the functionalities of
tabBox
. A TabBox object contains methods for
creating the tabBox, inserting and removing tabPanel
elements and the ability to expand the usual tabBox with an additional action
button which closes a tab.
1 2 3 4 5 6 7 8 9 |
new(id, title = "Viewer", width = 6, height = NULL,
side = c("left", "right"))
Initialize the TabBox object.
id | You can use input$id in your server logic to
determine which of the current tabs is active. The value will correspond
to the value argument that is passed to tabPanel .
Don't forget to namespace id , if inside a module. |
title | Title for the tabBox. |
width | The width of the box, using the Bootstrap grid system.
This is used for row-based layouts. The overall width of a region is 12,
so the default valueBox width of 4 occupies 1/3 of that width. For
column-based layouts, use NULL for the width; the
width is set by the column that contains the box. |
height | The height of a box, in pixels or other CSS unit. By default the height scales automatically with the content. |
side | Which side of the box the tabs should be on ("left" or
"right"). When side="right" , the order of tabs will be reversed.
|
append_tab(tab, select = FALSE, closeable = TRUE)
Append a
tabPanel
to the tabBox.
tab | A tabPanel . |
select | If TRUE , select tab
upon being inserted. |
closeable | If TRUE , tab
is closeable via an actionButton .
|
insert_tab(tab, target, position = c("before", "after"),
select = FALSE, closeable = TRUE)
Insert a
tabPanel
to the tabBox next to target
.
tab | A tabPanel . |
target | The value of an existing tabPanel ,
next to which tab will be added. |
position | Should tab be added before or after the
target tab? |
select | If TRUE , select tab
upon being inserted. |
closeable | If TRUE , tab
is closeable via an actionButton .
|
is_open(value)
Returns TRUE
, if
a tab with value = value
is open.
is_value(value)
Returns TRUE
, if
a tab with value = value
ever existed (currently open or not).
prepend_tab(tab, select = FALSE, closeable = TRUE)
Prepend a
tabPanel
to the tabBox.
tab | A tabPanel . |
select | If TRUE , select tab
upon being inserted. |
closeable | If TRUE , tab
is closeable via an actionButton .
|
remove_tab(target)
Remove the tab with value=target
.
set_session(session)
Call this function in the server function to connect the TabBox with a session.
session | A shiny session object.
|
tabBox()
Return the HTML representing the
tabBox
.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.