yale-user-access/packages/frontend/components/yale/FormSelect.vue
Liam Pietralla f577617b4d
All checks were successful
Build and Publish / Build Yale Access Backend (push) Successful in 28s
Build and Publish / Build Yale Access Frontend (push) Successful in 47s
Build and Publish / Push Yale Access Backend Docker Image (push) Successful in 9s
Build and Publish / Push Yale Access Frontend Docker Image (push) Successful in 10s
initial commit
2025-01-10 08:37:18 +11:00

27 lines
799 B
Vue

<script setup lang="ts">
const props = defineProps<{
options: Array<{ label: string; value: string }>,
placeholder: string,
modelValue: string
}>();
const emit = defineEmits([
'update:modelValue'
]);
const handleSelect = (event: Event) => {
emit('update:modelValue', (event.target as HTMLSelectElement).value);
};
</script>
<template>
<select class="bg-zinc-900 p-2 rounded-md" :value="props.modelValue" @change="handleSelect">
<!-- Placeholder as the first option -->
<option value="" disabled selected>{{ props.placeholder }}</option>
<!-- Render options dynamically -->
<option v-for="option in props.options" :key="option.value" :value="option.value">
{{ option.label }}
</option>
</select>
</template>