Skip to content

Commit

Permalink
feat(j-components): add j-v-select component
Browse files Browse the repository at this point in the history
  • Loading branch information
phojie committed Nov 24, 2022
1 parent 65cbcf0 commit 8f0ef6f
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions resources/js/j-components/JVSelect.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<script setup lang="ts">
interface VSelect {
modelValue: any
options: Array<string | object>
placeholder?: string
multiple?: boolean
closeOnSelect?: boolean
deselectFromDropdown?: boolean
// extended
id?: string
label?: string
selectedLabel?: string
isError?: boolean
isDisabled?: boolean
isReadOnly?: boolean
isLoading?: boolean
}
const props = withDefaults(defineProps<VSelect>(), {
})
const emit = defineEmits(['update:modelValue'])
const value = useVModel(props, 'modelValue', emit)
</script>

<template>
<div>
<!-- label -->
<label
v-if="label"
class="block mb-1 text-sm font-medium text-gray-900"
>
{{ label }}
</label>

<!-- input wrapper -->
<div>
<VSelect
v-model="value"
:placeholder="placeholder"
class="j-input-select"
:label="selectedLabel"
:multiple="multiple"
:options="options"
:close-on-select="closeOnSelect"
:deselect-from-dropdown="deselectFromDropdown"
/>
</div>
</div>
</template>

0 comments on commit 8f0ef6f

Please sign in to comment.