1. Reference
  2. Forms and input

<select>

A dropdown field built from <option> children; the chosen value is published under name=.

Forms and input
select.ham
<column style="w-full gap-12">
    <select id="size"
            name="size"
            label="Size">
        <option value="s">Small</option>
        <option value="m"
                selected="true">Medium</option>
        <option value="l">Large</option>
    </select>
    <text @text="'Size: ' + #size.label"
          style="muted"></text>
</column>
The snippet drawn by Hype Apps on a phone, in light mode The snippet drawn by Hype Apps on a phone, in dark mode
This snippet as Hype Apps draws it on a phone. It follows this page's light or dark theme.

Attributes

NameWhat it doesDefault
icon Prefix icon
string
label Label
string
name Variable name for form scoping
string
placeholder Placeholder text
string
Select an option
style Style classes
string

Readings

NameWhat it does
count How many options the control offers.
index The selected option's position, from 0; -1 when none.
label The selected option's text; empty when none is selected.
value The selected option's value; empty when none is selected.

Any tag also takes gestures: @on.tap, @on.longpress, @on.doubletap and @on.swipeleft (and right, up and down). @click runs on a tap too.

This page is also Markdown, and all of HAM is in llms.txt.