Copyable URL
Put a separate copy action beside a read-only URL.
Components / Forms
Compose a native input with attached actions and shared focus styling.
npx @getweini/cli@latest add input-groupPut a separate copy action beside a read-only URL.
Attach a submit button while leaving the input editable and native.
<script setup lang="ts">
import { ref } from 'vue'
import InputGroup from './components/ui/input-group/InputGroup.vue'
import Input from './components/ui/input/Input.vue'
import Button from './components/ui/button/Button.vue'
const url = ref('https://weini.app/project')
function copyUrl() { navigator.clipboard.writeText(url.value) }
</script>
<template>
<InputGroup>
<Input v-model="url" aria-label="Share URL" />
<template #end><Button variant="ghost" size="sm" @click="copyUrl">Copy</Button></template>
</InputGroup>
</template>The action has its own keyboard stop and name.
<script setup lang="ts">
import { ref } from 'vue'
import InputGroup from './components/ui/input-group/InputGroup.vue'
import Input from './components/ui/input/Input.vue'
import Button from './components/ui/button/Button.vue'
const url = ref('https://weini.app/team')
function copyUrl() { void navigator.clipboard.writeText(url.value) }
</script>
<template>
<InputGroup>
<Input v-model="url" aria-label="Share URL" readonly />
<template #end><Button type="button" variant="ghost" size="sm" @click="copyUrl">Copy</Button></template>
</InputGroup>
</template>Keep native form submission on the attached button.
<script setup lang="ts">
import { ref } from 'vue'
import InputGroup from './components/ui/input-group/InputGroup.vue'
import Input from './components/ui/input/Input.vue'
import Button from './components/ui/button/Button.vue'
const query = ref('')
</script>
<template>
<form action="/search">
<label for="query">Search</label>
<InputGroup size="md">
<Input id="query" v-model="query" name="q" size="md" />
<template #end><Button type="submit" size="sm">Go</Button></template>
</InputGroup>
</form>
</template>The most useful props, models, slots, events, and methods for this component.
| Name | Type | Default or requirement |
|---|---|---|
default | Input or Textarea slot | required |
#start / #end | addon slots | optional |
size | sm | md | lg | md |
invalid / disabled | boolean | false |
The inner control retains its native attributes and Field relationship. Actions are separate tab stops; give icon-only actions accessible labels.