InputGroup
Theme-aware, responsive input group component.
Usage
Components are auto-discovered. Use the component directly in any .wrn view:
<InputGroup
size="default"
color="primary"
id="id"
name="name"
label="Input group"
/>Legacy mount name: data-component="InputGroup".
Props and attributes
| Prop | Type | Requirement | Default |
|---|---|---|---|
size | string | Optional | "default" |
color | string | Optional | "primary" |
id | string | Optional | "" |
name | string | Optional | "" |
label | string | Optional | "Input group" |
hiddenLabel | boolean | Optional | false |
value | string | Optional | "" |
placeholder | string | Optional | "" |
type | string | Optional | "text" |
startText | string | Optional | "" |
endText | string | Optional | "" |
icon | string | Optional | "" |
iconPosition | string | Optional | "start" |
actionLabel | string | Optional | "" |
helperText | string | Optional | "" |
cornerHint | string | Optional | "" |
error | string | Optional | "" |
inline | boolean | Optional | false |
variant | string | Optional | "normal" |
readonly | boolean | Optional | false |
disabled | boolean | Optional | false |
required | boolean | Optional | false |
class | string | Optional | "" |
Slots
This component does not declare a slot.
Events
inputchangefocusblursubmitaction
Source contract
Installed source: components/InputGroup.wrn
component InputGroup {
props {
@event input = function
@event change = function
@event focus = function
@event blur = function
@event submit = function
@event action = function
size = "default"
color = "primary"
id = ""
name = ""
label = "Input group"
hiddenLabel = false
value = ""
placeholder = ""
type = "text"
startText = ""
endText = ""
icon = ""
iconPosition = "start"
actionLabel = ""
helperText = ""
cornerHint = ""
error = ""
inline = false
variant = "normal"
readonly = false
disabled = false
required = false
class = ""
}
functions {
function emitField(nameEvent, sourceEvent) { sourceEvent.stopPropagation(); $emit(nameEvent, { value: sourceEvent.currentTarget.value, name: name, sourceEvent: sourceEvent }) }
function handleKeydown(sourceEvent) { if (sourceEvent.key === "Enter") { sourceEvent.stopPropagation(); $emit("submit", { value: sourceEvent.currentTarget.value, name: name, sourceEvent: sourceEvent }) } }
function handleAction(sourceEvent) { $emit("action", { name: name, sourceEvent: sourceEvent }) }
}
view {
<div {...attrs} class="wire-next wire-next--color-{color} wire-next--size-{size} wire-next--field wire-next--input-group {class}" data-variant="{variant}" data-inline="{inline}" data-invalid="{error ? 'true' : 'false'}">
<div class="wire-next__field-heading">
<label class="{hiddenLabel ? 'wire-next__sr-only' : ''}" for="{id || name}">{label}</label>{#if cornerHint}<span class="wire-next__field-hint">{cornerHint}</span>{/if}</div>
<div class="wire-next__input-group-control">
{#if startText}<span class="wire-next__input-addon">{startText}</span>{/if}
{#if icon}<span class="{icon} wire-next__field-icon" data-position="{iconPosition}" aria-hidden="true">
</span>{/if}
<input id="{id || name}" type="{type}" name="{name}" value="{value}" placeholder="{placeholder}" readonly="{readonly}" disabled="{disabled}" required="{required}" aria-invalid="{error ? 'true' : 'false'}" @input="emitField('input', event)" @change="emitField('change', event)" @focus="emitField('focus', event)" @blur="emitField('blur', event)" @keydown="handleKeydown(event)" />
{#if endText}<span class="wire-next__input-addon">{endText}</span>{/if}
{#if actionLabel}<button type="button" disabled="{disabled}" @click="handleAction(event)">{actionLabel}</button>{/if}
</div>
{#if helperText}<small class="wire-next__field-help">{helperText}</small>{/if}<small class="wire-next__field-error" data-error="{name}">{error}</small>
</div>
}
}