Select
Reusable select component.
Usage
Components are auto-discovered. Use the component directly in any .wrn view:
<Select
id="id"
name="name"
label="Select"
help="help"
error="error"
/>Legacy mount name: data-component="Select".
Props and attributes
| Prop | Type | Requirement | Default |
|---|---|---|---|
class | string | Optional | "" |
id | string | Optional | "" |
name | string | Optional | "" |
label | string | Optional | "Select" |
help | string | Optional | "" |
error | string | Optional | "" |
required | boolean | Optional | false |
disabled | boolean | Optional | false |
Slots
default
Events
This component does not declare a custom event.
Source contract
Installed source: components/Select.wrn
component Select {
props {
class = ""
id = ""
name = ""
label = "Select"
help = ""
error = ""
required = false
disabled = false
}
view {
<div class="space-y-2 {class}">
<label for="{id}" class="block text-sm font-semibold text-slate-800 dark:text-slate-200">{label}<span data-show="required" class="ml-1 text-red-500">*</span>
</label>
<select id="{id}" name="{name}" required="{required}" disabled="{disabled}" class="min-h-11 w-full rounded-xl border border-slate-300 bg-white px-3.5 py-2.5 text-slate-950 shadow-sm outline-none transition focus:border-violet-500 focus:ring-4 focus:ring-violet-500/10 dark:border-slate-700 dark:bg-slate-950 dark:text-white">
<slot />
</select>
<p data-show="help && !error" class="text-sm text-slate-500">{help}</p>
<p data-show="error" role="alert" class="text-sm font-medium text-red-600">{error}</p>
</div>
}
}