Type: function

By default, the widget displays any contacts that have one or more email addresses. This is typically great if you are using the widget in a context that requires an email address. However, you might want to change this if you are interested in other data, like mailing addresses or if you want to even further restrict the choices of the user. Enter the filter option.

This option lets you decide which contacts are displayed in the widget by providing your own function that will decide whether to show it or not.

Your filter function must accept a contact object and return true to have it included in the display.

For example, to include contacts with an email address with an “example.com” domain:

  filter: function(contact) {
    return !!(contact.email && contact.email.find(function(email) {
      return email.address.match(/@example.com$/);

Our default filter function returns true if there is at least one email associated with the contact:

  filter: function(contact) { return !!contact.email.length }