blu.html¶
React HTML elements.
from blu.html import div, p
div(className='my-div')[
p['Hello!'],
p['Hi.'],
]
<div className='my-div'>
<p>Hello!</p>
<p>Hi.</p>
</div>
- blu.html.__getattr__(import_name: str) HTMLElement¶
Creates a
blu.HTMLElementwith the given HTML tag name.from blu.html import div, p div(className='my-div')[ p['Hello!'], p['Hi.'], ]
<div className='my-div'> <p>Hello!</p> <p>Hi.</p> </div>
Use a trailing underscore to import tag names that are reserved words in Python (the trailing underscore won’t show up in the resulting html):
from blu.html import del_ del_['Hello, World!']
<del>Hello, World!</del>
Non-trailing underscores will be converted to dashes:
from blu.html import my_custom_element my_custom_element['Hello!']
<my-custom-element>Hello!</my-custom-element>
For the rare case where your desired HTML tag name cannot be imported from
blu.html, useblu.create_rare_html_element().- Parameters:
import_name – An HTML tag name.
- Returns:
A
blu.HTMLElementwhose tag name isimport_namewith the last trailing underscore (if any) removed and any other underscores converted to dashes. TheHTMLElementwon’t have any props or children.