plotly / plotly/dash

allow HTML in clientside callbacks

Open
#2,038 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature P3
Dominant language
Python
Stars
24.4k
Forks
2.3k
Avg merge
2d 7h
Merged PRs (30d)
13

Description

Is your feature request related to a problem? Please describe.
You can easily convert a server-side callback to a client-side callback if you know a bit of javascript, unless it has "children" with non-basic components as output.

Describe the solution you'd like
I'd like to be able to use dash_html_components in clientside callbacks

Describe alternatives you've considered
Having a "fixed layout" and creating a callback with lots of outputs for each thing that has to be changed (values, classNames, children, etc.)

Additional context

  • This has been discussued in the community forum in this post, but I think that post provides just a hack, not a feature.
  • Tried with the following code:
return window.dash_html.components.Div({children: ['Name'], className: 'dao-info-label'})

which returns the following error:

Error: An object was provided as `children` instead of a component, string, or number (or list of those)

Its generated by React, so perhaps there is a way to create the components using react

Update:

Using React.createElement generates the same error

return React.createElement('div', { className: 'dao-info-label'}, 'Name');

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no repository files, tests, or implementation entry points. Start by reproducing the clientside callback examples using dash_html.components.Div and React.createElement, then trace how callback return values are validated and rendered. Done means HTML components can be returned from clientside callbacks without the reported children error.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, python, react
Domain
frontend, web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.