config
config function
Get or set shinywidgets’ app-wide settings.
Usage Source
config(**kwargs: Any)Called with no arguments, returns a dict of the current settings. Called with keyword arguments, sets those settings and returns the updated dict. Unknown setting names raise TypeError.
Currently available settings:
native_events(bool, defaultFalse, env varSHINYWIDGETS_NATIVE_EVENTS): some widgets sync their own event streams to Python by default (e.g. plotly.py’s per-point click/hover/ selection reports), which renderers mute unless the app uses them. Setnative_events=Trueto receive every widget’s native events app-wide.cdn(str, default"https://cdn.jsdelivr.net/npm/", env varSHINYWIDGETS_CDN): the base URL of the CDN that widget JavaScript falls back to when no local copy of a widget’s extension is found.output_widget()bakes the value into the UI’s data attributes, soconfig(cdn=...)must run before the UI is built (e.g., the top of app.py); the env var remains the deployment-time alternative.cdn_only(bool, defaultFalse, env varSHINYWIDGETS_CDN_ONLY): always load widget JavaScript from the CDN, never from a local copy. Likecdn,output_widget()bakes it into the UI’s data attributes, so it must be set before the UI is built.extension_warning(bool, defaultFalse, env varSHINYWIDGETS_EXTENSION_WARNING): warn when no local path to a widget’s extension is found (the widget still renders via the CDN fallback). Read per render, so it only needs to be set before the first render.