Show-and-Tell - Dash Selectable

I’ve made a very small custom Dash component using the dash component boilerplate library for detecting text selection called dash-selectable.

It can be installed with pip install dash-selectable.

The component library was inspired by this stackoverflow question which asks:

I would like to show the user a paragraph of text, and then ask the user to select part(s) of text. This text will then be analysed and an output will be shown in another component. How can I achieve this in Dash?

The component adds a selectionchange event listener to the document and sets a selectedValue property to the text selected in the document.

This property can then be used in Dash callbacks.

5 Likes

So awesome! Very clever use of selectionchange

1 Like