Skip to content

Commit b5271c7

Browse files
authored
Associate label with select (#371)
1 parent 226178b commit b5271c7

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

resources/views/components/select.blade.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
1-
@props(['label', 'options'])
1+
@props([
2+
'id' => 'select-'.Str::random(),
3+
'label',
4+
'options',
5+
])
26
<div {{ $attributes->only('class')->merge(['class' => 'flex border border-gray-200 dark:border-gray-700 overflow-hidden rounded-md focus-within:ring']) }}>
3-
<label class="px-3 flex items-center border-r border-gray-200 dark:border-gray-700 text-xs sm:text-sm text-gray-600 dark:text-gray-300 whitespace-nowrap bg-gray-100 dark:bg-gray-800/50">{{ $label }}</label>
7+
<label
8+
for="{{ $id }}" class="px-3 flex items-center border-r border-gray-200 dark:border-gray-700 text-xs sm:text-sm text-gray-600 dark:text-gray-300 whitespace-nowrap bg-gray-100 dark:bg-gray-800/50">{{ $label }}</label>
49
<select
10+
id="{{ $id }}"
511
{{ $attributes->except('class') }}
612
class="overflow-ellipsis w-full border-0 pl-3 pr-8 py-1 bg-gray-50 dark:bg-gray-800 text-gray-700 dark:text-gray-300 text-xs sm:text-sm shadow-none focus:ring-0"
713
>

0 commit comments

Comments
 (0)