Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to pass information into the ellipsis argument of the widget's custom HTML function? #482

Open
daattali opened this issue Dec 2, 2023 · 0 comments

Comments

@daattali
Copy link

daattali commented Dec 2, 2023

The documentation shows that it's possible to create a custom HTML container for a widget:

WIDGETNAME_html <- function(id, style, class, ...){
  tags$span(id = id, class = class)
}

How can I, as the widget developer, pass information into the ellipsis argument?

More specifically, suppose I have the following widget definition:

MYWIDGET <- function(data, big = TRUE) {
  javascript_data = list()
  htmlwidgets::createWidget(name = 'MYWIDGET', x = javascript_data, width = 400, height = 400, big = big)
}

I would want the big argument to be passed to the custom HTML constructor so that I can add an HTML class to the tag. I know I can pass the information into the x parameter, and then deal with it from javascript, but I want to know how to access a variable in the widget's html construction before it gets into the javascript layer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant