Skip to content
W WRNexusJS
core component

Select

Reusable select component.

@wrnexus/ui 0.2.678 props1 slots0 events

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

PropTypeRequirementDefault
classstringOptional""
idstringOptional""
namestringOptional""
labelstringOptional"Select"
helpstringOptional""
errorstringOptional""
requiredbooleanOptionalfalse
disabledbooleanOptionalfalse

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>
    }
}