vlt / docs

  • PricingBenchmarks (opens in new window)Community (opens in new window)Feedback
  • Overview
  • Attribute Selectors
  • Combinators
  • ID Selectors
  • Security Insights
    • Overview
    • :attr()
    • :has()
    • :dist()
    • :host()
    • :is()
    • :not()
    • :outdated()
    • :published()
    • :semver()
    • :spec()
    • :path()
    • :type()
    • :diff()
    • :hostname()
    • :registry()
  • Syntax
  • Examples
  • Compact selector lists
  • Forgiving behavior
  • See also
  1. Client
  2. /
  3. Selectors
  4. /
  5. Pseudo-classes
  6. /
  7. :is()

:is()

The :is() pseudo-class takes a forgiving selector list and matches any element that can be selected by one of the selectors in that list. It works like the CSS :is() selector and is useful for writing compact selectors.

Syntax

Text
:is(<forgiving-selector-list>)

The selector list is forgiving — any invalid selectors in the list are silently ignored rather than causing the entire selector to fail.

Examples

Compact selector lists

Without :is():

Terminal
$ vlt query ':root > [name=react], :root > [name=vue], :root > [name=svelte]'

With :is():

Terminal
$ vlt query ':root > :is([name=react], [name=vue], [name=svelte])'

Both queries produce the same result — direct dependencies named react, vue, or svelte.

Forgiving behavior

Invalid selectors in the list are ignored:

Terminal
$ vlt query ':is([name=react], :nonexistent, [name=vue])'

This still matches react and vue — the :nonexistent pseudo-class is silently skipped.

See also

  • :not() — negation pseudo-class
  • :has() — dependency matching

Previous:host()Next:not()

On this page

  • Syntax
  • Examples
  • Compact selector lists
  • Forgiving behavior
  • See also
Edit this page

Deploy your package on vlt.io

Publish scoped and private packages, manage organizations and access, and give every developer and CI environment a consistent source for public and private JavaScript dependencies.

Publish now