ui.select · parts: Select, SelectOption, SelectOptGroup · elements: <select>, <option>, <optgroup>
Select is a native dropdown. Flat options come from the Options list; SelectOption / SelectOptGroup children cover grouped or custom markup.
- Flat lists:
options; grouped lists:SelectOptGroup+SelectOptionchildren. valuemarks the matching optionselectedin markup and drives the live DOM value on the client (React:valuewithonChange, elsedefaultValue).
SelectOptionItem: Value (string), Label (string), Disabled (bool)
Select renders option children from Options, then manual children.
| Canonical (templ, Jinja2, MiniJinja) | React / Solid | HTML (Svelte, Vue, WC) | Type | Default | Kind | Description |
|---|---|---|---|---|---|---|
ID |
id |
id |
string |
— | passthrough attr | |
Name |
name |
name |
string |
— | passthrough attr | |
Value |
value |
value |
string |
— | prop | selected option value |
Multiple |
multiple |
multiple |
boolean |
— | prop | |
Required |
required |
required |
boolean |
— | prop | |
Disabled |
disabled |
disabled |
boolean |
— | prop | |
Options |
options |
options |
SelectOptionItem[] |
— | prop | |
AriaInvalid |
aria-invalid |
aria-invalid |
string |
— | passthrough attr | |
AriaDescribedBy |
aria-describedby |
aria-describedby |
string |
— | passthrough attr |
Also accepts: class (className in React), extra attributes (rest props in UI frameworks, Attrs in templ/Jinja2/MiniJinja, attrs in Twig/Latte; caller wins), children.
No variants: the primitive ships no visual classes; style it with token classes via class.
Accepts children (default slot / children / { children... } / trusted HTML string in Twig, Latte, Jinja2, MiniJinja — see runtimes). Void tags selected via tag render no children.
- Computed/forwarded:
aria-invalid,aria-describedby(omitted when empty). - Typed ARIA props:
aria-invalid,aria-describedby— static values only.
Compose the part's classes without rendering it (custom root element, no asChild outside React):
| Runtime | Helper |
|---|---|
| React / Solid / Vue / Svelte / WC | selectClasses({ ... }) from select/select.shared.ts |
| templ | selectfield.SelectClasses(selectfield.SelectProps{...}) |
| Twig | ui8kit_classes('selectClasses', { class: '…' }) |
| Latte | \UI8Kit\Latte\Classes::selectClasses(['class' => '…']) |
| Jinja2 | select_classes(p) |
| MiniJinja | select_classes(p) (registered by ui8kit_minijinja::register) |
Canonical renderer output (children = Content); all 10 runtimes are parity-tested to produce this DOM.
| State | Props | HTML |
|---|---|---|
| defaults | — | <select class="pr-2">Content</select> |
| options | {"Name":"c","Value":"b","Options":[{"Value":"a","Label":"A"},{"Value":"b","Label":"B"},{"Value":"c","Label":"C","Disabled":true}]} |
<select class="pr-2" name="c"><option value="a">A</option><option value="b" selected>B</option><option value="c" disabled>C</option>Content</select> |
| states | {"Multiple":true,"Required":true,"Disabled":true,"AriaInvalid":"true"} |
<select class="pr-2" multiple required disabled aria-invalid="true">Content</select> |
| option | {"Value":"x"} |
<select class="pr-2">Content</select> |
| group | {"Disabled":true} |
<select class="pr-2" disabled>Content</select> |
| Multiple | {"Multiple":true} |
<select class="pr-2" multiple>Content</select> |
| Required | {"Required":true} |
<select class="pr-2" required>Content</select> |
| Disabled | {"Disabled":true} |
<select class="pr-2" disabled>Content</select> |
Fixture options ({"Name":"c","Value":"b","Options":[{"Value":"a","Label":"A"},{"Value":"b","Label":"B"},{"Value":"c","Label":"C","Disabled":true}]}) — every snippet renders:
<select class="pr-2" name="c"><option value="a">A</option><option value="b" selected>B</option><option value="c" disabled>C</option>Content</select>React (runtime notes)
import { Select } from "./ui/select/select";
<Select value="b" options={[{ value: "a", label: "A" }, { value: "b", label: "B" }, { value: "c", label: "C", disabled: true }]} name="c">Content</Select>Vue 3 (runtime notes)
<script setup lang="ts">
import Select from "./ui/select/Select.vue";
</script>
<template>
<Select value="b" :options='[{"value":"a","label":"A"},{"value":"b","label":"B"},{"value":"c","label":"C","disabled":true}]' name="c">Content</Select>
</template>Svelte 5 (runtime notes)
<script lang="ts">
import Select from "./ui/select/Select.svelte";
</script>
<Select value="b" options={[{ value: "a", label: "A" }, { value: "b", label: "B" }, { value: "c", label: "C", disabled: true }]} name="c">Content</Select>SolidJS (runtime notes)
import { Select } from "./ui/select/select.solid";
<Select value="b" options={[{ value: "a", label: "A" }, { value: "b", label: "B" }, { value: "c", label: "C", disabled: true }]} name="c">Content</Select>Web Components (runtime notes)
import { renderSelect } from "./ui/select/select.wc";
document.body.append(renderSelect({ value: "b", options: [{ value: "a", label: "A" }, { value: "b", label: "B" }, { value: "c", label: "C", disabled: true }], name: "c" }, "Content"));Go templ (runtime notes)
import "github.com/ui8kit/codegen/generated/templ/ui/select" // package selectfield
@selectfield.Select(selectfield.SelectProps{Name: "c", Value: "b", Options: []selectfield.SelectOptionItem{{Value: "a", Label: "A"}, {Value: "b", Label: "B"}, {Value: "c", Label: "C", Disabled: true}}}) {
Content
}Twig (runtime notes)
{% include 'select/Select.html.twig' with { name: 'c', value: 'b', options: [{ value: 'a', label: 'A' }, { value: 'b', label: 'B' }, { value: 'c', label: 'C', disabled: true }], children: 'Content' } only %}Latte (runtime notes)
{include 'select/Select.latte', name: 'c', value: 'b', options: [['value' => 'a', 'label' => 'A'], ['value' => 'b', 'label' => 'B'], ['value' => 'c', 'label' => 'C', 'disabled' => true]], children: 'Content'}Jinja2 (runtime notes)
{% with p = {'Name': 'c', 'Value': 'b', 'Options': [{'Value': 'a', 'Label': 'A'}, {'Value': 'b', 'Label': 'B'}, {'Value': 'c', 'Label': 'C', 'Disabled': True}]}, children = 'Content' %}{% include 'ui/select/select.html.j2' %}{% endwith %}MiniJinja (Rust) (runtime notes)
{% import 'ui8kit.html' as ui %}
{{ ui.select({'Name': 'c', 'Value': 'b', 'Options': [{'Value': 'a', 'Label': 'A'}, {'Value': 'b', 'Label': 'B'}, {'Value': 'c', 'Label': 'C', 'Disabled': true}]}, children='Content') }}SelectOption renders a native option.
| Canonical (templ, Jinja2, MiniJinja) | React / Solid | HTML (Svelte, Vue, WC) | Type | Default | Kind | Description |
|---|---|---|---|---|---|---|
Value |
value |
value |
string |
— | passthrough attr | |
Selected |
selected |
selected |
boolean |
— | prop | |
Disabled |
disabled |
disabled |
boolean |
— | prop |
Also accepts: extra attributes (rest props in UI frameworks, Attrs in templ/Jinja2/MiniJinja, attrs in Twig/Latte; caller wins), children.
No variants: the primitive ships no visual classes; style it with token classes via class.
Accepts children (default slot / children / { children... } / trusted HTML string in Twig, Latte, Jinja2, MiniJinja — see runtimes). Void tags selected via tag render no children.
- No ARIA attributes are rendered by the primitive; rely on native semantics. Pass extra
aria-*through attrs.
Canonical renderer output (children = Content); all 10 runtimes are parity-tested to produce this DOM.
| State | Props | HTML |
|---|---|---|
| defaults | — | <option>Content</option> |
| options | {"Value":"b"} |
<option value="b">Content</option> |
| states | {"Disabled":true} |
<option disabled>Content</option> |
| option | {"Value":"x","Selected":true} |
<option value="x" selected>Content</option> |
| group | {"Disabled":true} |
<option disabled>Content</option> |
| Selected | {"Selected":true} |
<option selected>Content</option> |
| Disabled | {"Disabled":true} |
<option disabled>Content</option> |
Fixture options ({"Value":"b"}) — every snippet renders:
<option value="b">Content</option>React (runtime notes)
import { SelectOption } from "./ui/select/select";
<SelectOption value="b">Content</SelectOption>Vue 3 (runtime notes)
<script setup lang="ts">
import SelectOption from "./ui/select/SelectOption.vue";
</script>
<template>
<SelectOption value="b">Content</SelectOption>
</template>Svelte 5 (runtime notes)
<script lang="ts">
import SelectOption from "./ui/select/SelectOption.svelte";
</script>
<SelectOption value="b">Content</SelectOption>SolidJS (runtime notes)
import { SelectOption } from "./ui/select/select.solid";
<SelectOption value="b">Content</SelectOption>Web Components (runtime notes)
import { renderSelectOption } from "./ui/select/select.wc";
document.body.append(renderSelectOption({ value: "b" }, "Content"));Go templ (runtime notes)
import "github.com/ui8kit/codegen/generated/templ/ui/select" // package selectfield
@selectfield.SelectOption(selectfield.SelectOptionProps{Value: new("b")}) {
Content
}Twig (runtime notes)
{% include 'select/SelectOption.html.twig' with { value: 'b', children: 'Content' } only %}Latte (runtime notes)
{include 'select/SelectOption.latte', value: 'b', children: 'Content'}Jinja2 (runtime notes)
{% with p = {'Value': 'b'}, children = 'Content' %}{% include 'ui/select/select-option.html.j2' %}{% endwith %}MiniJinja (Rust) (runtime notes)
{% import 'ui8kit.html' as ui %}
{{ ui.select_option({'Value': 'b'}, children='Content') }}SelectOptGroup renders a native optgroup around option children.
| Canonical (templ, Jinja2, MiniJinja) | React / Solid | HTML (Svelte, Vue, WC) | Type | Default | Kind | Description |
|---|---|---|---|---|---|---|
Label |
label |
label |
string |
— | passthrough attr | |
Disabled |
disabled |
disabled |
boolean |
— | prop |
Also accepts: extra attributes (rest props in UI frameworks, Attrs in templ/Jinja2/MiniJinja, attrs in Twig/Latte; caller wins), children.
No variants: the primitive ships no visual classes; style it with token classes via class.
Accepts children (default slot / children / { children... } / trusted HTML string in Twig, Latte, Jinja2, MiniJinja — see runtimes). Void tags selected via tag render no children.
- No ARIA attributes are rendered by the primitive; rely on native semantics. Pass extra
aria-*through attrs.
Canonical renderer output (children = Content); all 10 runtimes are parity-tested to produce this DOM.
| State | Props | HTML |
|---|---|---|
| defaults | — | <optgroup>Content</optgroup> |
| states | {"Disabled":true} |
<optgroup disabled>Content</optgroup> |
| group | {"Label":"Group","Disabled":true} |
<optgroup label="Group" disabled>Content</optgroup> |
| Disabled | {"Disabled":true} |
<optgroup disabled>Content</optgroup> |
Fixture states ({"Disabled":true}) — every snippet renders:
<optgroup disabled>Content</optgroup>React (runtime notes)
import { SelectOptGroup } from "./ui/select/select";
<SelectOptGroup disabled>Content</SelectOptGroup>Vue 3 (runtime notes)
<script setup lang="ts">
import SelectOptGroup from "./ui/select/SelectOptGroup.vue";
</script>
<template>
<SelectOptGroup disabled>Content</SelectOptGroup>
</template>Svelte 5 (runtime notes)
<script lang="ts">
import SelectOptGroup from "./ui/select/SelectOptGroup.svelte";
</script>
<SelectOptGroup disabled={true}>Content</SelectOptGroup>SolidJS (runtime notes)
import { SelectOptGroup } from "./ui/select/select.solid";
<SelectOptGroup disabled>Content</SelectOptGroup>Web Components (runtime notes)
import { renderSelectOptGroup } from "./ui/select/select.wc";
document.body.append(renderSelectOptGroup({ disabled: true }, "Content"));Go templ (runtime notes)
import "github.com/ui8kit/codegen/generated/templ/ui/select" // package selectfield
@selectfield.SelectOptGroup(selectfield.SelectOptGroupProps{Disabled: true}) {
Content
}Twig (runtime notes)
{% include 'select/SelectOptGroup.html.twig' with { disabled: true, children: 'Content' } only %}Latte (runtime notes)
{include 'select/SelectOptGroup.latte', disabled: true, children: 'Content'}Jinja2 (runtime notes)
{% with p = {'Disabled': True}, children = 'Content' %}{% include 'ui/select/select-opt-group.html.j2' %}{% endwith %}MiniJinja (Rust) (runtime notes)
{% import 'ui8kit.html' as ui %}
{{ ui.select_opt_group({'Disabled': true}, children='Content') }}