Skip to content

Kirby 3.5.7.1

Select Field

<k-select-field>

<k-select-field
    v-model="value"
    :options="[
        { value: 'a', text: 'Option A' },
        { value: 'b', text: 'Option B' }
    ]"
    :required="true"
    label="Select"
    name="select"
    help="This is a select field"
    @input="input"
/>

Props

after

String (default: null)

Text that is shown after the input (right before the icon)

autofocus

Boolean (default: false)

If true, the field will be instantly focused when the form is created

before

String (default: null)

Text that is shown before the input

disabled

Boolean (default: false)

If true, the field is disabled and cannot be filled in or edited

empty

String (default: "-")

The text, that is shown as the first empty option, when the field is not required.

help

String (default: null)

Sets the help text below the field

icon

String (default: null)

Sets the icon, that is shown on the right next to the input.

label

String (default: null)

Sets the label text for the field.

name

String (default: null)

The name of the field must be defined to get fields in fieldsets up and running.

options

Array (default: null)

Defines all options that are available. Options must be defined as an array of objects:

[
  { value: 'a', text: 'Option A' },
  { value: 'b', text: 'Option B' },
  { value: 'c', text: 'Option C' }
]

placeholder

String (default: "-")

The text, that is shown when now option is selected yet.

required

Boolean (default: false)

If true, the field must not be empty

value / v-model

String|Number|Boolean (default: null)

Methods

focus()

Set the focus on the field.

Events

@input

The input event is triggered when the value changes.

CSS class

.k-select-field