R/browser.R

Defines functions print.muiTreeView

Documented in print.muiTreeView

#' Print muiTreeView components
#'
#' When called interactively, renders the component in the IDE viewer panel.
#' Otherwise, falls back to standard shiny.tag printing (raw HTML text).
#'
#' @param x A muiTreeView object (also inherits shiny.tag).
#' @param browse Whether to render in viewer. Defaults to TRUE in interactive sessions.
#' @param ... Additional arguments passed to print.
#' @return Invisibly returns x.
#'
#' @examples
#' tree <- RichTreeView(
#'   items = list(list(id = "1", label = "Item"))
#' )
#' # browse = FALSE prints the underlying HTML instead of opening the viewer.
#' print(tree, browse = FALSE)
#'
#' @export
print.muiTreeView <- function(x, browse = interactive(), ...) {
  if (browse) {
    htmltools::html_print(htmltools::browsable(x))
  } else {
    NextMethod("print")
  }
  invisible(x)
}

Try the muiTreeView package in your browser

Any scripts or data that you put into this service are public.

muiTreeView documentation built on Oct. 12, 2026, 5:08 p.m.