Vitral 0.2
Form

InputGroup

Fields, buttons and addons welded into one control, with inner corners squared and a single border between neighbours.

Import

main.ts
import { InputGroup } from '@vitral/vue';

Addons

@
$
.00
https://
<script setup lang="ts">import { InputGroup, InputGroupAddon, InputNumber, InputText } from '@vitral/vue';import { ref } from 'vue'; const user = ref('');const price = ref<number | null>(120);const site = ref('');</script> <template>    <InputGroup style="max-width: 20rem">        <InputGroupAddon>@</InputGroupAddon>        <InputText v-model="user" aria-label="Username" placeholder="Username" />    </InputGroup>    <InputGroup style="max-width: 20rem">        <InputGroupAddon>$</InputGroupAddon>        <InputNumber v-model="price" aria-label="Price" />        <InputGroupAddon>.00</InputGroupAddon>    </InputGroup>    <InputGroup style="max-width: 24rem">        <InputGroupAddon>https://</InputGroupAddon>        <InputText v-model="site" aria-label="Website" placeholder="example.com" />    </InputGroup></template>

With a button

<script setup lang="ts">import { Button, InputGroup, InputText } from '@vitral/vue';import { ref } from 'vue'; const query = ref('');</script> <template>    <InputGroup style="max-width: 24rem">        <InputText v-model="query" aria-label="Search" placeholder="Keyword" />        <Button label="Search" icon="search" />    </InputGroup></template>

A named range

Two controls, one name: the group is announced as “Price range”.

to
<script setup lang="ts">import { InputGroup, InputGroupAddon, InputNumber } from '@vitral/vue';import { ref } from 'vue'; const from = ref<number | null>(10);const to = ref<number | null>(90);</script> <template>    <InputGroup label="Price range" style="max-width: 24rem">        <InputNumber v-model="from" aria-label="From" />        <InputGroupAddon>to</InputGroupAddon>        <InputNumber v-model="to" aria-label="To" />    </InputGroup></template>

API

Read from packages/vue/src/components/InputGroup/types.ts, so it says what the component actually accepts.

Props

NameTypeDescription
labelstringNames the group when it holds more than one control: a range, an amount and its unit.

Plus pt, dt and unstyled from BaseProps, see pass-through and unstyled mode.

Slots

NameSlot propsDescription
default——