# ★ Attribute() constructor

## `Attribute()`

Creates a new [`Attribute`](https://tag.angular-package.dev/attribute/attribute) instance with the **name** and **value**.

{% code title="attribute.class.ts" %}

```typescript
constructor(name: Name, value: Value) {
  super(Attribute.template`${name}${value}`);
  this.#name = String(name) as Name;
  this.#value = String(value) as Value;
}
```

{% endcode %}

### Parameters

<table><thead><tr><th width="173.44477578337126">Name: type</th><th>Description</th></tr></thead><tbody><tr><td><code>name: Name</code></td><td>The attribute name of a generic type variable <code>Name</code>.</td></tr><tr><td><code>value: Value</code></td><td>The attribute value of a generic type variable <code>Value</code>.</td></tr></tbody></table>

### Returns

The **return value** is a new [`Attribute`](https://tag.angular-package.dev/attribute/attribute) instance with the primitive value of the provided `name` and `value` on the template `${Name}="${Value}"`.

### Example usage

```typescript
// Example usage.
import { Attribute } from '@angular-package/tag';

// Returns Attribute {'color="red"'} of type Attribute<"color", "red">.
new Attribute('color', 'red');
```
