Label above the control, description and error under it.
Form
Label above the control, description under it, the error replacing it once touched. Units go in an addon.
<script setup>
import { Field, FieldDescription, FieldError, FieldGroup, FieldLabel } from '@aisgroup/design/ui/field';
import { Input } from '@aisgroup/design/ui/input';
import { InputGroup, InputGroupAddon, InputGroupInput } from '@aisgroup/design/ui/input-group';
</script>
<template>
<FieldGroup class="w-full max-w-sm">
<Field>
<FieldLabel for="f-name">Format name</FieldLabel>
<Input id="f-name" model-value="Demo bottle" />
<FieldDescription>Shown in the Profiler gallery.</FieldDescription>
</Field>
<Field data-invalid>
<FieldLabel for="f-diam">Diameter</FieldLabel>
<InputGroup>
<InputGroupInput id="f-diam" model-value="0" aria-invalid="true" />
<InputGroupAddon align="inline-end">mm</InputGroupAddon>
</InputGroup>
<FieldError>Enter a diameter above 0 mm.</FieldError>
</Field>
</FieldGroup>
</template>Switch rows
Settings as switch rows: several share one bordered list.
<script setup>
import { Field, FieldContent, FieldDescription, FieldLabel } from '@aisgroup/design/ui/field';
import { Switch } from '@aisgroup/design/ui/switch';
</script>
<template>
<div class="w-full max-w-xl divide-y rounded-lg border">
<Field orientation="horizontal" class="p-4">
<FieldContent><FieldLabel for="s-1">Sync with the controller</FieldLabel><FieldDescription>New images upload as they are captured.</FieldDescription></FieldContent>
<Switch id="s-1" :model-value="true" />
</Field>
<Field orientation="horizontal" class="p-4">
<FieldContent><FieldLabel for="s-2">Sign out when idle</FieldLabel><FieldDescription>After 5 minutes without activity.</FieldDescription></FieldContent>
<Switch id="s-2" />
</Field>
</div>
</template>