Building Custom Panel Widgets Using ReactiveHTML
No library can cover all the specialized widgets a user may want… but a good one makes it easy for the user to create their own specialized widget that can be used alongside the library!
Panel is one of those cool libraries–you can create interactive web apps and data dashboards straight from Python code, but if you need more than what’s built-in, you can also create your own custom widgets using Panel’s ReactiveHTML class!
The ReactiveHTML class lets you add a dash of HTML to your Python code and, just as the name implies, make that HTML come alive with reactivity! If desired or needed, you can throw in some Jinja2 and/or Javascript into the mix too.
In this blog post, we will demo how to use ReactiveHTML for creating:
- collapsible sections
- toggle icons
And demonstrate how we can integrate these components into built-in Panel components.
Let’s get to it!
Collapsible Sections
Bootstrapping with ChatGPT
To get started using ReactiveHTML, you need an HTML template. If you’re unfamiliar with HTML, don’t fret; there are tons of examples so ChatGPT can…