input-group
Textarea input group with dynamic character limit
Textarea input group with dynamic character limit
Загрузка превью…
src/input-group/c-input-group-17.vue
<!--
Расхождение с апстримом: `IconPlaceholder` заменена инлайновым `<svg>`
(lucide-react v0.545.0 "info") — см. docs/PORTING.md §5.
-->
<script setup lang="ts">
import { ref } from "vue"
import { Field } from "@/components/ui/field"
import { InputGroup, InputGroupAddon, InputGroupText, InputGroupTextarea } from "@/components/ui/input-group"
const value = ref("")
const maxLength = 140
</script>
<template>
<Field class="max-w-xs">
<InputGroup>
<InputGroupTextarea
v-model="value"
placeholder="Description..."
:maxlength="maxLength"
class="min-h-16 pb-12"
/>
<InputGroupAddon align="block-end">
<InputGroupText class="text-muted-foreground text-xs">{{ `${value.length}/${maxLength} characters` }}</InputGroupText>
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
class="lucide lucide-info text-muted-foreground ml-auto"
>
<circle cx="12" cy="12" r="10" />
<path d="M12 16v-4" />
<path d="M12 8h.01" />
</svg>
</InputGroupAddon>
</InputGroup>
</Field>
</template>
Установка
npx shadcn-vue@latest add https://revueui.rootapi.dev/r/c-input-group-17.jsonЗависимости реестра
Источник: порт из ReUI (Keenthemes, MIT)