Matterway
    Preparing search index...

    Function select

    • Select field component for dropdown selection.

      Parameters

      • props: UiSelectFieldProps

        Configuration object

        • name

          Name of the component

        • invalid

          If false/undefined the field is valid. If a string is provided, it will be used as the validation message

        • disabled

          If true, the field is disabled

        • items

          Array of options for the select field

        • label

          Label text

        • placeholder

          Placeholder text

        • required

          If true, the field is required

        • defaultValue

          Default selected value (must be one of the values in items)

      Returns Element

      Simple usage with required props

      select({
      name: 'country',
      label: 'Country',
      items: [
      { value: 'us', label: 'United States' },
      { value: 'uk', label: 'United Kingdom' },
      { value: 'ca', label: 'Canada' }
      ]
      });

      Usage with default value

      select({
      name: 'favoriteColor',
      label: 'Favorite Color',
      placeholder: 'Select your favorite color',
      items: [
      { value: 'red', label: 'Red' },
      { value: 'blue', label: 'Blue' },
      { value: 'green', label: 'Green' }
      ],
      defaultValue: 'blue',
      required: true,
      disabled: false
      });