ui.TagList

ui.TagList(*args)

Create an HTML tag list (i.e., a fragment of HTML)

Parameters

*args : TagChild = ()

The tag children to add to the list.

Examples

>>> from htmltools import TagList, div
>>> TagList("hello", div(id="foo", class_="bar"))
hello
<div id="foo" class="bar"></div>

Methods

Name Description
append Append tag children to the end of the list.
extend Extend the children by appending an iterable of children.
insert Insert tag children before a given index.
tagify Convert any tagifiable children to TagifiedTag/TagifiedTagList objects.

append

ui.TagList.append(item, *args)

Append tag children to the end of the list.

extend

ui.TagList.extend(other)

Extend the children by appending an iterable of children.

insert

ui.TagList.insert(i, item)

Insert tag children before a given index.

tagify

ui.TagList.tagify()

Convert any tagifiable children to TagifiedTag/TagifiedTagList objects.

Raises

: TypeError

If a child’s .tagify() returned a TagList containing an un-tagified Tagifiable object — i.e. the recursion was not done all the way down. The error names the offending class and slot index so the broken .tagify() is easy to find.