WlFieldGroup
Basic example
Attach WlField’s ID to the input. The prefix stays separate from the value and each control stays in the normal Tab order.
Full example
<form class="wl-stack" data-space="sm" @submit.prevent="submitted = query.trim()">
<WlField v-slot="{ id, labelId }" label="Site address">
<WlFieldGroup>
<template #prefix>https://</template>
<WlInput :id="id" v-model="query" :aria-labelledby="labelId" />
<WlButton type="submit">{{ "Save" }}</WlButton>
</WlFieldGroup>
</WlField>
<output v-if="submitted" aria-label="Saved">https://{{ submitted }}</output>
</form>Units and an attached action
Add a unit after the field or place a clear action beside the input. WlField connects the visible label to the input.
Studio North
Full example
<script setup lang="ts">
import { WlButton, WlField, WlFieldGroup, WlIcon, WlInput } from "legato-ui";
import { computed, ref } from "vue";
const hours = ref("4");
const filter = ref("North");
const customers = ["Studio North", "Paper Plane", "Monday Works"];
const matches = computed(() => customers.filter((name) =>
name.toLowerCase().includes(filter.value.trim().toLowerCase())));
</script>
<template>
<div class="wl-stack" data-space="lg">
<WlField
v-slot="{ id, ariaDescribedby }"
label="Response time in hours"
hint="Enter at least one hour."
>
<WlFieldGroup>
<WlInput
:id="id"
v-model="hours"
type="number"
min="1"
:aria-describedby="ariaDescribedby"
/>
<template #suffix>{{ "h" }}</template>
</WlFieldGroup>
</WlField>
<WlField v-slot="{ id }" label="Filter by customer">
<WlFieldGroup>
<template #prefix><WlIcon name="search" /></template>
<WlInput :id="id" v-model="filter" />
<WlButton variant="secondary" @click="filter = ''">
{{ "Clear" }}
</WlButton>
</WlFieldGroup>
</WlField>
<p class="wl-text-small wl-text-muted" role="status">
{{ matches.join(", ") || "No matching customers" }}
</p>
</div>
</template>Props
Types, accepted values and literal defaults come from the public manifest. Inherited settings name their source; “Not set” means no default is declared.
| Prop | Type / values | Default | Purpose |
|---|---|---|---|
pt | WlPt< | Not set | Attributes of the group, prefix and suffix. |
Events
No public events.
Slots
| Slot | Type / values | Content |
|---|---|---|
default | default?(): unknown; | Native and Legato controls adjacent to one another. |
prefix | prefix?(): unknown; | Text or icon supplemental to the field, such as a URL scheme. |
suffix | suffix?(): unknown; | Text or icon supplemental to the field, such as a unit of measure. |
Pass-through: pt
Sections WlFieldGroup are listed below. Attributes merge in this order: createWlPt() WlConfig.ptpt instance. Class and style merge; the last supplied value takes priority for other attributes.
| Section | DOM | Purpose |
|---|---|---|
root | div.wl-field-group | Main element of the component. |
prefix | span.wl-field-group__addon | Add-on before the control. |
suffix | span.wl-field-group__addon | Add-on after the control. |
Sections refer to the component DOM. Dotted names identify a configuration group and its section; composite parts use their own pt groups. Global and local attributes merge, with class and style added together.
Keyboard and accessibility
- Attach WlField’s ID to the input. The prefix stays separate from the value and each control stays in the normal Tab order.
- Give each field and action its own label. The shared border does not provide a name.
- If a prefix or suffix changes the meaning of a value, include it in the field label or description.
Keyboard and application responsibilities
Provide a meaningful accessible name and connect labels, hints and errors to the focusable element. Check the behavior with your own data and a screen reader.
WAI-ARIA Authoring PracticesIn your application, check keyboard controls, zoom and focus visibility. State labels and required information must be readable in every theme.