Skip to content

Commit

Permalink
feat: improved autocomplete with dropdown
Browse files Browse the repository at this point in the history
More consistent to listbox
  • Loading branch information
JohnCampionJr committed Nov 3, 2023
1 parent 97d3e13 commit c1c3851
Show file tree
Hide file tree
Showing 11 changed files with 418 additions and 33 deletions.
1 change: 1 addition & 0 deletions .playground/components/Footer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<div class="m-5 flex justify-center gap-3 text-xl text-gray-400">
<NuxtLink to="/">Standard Inputs</NuxtLink>
<NuxtLink to="/pro">Pro Inputs</NuxtLink>
<NuxtLink to="/dropdowns">Dropdowns</NuxtLink>
<NuxtLink class="i-carbon-campsite" to="/" />
<DarkToggle />
</div>
Expand Down
162 changes: 162 additions & 0 deletions .playground/pages/dropdowns.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
<script setup lang="ts">
const formModel = ref({
participants: null,
framework: null,
frameworks: [],
})
const frameworks = [
{ label: 'React', value: 'react1' },
{ label: 'Vue', value: 'vue2' },
{ label: 'Angular', value: 'angular3' },
{ label: 'Svelte', value: 'svelte4' },
]
const people = ref([
'John Brown',
'Anita Smith',
'Belen Rodriguez',
'Sammy Lee',
'Hermann Schmidt',
'Chloe Varley',
])
</script>

<template>
<div>
<BaseThemeToggle></BaseThemeToggle>
<div class="grid grid-cols-2 gap-4">
<div>
<BaseHeading>Comboboxes with string arrays</BaseHeading>
<BaseAutocomplete
dropdown
:items="people"
v-model.prop="formModel.participants"
label="Framework Combobox No Custom"
placeholder="Select participants"
/>
<BaseAutocomplete
dropdown
:items="people"
v-model.prop="formModel.participants"
label="Framework Combobox Custom"
allow-custom
placeholder="Select participants"
/>
<BaseAutocomplete
dropdown
:items="people"
v-model.prop="formModel.participants"
label="Framework Combobox Custom, Hidden Prompt"
allow-custom
hide-custom-prompt
placeholder="Select participants"
/>
<FormKit
type="autocomplete"
dropdown
:options="people"
v-model.prop="formModel.participants"
label="Formkit: Framework Combobox Custom, Hidden Prompt"
allow-custom
hide-custom-prompt
placeholder="Select participants"
/>
<BaseHeading>Comboboxes with object arrays</BaseHeading>
<BaseAutocomplete
dropdown
:items="frameworks"
v-model.prop="formModel.framework"
label="Framework Combobox No Custom"
placeholder="Select a framework"
:properties="{
value: 'value',
label: 'label',
}"
/>
<BaseAutocomplete
dropdown
:items="frameworks"
v-model.prop="formModel.framework"
label="Framework Combobox Allow Custom"
placeholder="Select a framework"
allow-custom
:properties="{
value: 'value',
label: 'label',
}"
/>
<BaseAutocomplete
dropdown
:items="frameworks"
v-model.prop="formModel.framework"
label="Framework Combobox Allow Custom, No Prompt"
placeholder="Select a framework"
allow-custom
hide-custom-prompt
clearable
:properties="{
value: 'value',
label: 'label',
}"
/>
<FormKit
type="combobox"
:options="frameworks"
v-model.prop="formModel.framework"
label="FormKit: Framework Combobox Allow Custom, No Prompt"
placeholder="Select a framework"
allow-custom
hide-custom-prompt
:properties="{
value: 'value',
label: 'label',
}"
/>
<BaseHeading
>Comboboxes with object arrays, multiple selection</BaseHeading
>
<BaseAutocomplete
dropdown
multiple
:items="frameworks"
v-model.prop="formModel.frameworks"
label="Framework Combobox No Custom"
placeholder="Select a framework"
:properties="{
value: 'value',
label: 'label',
}"
/>
<FormKit
type="autocomplete"
dropdown
multiple
:options="frameworks"
v-model="formModel.frameworks"
label="Formkit: Autocomplete Dropdown No Custom"
placeholder="Select a framework"
clearable
:properties="{
value: 'value',
label: 'label',
}"
/>
<BaseListbox
multiple
:items="frameworks"
v-model.prop="formModel.frameworks"
label="Framework Combobox No Custom"
placeholder="Select a framework"
:properties="{
value: 'value',
label: 'label',
}"
/>

<ClientOnly>
<pre> {{ formModel }}</pre>
</ClientOnly>
</div>
</div>
</div>
</template>
Loading

0 comments on commit c1c3851

Please sign in to comment.