---
title: "ID Selectors"
description: "Documentation for the vlt client and the vlt registry."
url: "https://docs.vlt.io/client/selectors/id-selectors"
image: "https://docs.vlt.io/og/client/selectors/id-selectors"
lang: "en"
---

# ID Selectors

ID selectors are a shorthand for selecting packages by name. They work like [CSS ID selectors](https://developer.mozilla.org/en-US/docs/Web/CSS/ID_selectors) but match the name a package is installed under.

## Syntax

```
#package-name
```

Matches the name a dependency is installed under, usually the same as `[name=package-name]`. With an alias like `"ab": "npm:abbrev@2.0.0"`, `#ab` selects `abbrev`; a package installed under several names matches each.

**caution**

ID selectors only work for **unscoped** packages. For scoped packages (e.g. `@vltpkg/cli`), use [attribute selectors](https://docs.vlt.io/client/selectors/attribute-selectors.md) instead: `[name=@vltpkg/cli]`.

## Examples

Select a package by name:

```bash title="Terminal"
$ vlt query '#react'
```

This is the same as:

```bash title="Terminal"
$ vlt query '[name=react]'
```

### Combining with combinators

Find all dependencies of `react`:

```bash title="Terminal"
$ vlt query '#react > *'
```

Find direct deps that have `react` as a sibling:

```bash title="Terminal"
$ vlt query '#react ~ *'
```

### Combining with pseudo-classes

Check if a specific package is outdated:

```bash title="Terminal"
$ vlt query '#typescript:outdated'
```

## When to use attribute selectors instead

Use `[name=value]` instead of `#value` when:

- The package is scoped: `[name=@vltpkg/cli]`
- You need partial matching: `[name^=react]` (starts with "react")
- You need case-insensitive matching: `[name=React i]`

## See also

- [Attribute Selectors](https://docs.vlt.io/client/selectors/attribute-selectors.md) — full attribute matching syntax
