> ## Documentation Index
> Fetch the complete documentation index at: https://ng-primitives.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Toggle

> Toggle a button on and off.

<iframe style={{ width: '100%', height: '378px', borderRadius: 12 }} src="https://ng-primitives.github.io/ng-primitives/#/examples/toggle" />

## Usage

Assemble the toggle directives in your template.

```html
<div ngpToggle></div>
```

## API Reference

The following directives are available to import from the `@ng-primitives/ng-primitives/toggle` package:

### NgpToggleDirective

There are no inputs or outputs for this directive.

## Global Configuration

You can configure the default options for all toggles in your application by using the `provideNgpToggleConfig` function in a providers array.

```ts
import { provideNgpToggleConfig } from '@ng-primitives/ng-primitives/toggle';

bootstrapApplication(AppComponent, {
  providers: [provideNgpToggleConfig({})],
});
```

### NgpToggleConfig

## Schematics

You can use our schematic to generate a new toggle component.

<CodeGroup>
  ```bash Angular CLI
  ng generate @ng-primitives/ng-primitives:toggle
  ```

  ```bash Nx
  nx generate @ng-primitives/ng-primitives:toggle
  ```
</CodeGroup>

### Options

<ResponseField name="name" type="string">
  The name of the component.
</ResponseField>

<ResponseField name="project" type="string">
  The name of the project to add the component to.
</ResponseField>

<ResponseField name="path" type="string">
  The path to create the component.
</ResponseField>
