Docs (4.0.0)
class Binding method

matches

Adds a filter, to compare the bound value and replace it with true or false.

matches(...values: any[]): Binding<boolean>

Summary

This method can be used to substitute the bound value with true or false. If the original value matches at least one of the provided values, it’s replaced with true; otherwise with false.

To do the opposite, and substitute with false if any of the provided values match, use the not() method afterwards (see example).

Parameters

  • values — A list of values to compare the bound value to

Return value

A new binding, typed as a boolean

Examples

// A cell that's rendered only if a string matches
ui.conditional(
  { state: bound("tab").matches("contacts") },
  ui.cell(
    // ...
  )
)
// A cell that's hidden if a string doesn't match
ui.cell(
  { hidden: bound("tab").matches("contacts").not() },
  // ...
)

Related