Basic usage
Constructor
list[tuple[str, str | float | None]] | dict | Callable | None
default:"None"
Highlighted text as:
- List of
(text, label)tuples - Dict with
"text"and"entities"keys (Hugging Face format)
dict[str, str] | None
default:"None"
Dictionary mapping labels to colors (e.g.,
{"PER": "red", "LOC": "#00FF00"})bool
default:"False"
Whether to show category legend separately
bool
default:"True"
If False, doesn’t display label inline. Only applies when
show_legend=Falsebool
default:"False"
If True, merges adjacent tokens with same category
str
default:"''"
Separator between adjacent tokens when
combine_adjacent=Truebool
default:"True"
If False, strips leading/trailing whitespace from tokens
bool
default:"False"
If True, displays text right-to-left
Events
- change - Triggered when highlighted text changes
- select - Triggered when span is selected