Select
Example:
Code example:
from htmy import ComponentType, html
from htmui.basecoat.select import select
def example() -> ComponentType:
return select(
html.optgroup(
html.option("Apple"),
html.option("Banana", selected="true"),
html.option("Orange"),
html.option("Strawberry"),
label="Fruits",
),
button_class="w-40",
)
Component implementation:
For more details, see the BasecoatUI documentation.
from htmy import ComponentType, PropertyValue, SafeStr, html, join_classes
__version__ = "0.1.0"
__framework__ = "BasecoatUI"
__framework_version__ = "0.3"
__framework_url__ = "https://basecoatui.com/components/select/"
js = SafeStr(
'<script src="https://cdn.jsdelivr.net/npm/basecoat-css@0.3/dist/js/select.min.js" defer></script>'
)
def select(*children: ComponentType, class_: str | None = None, **kwargs: PropertyValue) -> ComponentType:
return html.select(*children, class_=join_classes("select", class_), **kwargs)