---
title: "Dependency Selector Syntax"
description: "Documentation for the vlt client and the vlt registry."
url: "https://docs.vlt.io/client/selectors"
image: "https://docs.vlt.io/og/client/selectors"
lang: "en"
---

# Dependency Selector Syntax

The vlt query syntax enables usage of CSS-selector-like strings to filter and select packages in your dependency graph.

```bash title="Terminal"
$ vlt query ':root > [name^=@vltpkg]'
```

Many of the common elements of the CSS language are available, notably:

- `*` Universal selector — matches all selected items.
- `&` Nesting selector — allows for nesting selectors.
- `{}` Curly braces — when querying, can be used to nest selectors.

## Quick Reference

| Category                                                                           | Examples                                      | Description                                      |
| ---------------------------------------------------------------------------------- | --------------------------------------------- | ------------------------------------------------ |
| [Attribute Selectors](https://docs.vlt.io/client/selectors/attribute-selectors.md) | `[name=foo]`, `[version^=2]`                  | Match by `package.json` metadata                 |
| [Combinators](https://docs.vlt.io/client/selectors/combinators.md)                 | `>`, ``, `~`                                  | Traverse the dependency graph                    |
| [ID Selectors](https://docs.vlt.io/client/selectors/id-selectors.md)               | `#foo`                                        | Shortcut for `[name=foo]`                        |
| [Pseudo-class Selectors](https://docs.vlt.io/client/selectors/pseudo-classes.md)   | `:has()`, `:outdated()`, `:semver()`          | Functional selectors with arguments              |
| [Pseudo-state Selectors](https://docs.vlt.io/client/selectors/pseudo-states.md)    | `:root`, `:workspace`, `:dev`                 | State-based selectors                            |
| [Security Insights](https://docs.vlt.io/client/selectors/security-insights.md)     | `:malware`, `:vuln()`, `:cve()`, `:license()` | Security data from [Socket](https://socket.dev/) |

## Selector Categories

[**Attribute Selectors** Match packages by package.json fields like name, version, or any custom property.](https://docs.vlt.io/client/selectors/attribute-selectors.md) [**Combinators** Traverse the dependency graph with child, descendant, and sibling combinators.](https://docs.vlt.io/client/selectors/combinators.md) [**ID Selectors** Quick shorthand to select packages by name.](https://docs.vlt.io/client/selectors/id-selectors.md) [**Pseudo-class Selectors** Functional selectors like :has(), :outdated(), :semver(), :type(), and more.](https://docs.vlt.io/client/selectors/pseudo-classes.md) [**Pseudo-state Selectors** State-based selectors like :root, :workspace, :dev, :prod, :private.](https://docs.vlt.io/client/selectors/pseudo-states.md) [**Security Insights** Socket-powered security selectors for malware, CVEs, obfuscation, and more.](https://docs.vlt.io/client/selectors/security-insights.md)

## Examples

Find all outdated direct dependencies:

```bash title="Terminal"
$ vlt query ':root > :outdated'
```

Find all packages that depend on a vulnerable package:

```bash title="Terminal"
$ vlt query ':has(:cve)'
```

Find all dev-only dependencies that use eval:

```bash title="Terminal"
$ vlt query ':dev:eval'
```

Combine multiple selectors:

```bash title="Terminal"
$ vlt query ':workspace > :type(git), :root > :outdated(major)'
```
