details icon indicating copy to clipboard operation
details copied to clipboard

Usage in shiny apps

Open tanho63 opened this issue 4 years ago • 6 comments

Looks awesome! Wondering if there could be a wrapper on the details() function specifically for Shiny usage, e.g.

details_shiny <- function(object, summary, ...) {
          htmltools::HTML(
            details::details(
              object = object,
              summary = summary,
              lang = NULL,
              imgur = FALSE,
              output = "character",
              ...
            )
          )
}

where ... overrides the defaults provided above, perhaps?

tanho63 avatar Apr 12 '21 15:04 tanho63

thanks for the question!

this should work:

https://yonicd.github.io/details/articles/custom.html#raw

yonicd avatar Apr 12 '21 15:04 yonicd

I'm hoping to use details block in shiny, not necessarily raw html in a details block :P

e.g. avoiding this

image

and getting this instead image

(Problem is solved on my end, just suggesting/requesting a feature)

tanho63 avatar Apr 12 '21 16:04 tanho63

Thanks for the clarification. I’ll see how it can be added.

yonicd avatar Apr 12 '21 19:04 yonicd

Adding a print method should be straight fw enough (print.details_shiny) https://github.com/yonicd/details/blob/master/R/print.R

yonicd avatar Apr 13 '21 11:04 yonicd

@tanho63 try this: https://github.com/yonicd/details/commit/740300e228b2dfd0cc8328521f563f94ce15c9bf

the output type is "html"

yonicd avatar Apr 23 '21 00:04 yonicd

Works great!

tanho63 avatar Apr 23 '21 13:04 tanho63