Multiple Select

The Multiple Select webview allows users to select multiple options from a list. It functions similarly to the Radio Select webview, but supports multiple selections.

Example usage

The following example demonstrates how to create a Multiple Select webview. In this example, three categories are provided. When a user selects an option, an event is triggered with the corresponding parameter.

async payload => {
  
  const url = await webview.multipleSelect.create({
    ref: 'category',
    title: 'Choose a category',
    eventName: 'select',
    items: [{
      title: 'Audio',
      subtitle: 'Sound, music and noise',
      onSelect: {
        params: new Param('category', 'audio')
      }
    }, {
      title: 'Display',
      subtitle: 'Screen, video and pixels',
      onSelect: {
        params: new Param('category', 'display')
      }
    }, {
      title: 'Camera',
      subtitle: 'Lenses, posture and flashes',
      onSelect: {
        params: new Param('category', 'display')
      }
    }]
  })
  
  const buttons = new Buttons('Select categories')
  buttons.addButton(new Button({
    label: 'Choose categories',
    type: 'webview',
    value: url
  }))

  const message = new Message(`Choose categories ${url}`)
  message.addResponse(buttons)

  return message
}

Properties

When creating a Multiple Select webview, you can configure the following properties:

PropertyTypeExampleDescription
refstringpickup-dateOptional. Identifier to update the webview.
titlestringChoose a dateRequired. The title displayed at the top.
tintstring#FF0000Optional. Tint color is used for the buttons.
searchbooleantrueOptional. Displays a search bar if set to true.
button.labelstringChoose itemOptional. Label for the confirmation button.

Items

The multiple select is based on a number of items. Each individual can contain a title, subtitle, image and onSelect property.

Properties

PropertyTypeExampleDescription
titlestringAwesome PhoneRequired. The main text for the item.
subtitlestringRi10" screen with 12GB memoryOptional. An optional secondary text.
imagestringhttps://.../thumbnail.pngOptional. URL of an image thumbnail to display with the item.
onSelect.eventNamestring"Date selected"Required. Event name triggered when the item is selected.
onSelect.paramParam or arraynew Param('productiId', 112234)Optional. Parameter(s) sent when the item is selected.

Item Examples

Item with image

Each item can include a thumbnail image. The recommended size for thumbnails is at least 80x80 pixels.

const url = await webview.multipleSelect.create({
  ...
  items: [{
    title: 'Audio',
    image: 'https://...',
    onSelect: {
      eventName: 'select',
      params: new Param('category', 'audio')
    }
  }]
  ...
})

Item with subtitle

An item may also include a subtitle to provide additional information.

const url = await webview.multipleSelect.create({
  ...
  items: [{
    title: 'Audio',
    subtitle: 'Sound, music and noise',
    onSelect: {
      eventName: 'select',
      params: new Param('category', 'audio')
    }
  }]
  ...
})

Item with subtitle and image

You can combine both an image and a subtitle for a more descriptive item.

const url = await webview.multipleSelect.create({
  ...
  items: [{
    title: 'Audio',
    image: 'https://...',
    subtitle: 'Sound, music and noise',
    onSelect: {
      eventName: 'select',
      params: new Param('category', 'audio')
    }
  }]
  ...
})

Did this page help you?