Rendering raw HTML
See original GitHub issueThanks for Dash! 😄
I am trying to pass raw HTML through to Dash, such as HTML returned by calling pd.DataFrame.to_html() (as a shortcut to defining a function such as generate_table() in the getting started docs).
React seems to support this through a div that sets dangerouslySetInnerHTML. Passing this to html.Div raises an exception that the argument is not one of the 14 that are pre-defined.
Is there any way to do this with Dash?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Rendering raw html with reactjs - javascript - Stack Overflow
Use built-in APIs to parse a raw HTML string into an HTML Element; Recursively transform an Element object (and its children) into ReactElement ......
Read more >Render Raw HTML In React | Become Front-End Expert
Learn how to sanitize and render raw HTML code in React using the dangerouslySetInnerHTML prop or external libraries.
Read more >Render raw HTML example - CodeSandbox
CodeSandbox is an online editor tailored for web applications.
Read more >React Render Raw Plain HTML String - CodingShower
Let's explore all the different ways to render raw HTML strings in React. dangerouslySetInnerHTML. Using the dangerouslySetInnerHTML ...
Read more >How do I render raw HTML in Blazor? - Syncfusion
Raw HTML can be rendered in Blazor by using the MarkupString. You can set the raw HTML as a string to any parameter...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Hello guys, I stumbled on the same issue recently, I managed to solve it with Beautifulsoup and a recursive function
Parse your html with BeautifulSoup :
And use the following recursive function to convert the parsed html to a set of
dash-html-componentsWith the helper function to get a style dictionary from a list of style arguments of a Beautifulsoup element
This was a quick hack, but worked perfectly for what I wanted to do !
@frogger72 - Good point. I ran into this myself on a personal project where I wanted to render HTML from a third-party source and converting it to the
dash-html-componentslibrary would’ve been too complex. I have created a dangeroulsySetInnerHTML component that you can use now https://github.com/plotly/dash-dangerously-set-inner-html. However, I recommend using thedash-html-componentsas much as possible.