style(form/select): improve select component styling and focus state

- Add focus outline and ring styles to SelectTrigger
- Conditionally apply text color based on modelValue
- Simplify SelectItem template structure
This commit is contained in:
Khafid Prayoga
2025-09-12 15:26:23 +07:00
parent 87c36b94ea
commit 790c76be56
+5 -8
View File
@@ -54,8 +54,10 @@ function onValueChange(value: string) {
<template>
<SelectRoot :model-value="modelValue" @update:model-value="onValueChange">
<SelectTrigger :class="cn('w-full', props.class)">
<SelectValue :placeholder="placeholder || 'Pilih item'" />
<SelectTrigger :class="cn('w-full focus:outline-none focus:ring-1 focus:ring-black bg-white', props.class)">
<SelectValue :placeholder="placeholder || 'Pilih item'" :class="cn(
props.modelValue ? 'text-black' : 'text-muted-foreground',
)" />
</SelectTrigger>
<SelectContent>
@@ -64,12 +66,7 @@ function onValueChange(value: string) {
{{ label }}
</SelectLabel>
<SelectItem
v-for="item in sortedItems"
:key="item.value"
:value="item.value"
class="cursor-pointer"
>
<SelectItem v-for="item in sortedItems" :key="item.value" :value="item.value" class="cursor-pointer">
<div class="flex items-center justify-between w-full">
<span>{{ item.label }}</span>
<span v-if="item.code" class="text-xs text-muted-foreground ml-2">