››input-group
Input Group
An input or textarea with addons beside, above or below it, such as a search icon, a unit or a button that submits.
Parts
| Part | File | Does |
|---|---|---|
| InputGroup | InputGroup.vue | Groups an input with addons such as icons, buttons or text. |
| InputGroupAddon | InputGroupAddon.vue | Places an icon, text or button beside the input of its group. |
| InputGroupButton | InputGroupButton.vue | Lets the user act on the input of its group, such as submit it. |
| InputGroupInput | InputGroupInput.vue | Lets the user enter a single line of text inside the group. |
| InputGroupText | InputGroupText.vue | Shows fixed text, such as a unit or prefix, inside the group. |
| InputGroupTextarea | InputGroupTextarea.vue | Lets the user enter several lines of text inside the group. |
Anatomy
<InputGroup>
<InputGroupInput />
<InputGroupAddon>
<InputGroupButton />
</InputGroupAddon>
</InputGroup>Styling
All of Input Group’s styles live in input-group.json. New to styling in Frontic UI? How styling works →
Install
- npm packages
- class-variance-authority
- reka-ui
Built from
API reference
Groups an input with addons such as icons, buttons or text. Renders a <div>.
Props 4
| Prop | Type | Default | |
|---|---|---|---|
| asChild | boolean | false | |
| |||
| as | AsTag | Component | 'div' | |
| |||
| class | ClassValue | — | |
| |||
| size | InputGroupSize | — | |
| |||
Data attributes 1
| Data attribute | Values | |
|---|---|---|
| data-size | 'md' | 'sm' | |
| ||
Recipe input-group 2 groups
height spacing.102.5rem
display flex
width full
minWidth spacing.00rem
alignItems center
borderBottom :focusWithinborder.focus2px solid #71717a
borderBottomColor :invalidWithincolors.destructive#c70009
height spacing.92.25rem
Input Group
Gift message
1<!-- SPDX-License-Identifier: FSL-1.1-MIT AND MIT -->2<!-- Frontic UI © Frontic · Portions © 2023 unovue (shadcn-vue, MIT) · ui.frontic.com/license -->3<script setup lang="ts">4import { ref } from 'vue'5import {6InputGroup,7InputGroupAddon,8InputGroupText,9InputGroupTextarea,10} from '@/components/ui/input-group'1112const limit = 20013const message = ref('')14</script>1516<template>17<InputGroup class="max-w-sm">18<InputGroupTextarea19v-model="message"20:maxlength="limit"21placeholder="Add a gift message"22aria-label="Gift message" />23<InputGroupAddon align="block-end">24<InputGroupText class="ms-auto"25>{{ message.length }}/{{ limit }}</InputGroupText26>27</InputGroupAddon>28</InputGroup>29</template>