# add-dependency

Learn how to add packages to a project.

This action adds packages to the project using the detected package manager.

For example, you can install libraries required by downloaded components or additional tooling needed for the setup.

## Example

The following template adds runtime and development dependencies:

**template.json5**

```json5
{
  "$schema": "https://schema.croct.com/json/v1/template.json",
  "title": "Dependency setup",
  "description": "Adds project dependencies.",
  "actions": [
    {
      "name": "add-dependency",
      "dependencies": [
        "zod",
        "lucide-react"
      ]
    },
    {
      "name": "add-dependency",
      "dependencies": ["tailwindcss"],
      "development": true
    }
  ]
}
```

To apply this template, run:

```sh
croct use template.json5
```

## Properties

These are the supported properties:

- `name`: `string`

  The action identifier. Always `add-dependency` for this action.

- `dependencies`: `Array<string>`

  The list of packages to add.

  You can include version specifiers, for example `tailwindcss@4`.

- `development`: `boolean` (optional) (default: false)

  Whether to add the packages as development dependencies.

## Explore

- [Check dependency](/reference/cli/templates/actions/check-dependency): Learn how to check if a dependency is installed.
- [Install](/reference/cli/templates/actions/install): Learn how to install project dependencies.
- [Add component](/reference/cli/templates/actions/add-component): Learn how to install components into the project.
- [Execute package](/reference/cli/templates/actions/execute-package): Learn how to run a package binary command.
