Add select demo to inputgroup

pull/6454/head
Cagatay Civici 2024-09-20 21:15:50 +03:00
parent e6859c5d1d
commit f4ab5fcf21
2 changed files with 85 additions and 13 deletions

View File

@ -2,7 +2,7 @@
<DocSectionText v-bind="$attrs"> <DocSectionText v-bind="$attrs">
<p>A group is created by wrapping the input and add-ons with the <i>InputGroup</i> component. Each add-on element is defined as a child of <i>InputGroupAddon</i> component.</p> <p>A group is created by wrapping the input and add-ons with the <i>InputGroup</i> component. Each add-on element is defined as a child of <i>InputGroupAddon</i> component.</p>
</DocSectionText> </DocSectionText>
<div class="card flex flex-col md:flex-row gap-4"> <div class="card grid grid-cols-1 md:grid-cols-2 gap-4">
<InputGroup> <InputGroup>
<InputGroupAddon> <InputGroupAddon>
<i class="pi pi-user"></i> <i class="pi pi-user"></i>
@ -20,6 +20,13 @@
<InputGroupAddon>www</InputGroupAddon> <InputGroupAddon>www</InputGroupAddon>
<InputText v-model="text2" placeholder="Website" /> <InputText v-model="text2" placeholder="Website" />
</InputGroup> </InputGroup>
<InputGroup>
<InputGroupAddon>
<i class="pi pi-map"></i>
</InputGroupAddon>
<Select v-model="selectedCity" :options="cities" optionLabel="name" placeholder="City" />
</InputGroup>
</div> </div>
<DocSectionCode :code="code" /> <DocSectionCode :code="code" />
</template> </template>
@ -31,71 +38,136 @@ export default {
text1: null, text1: null,
text2: null, text2: null,
number: null, number: null,
selectedCity: null,
cities: [
{ name: 'New York', code: 'NY' },
{ name: 'Rome', code: 'RM' },
{ name: 'London', code: 'LDN' },
{ name: 'Istanbul', code: 'IST' },
{ name: 'Paris', code: 'PRS' }
],
code: { code: {
basic: ` basic: `
<InputGroup> <InputGroup>
<InputGroupAddon> <InputGroupAddon>
<i class="pi pi-user"></i> <i class="pi pi-user"></i>
</InputGroupAddon> </InputGroupAddon>
<InputText placeholder="Username" /> <InputText v-model="text1" placeholder="Username" />
</InputGroup> </InputGroup>
<InputGroup> <InputGroup>
<InputGroupAddon>$</InputGroupAddon> <InputGroupAddon>$</InputGroupAddon>
<InputNumber placeholder="Price" /> <InputNumber v-model="number" placeholder="Price" />
<InputGroupAddon>.00</InputGroupAddon> <InputGroupAddon>.00</InputGroupAddon>
</InputGroup> </InputGroup>
<InputGroup> <InputGroup>
<InputGroupAddon>www</InputGroupAddon> <InputGroupAddon>www</InputGroupAddon>
<InputText placeholder="Website" /> <InputText v-model="text2" placeholder="Website" />
</InputGroup>
<InputGroup>
<InputGroupAddon>
<i class="pi pi-map"></i>
</InputGroupAddon>
<Select v-model="selectedCity" :options="cities" optionLabel="name" placeholder="City" />
</InputGroup> </InputGroup>
`, `,
options: ` options: `
<template> <template>
<div class="card flex flex-col md:flex-row gap-4"> <div class="card grid grid-cols-1 md:grid-cols-2 gap-4">
<InputGroup> <InputGroup>
<InputGroupAddon> <InputGroupAddon>
<i class="pi pi-user"></i> <i class="pi pi-user"></i>
</InputGroupAddon> </InputGroupAddon>
<InputText placeholder="Username" /> <InputText v-model="text1" placeholder="Username" />
</InputGroup> </InputGroup>
<InputGroup> <InputGroup>
<InputGroupAddon>$</InputGroupAddon> <InputGroupAddon>$</InputGroupAddon>
<InputNumber placeholder="Price" /> <InputNumber v-model="number" placeholder="Price" />
<InputGroupAddon>.00</InputGroupAddon> <InputGroupAddon>.00</InputGroupAddon>
</InputGroup> </InputGroup>
<InputGroup> <InputGroup>
<InputGroupAddon>www</InputGroupAddon> <InputGroupAddon>www</InputGroupAddon>
<InputText placeholder="Website" /> <InputText v-model="text2" placeholder="Website" />
</InputGroup>
<InputGroup>
<InputGroupAddon>
<i class="pi pi-map"></i>
</InputGroupAddon>
<Select v-model="selectedCity" :options="cities" optionLabel="name" placeholder="City" />
</InputGroup> </InputGroup>
</div> </div>
</template> </template>
<script>
export default {
data() {
return {
text1: null,
text2: null,
number: null,
selectedCity: null,
cities: [
{ name: 'New York', code: 'NY' },
{ name: 'Rome', code: 'RM' },
{ name: 'London', code: 'LDN' },
{ name: 'Istanbul', code: 'IST' },
{ name: 'Paris', code: 'PRS' }
]
}
}
}
<\/script>
`, `,
composition: ` composition: `
<template> <template>
<div class="card flex flex-col md:flex-row gap-4"> <div class="card grid grid-cols-1 md:grid-cols-2 gap-4">
<InputGroup> <InputGroup>
<InputGroupAddon> <InputGroupAddon>
<i class="pi pi-user"></i> <i class="pi pi-user"></i>
</InputGroupAddon> </InputGroupAddon>
<InputText placeholder="Username" /> <InputText v-model="text1" placeholder="Username" />
</InputGroup> </InputGroup>
<InputGroup> <InputGroup>
<InputGroupAddon>$</InputGroupAddon> <InputGroupAddon>$</InputGroupAddon>
<InputNumber placeholder="Price" /> <InputNumber v-model="number" placeholder="Price" />
<InputGroupAddon>.00</InputGroupAddon> <InputGroupAddon>.00</InputGroupAddon>
</InputGroup> </InputGroup>
<InputGroup> <InputGroup>
<InputGroupAddon>www</InputGroupAddon> <InputGroupAddon>www</InputGroupAddon>
<InputText placeholder="Website" /> <InputText v-model="text2" placeholder="Website" />
</InputGroup>
<InputGroup>
<InputGroupAddon>
<i class="pi pi-map"></i>
</InputGroupAddon>
<Select v-model="selectedCity" :options="cities" optionLabel="name" placeholder="City" />
</InputGroup> </InputGroup>
</div> </div>
</template> </template>
<script setup>
import { ref } from 'vue';
const text1 = ref(null);
const text2 = ref(null);
const number = ref(null);
const selectedCity = ref();
const cities = ref([
{ name: 'New York', code: 'NY' },
{ name: 'Rome', code: 'RM' },
{ name: 'London', code: 'LDN' },
{ name: 'Istanbul', code: 'IST' },
{ name: 'Paris', code: 'PRS' }
]);
<\/script>
` `
} }
}; };

View File

@ -101,7 +101,7 @@ export default {
</div> </div>
</template> </template>
<script setup> <script>
export default { export default {
data() { data() {
return { return {