Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Labels

Label

A label in FigX is the same concept as a label in Bazel.

A label in FigX is a canonical identifier for a resource or package within a workspace. It follows the format:

//path/to/package:resource-name

where:

  • // refers to the root of the FigX workspace
  • path/to/package is the relative path to the package containing the resource
  • resource-name is the name of the resource defined in .fig.toml.

Labels are used to reference resources unambiguously across different packages.

Label matching

Each resource defined in a fig-file (.fig.toml) has a label, which is made up of the package path and the resource name.

Example

Let’s say you have two fig-files:

Root-level .fig.toml:

[svg]
ic_crab = "Icons/Crab"

Inside foo/bar/.fig.toml:

[svg]
ic_star = "Icons/Star"

Now your workspace contains two resources with the following labels:

  • //:ic_crab — located at the root of the workspace
  • //foo/bar:ic_star — located in the foo/bar package

Label Patterns

Most FigX commands accept label patterns that define which resources to operate on. This pattern matching works similarly to how it's done in Bazel or Buck2.

For example:

  • figx import //...
    → Matches all resources in the workspace (recursive wildcard)

  • figx import //:all
    → Matches only resources in the root package (non-recursive)

  • figx import //foo/bar:ic_star
    → Matches a single, specific resource

  • figx import //foo/...
    → Matches all resources under foo/, including nested packages

Why it’s like Bazel

This label syntax is inspired by the build system Bazel, and follows a similar convention. You can learn more about label patterns in Bazel’s official docs here:

📖 Bazel — Target patterns