File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -172,6 +172,22 @@ Attribute values are quoted (HTML-escaped) automatically:
172172>>> print (div(attr = ' a value with "quotes" and a <tag>' ))
173173<div attr="a value with "quotes" and a <tag>"></div>
174174
175+ Boolean attributes
176+ ^^^^^^^^^^^^^^^^^^
177+
178+ A boolean HTML attribute is one that does not have a value. For example, to
179+ mark an input field as required, you can write ``<input required> ``. There is
180+ also an alternative syntax, which minihtml uses: ``<input
181+ required="required"> ``.
182+
183+ To set a boolean attribute, pass ``True `` as the value. ``False `` is also a
184+ valid value, and causes the attribute to be omitted (this can be useful if you
185+ set the attribute from a variable):
186+
187+ >>> from minihtml.tags import input
188+ >>> print (input (required = True , disabled = False ))
189+ <input required="required">
190+
175191.. _content :
176192
177193Content
You can’t perform that action at this time.
0 commit comments