Skip to content

HTML Elements

Low-level HTML element wrappers. These map directly to standard HTML tags with Python-friendly attribute naming (clsclass, hx_gethx-get).

Button

Standard HTML <button> element.

Preview

Code

Button("Click me", type="submit")

Parameters

Parameter Type Description
*children Any Button content
type str Button type (button/submit/reset)

Input

HTML <input> element. Void element (no children).

Preview

Code

Input(type="text", name="username", placeholder="Enter name")

Parameters

Parameter Type Description
type str Input type (text/email/password/number/...)
name str Field name
placeholder str Placeholder text

Select / Option

HTML <select> with <option> children.

Preview

Code

Select(
    Option("Apple", value="apple"),
    Option("Banana", value="banana"),
    Option("Cherry", value="cherry"),
    name="fruit",
)

Parameters

Parameter Type Description
name str Field name
*children Option Option elements

Table

HTML <table> with thead/tbody structure.

Preview

Code

Table(
    Thead(Tr(Th("Name"), Th("Age"))),
    Tbody(
        Tr(Td("Alice"), Td("30")),
        Tr(Td("Bob"), Td("25")),
    ),
)

Form

HTML <form> container.

Preview

Code

Form(
    Label("Name", Input(type="text", name="name")),
    Button("Submit", type="submit"),
    method="post",
)

Ul / Ol

Unordered and ordered list elements.

Preview

Code

Div(
    H3("Unordered"),
    Ul(Li("Item 1"), Li("Item 2"), Li("Item 3")),
    H3("Ordered"),
    Ol(Li("First"), Li("Second"), Li("Third")),
)

Details / Summary

Disclosure widget with expandable content.

Preview

Code

Details(
    Summary("Click to expand"),
    P("Hidden content revealed on click."),
)

Progress

HTML <progress> bar.

Preview

Code

Progress(value="70", max="100")

Video

HTML <video> element.

Preview

Code

Video(src="video.mp4", controls=True, width="320")

Img

HTML <img> element.

Preview

Code

Img(src="https://picsum.photos/300/200", alt="Sample")