Skip to content

zk-select ​

Renders a <select> element with optional optgroup support, default placeholder option, and validation integration.

Props ​

PropTypeDefaultDescription
namestring|nullnullname attribute
idstring|nullnullid — falls back to name
optionsarray[]Key-value pairs. Nested arrays create <optgroup>
selectedmixednullPre-selected value — uses old() automatically
multipleboolfalseMulti-select — appends [] to name
requiredboolfalseAdds required and aria-required="true"
disabledboolfalseAdds disabled attribute
autofocusboolfalseAdds autofocus attribute
formstring|nullnullAssociates with a form by id
labelstring|nullnullLabel text
labelBeforebooltruePlace the label before the select; set false for label-after
classstring|nullnullCSS class(es) on the <select> element
fieldbooltrueWrap in field structure
fieldClassstring|nullnullCSS class(es) on the field wrapper
iconBeforestring|nullnullLeading icon
iconAfterstring|nullconfig('blade-components.select.icon_after')Trailing icon — defaults to keyboard_arrow_down
supportingTextstring|nullnullHelper text below the field
supportingCounterstring|nullnullCounter text

Examples ​

Basic ​

blade
<x-zk-select
    name="country"
    label="Country"
    :options="['fr' => 'France', 'de' => 'Germany', 'gb' => 'United Kingdom']"
    :selected="$user->country" />

With optgroups ​

blade
<x-zk-select
    name="timezone"
    label="Timezone"
    :options="[
        'Europe' => ['Europe/Paris' => 'Paris', 'Europe/London' => 'London'],
        'America' => ['America/New_York' => 'New York', 'America/Chicago' => 'Chicago'],
    ]" />

Required with default placeholder ​

blade
<x-zk-select
    name="role"
    label="Role"
    :options="['admin' => 'Admin', 'user' => 'User']"
    required />
{{-- A blank placeholder option is prepended automatically when required --}}

Multiple select ​

blade
<x-zk-select
    name="tags"
    label="Tags"
    :options="$tags"
    :selected="$post->tags->pluck('id')"
    multiple />

Without trailing icon ​

blade
<x-zk-select name="size" :options="$sizes" :iconAfter="null" />

Notes ​

  • A blank default option is prepended automatically when required is set and all options are within optgroups.
  • Selected value comparison is strict string equality — integer and string keys are both handled correctly.
  • old() is called automatically.

Documentation of 3.2.0 , built from c93e21f on 3.2.0 by pipeline #2919741884 on 2026-10-06.