Files
database-kesiswaan/resources/views/components/form-select.blade.php
T
2026-04-12 06:24:30 +00:00

22 lines
802 B
PHP

@props([
'name',
'label',
'options' => [],
'value' => null,
'placeholder' => '-- Pilih --',
])
<div>
<label for="{{ $name }}" class="mb-2 block text-sm font-medium text-slate-700">{{ $label }}</label>
<select
id="{{ $name }}"
name="{{ $name }}"
{{ $attributes->merge(['class' => 'h-12 w-full rounded-2xl border border-slate-200 bg-white px-4 text-sm text-slate-700 focus:border-indigo-300 focus:outline-none focus:ring-4 focus:ring-indigo-100']) }}
>
<option value="">{{ $placeholder }}</option>
@foreach ($options as $optionValue => $optionLabel)
<option value="{{ $optionValue }}" @selected((string) old($name, $value) === (string) $optionValue)>{{ $optionLabel }}</option>
@endforeach
</select>
</div>