---
lang: en
title: 'API docs: core.application.component'
keywords: LoopBack 4.0, LoopBack 4, Node.js, TypeScript, OpenAPI
sidebar: lb4_sidebar
editurl: https://github.com/strongloop/loopback-next/tree/master/packages/core
permalink: /doc/en/lb4/apidocs.core.application.component.html
---

<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@loopback/core](./core.md) &gt; [Application](./core.application.md) &gt; [component](./core.application.component.md)

## Application.component() method

Add a component to this application and register extensions such as controllers, providers, and servers from the component.

<b>Signature:</b>

```typescript
component<T extends Component = Component>(componentCtor: Constructor<T>, nameOrOptions?: string | BindingFromClassOptions): Binding<T>;
```

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  componentCtor | [Constructor](./context.constructor.md)<!-- -->&lt;T&gt; | The component class to add. |
|  nameOrOptions | string \| [BindingFromClassOptions](./context.bindingfromclassoptions.md) | Optional component name or options, default to the class name |

<b>Returns:</b>

[Binding](./context.binding.md)<!-- -->&lt;T&gt;

## Example


```ts

export class ProductComponent {
  controllers = [ProductController];
  repositories = [ProductRepo, UserRepo];
  providers = {
    [AUTHENTICATION_STRATEGY]: AuthStrategy,
    [AUTHORIZATION_ROLE]: Role,
  };
};

app.component(ProductComponent);

```


