Products · Components

Option

One option in a Select, with its value and the label people see.

Goes inside a Select.

Children: Nothing

Example

Option is used inside Select:

The Select component
view.dml
<Select label="Delivery" placeholder="Choose how" value="{{ delivery }}" onChange="setDelivery">
  <Option value="pickup" label="Pick up in store" />
  <Option value="courier" label="Courier" />
  <Option value="post" label="Post" />
</Select>
controller.ts
export default definePage({
  initialState: { delivery: 'pickup' },
  mutations: {
    setDelivery: (_state, event: ValueEvent) => ({ delivery: event.detail.value }),
  },
});

Props

PropTypeWhat it is
valuestringWhat the Select's onChange sends when the person chooses this option.
labelstringWhat the person sees.
disabledbooleanDims it, and the person can't use it.

Events

None.

Keep reading

On this page