# Instance accessors

## Public

### `Tag.prototype.attributes`

The [`get`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get) accessor returns the tag attributes if set, otherwise `undefined`.

```typescript
public get attributes(): Attributes | undefined {
  return this.#attributes;
}
```

#### Returns

The **return value** is a tag attributes of an [`Attributes`](https://docs.angular-package.dev/text/main/attributes) if set, or `undefined`.

#### Example usage

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

// Create tag [quote].
const tag = new Tag(`quote`, `<`, `>`, ['color', 'red']);

// Returns
```

### `Tag.prototype.closingTag`

The [`get`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get) accessor gets the [closing tag](https://docs.angular-package.dev/text/basic-concepts#closing-tag) of a generic type [`ClosingTag`](https://docs.angular-package.dev/text/tag/types#closingtag-less-than-name-opening-closing-greater-than).

```typescript
public get closingTag(): ClosingTag<Name, Opening, Closing> {
  return `${this.#wrapper.opening}/${this.#name}${
    this.#wrapper.closing
  }`;
}
```

#### Returns

The **return value** is a tag closing of a generic type [`ClosingTag`](https://docs.angular-package.dev/text/tag/types#closingtag-less-than-name-opening-closing-greater-than).

#### Example usage

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

// Create tag [quote].
const tag = new Tag(`quote`);

// Returns [/quote].
tag.closingTag;
```

### `Tag.prototype.name`

The [`get`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get) accessor gets the tag name without the wrap from the private property [`#name`](https://docs.angular-package.dev/text/tag/instance-properties#name).

```typescript
public get name(): Name {
  return this.#name;
}
```

#### Returns

The **return value** is a tag name of a generic type variables [`Name`](https://docs.angular-package.dev/text/tag/generic-type-variables#tag-less-than-name-...greater-than).

#### Example usage

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

// Create tag [quote].
const tag = new Tag(`quote`);

// Returns quote.
tag.name;
```

### `Tag.prototype.openingTag`

The [`get`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get) accessor gets [the opening](https://docs.angular-package.dev/text/basic-concepts#opening-tag) tag with optional attributes.

```typescript
public get openingTag(): OpeningTag<Name, Chars> {
  return this.tag as OpeningTag<Name, Chars>;
}
```

#### Returns

The **return value** is an opening tag of a generic type [`OpeningTag`](https://docs.angular-package.dev/text/tag/types#openingtag-less-than-name-opening-closing-greater-than).

#### Example usage

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

// Create tag <span color="red">.
const tag = new Tag(`span`, `<`, `>`, ['color', 'red']);

// Returns <span color="red">.
tag.openingTag;
```

### `Tag.prototype.tag`

The [`get`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get) accessor gets the tag consists of the name, opening and closing of the wrap.

```typescript
public get tag(): `${Opening}${Name}${Closing}` {
  return `${this.#wrapper.opening}${this.#name}${
    this.#wrapper.closing
  }`;
}
```

#### Returns

The **return value** is a tag of a generic type variables in order [`Opening`](https://docs.angular-package.dev/text/tag/generic-type-variables#tag-less-than...-opening-...-...greater-than), [`Name`](https://docs.angular-package.dev/text/tag/generic-type-variables#tag-less-than-name-...greater-than) and [`Closing`](https://docs.angular-package.dev/text/tag/generic-type-variables#tag-less-than...-...-closing-...greater-than) on the template.

#### Example usage

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

// Create tag [quote].
const tag = new Tag(`quote`);

// Returns [quote].
tag.tag;
```

### `Tag.prototype.wrapper`

The [`get`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get) accessor gets the wrapper.

```typescript
ppublic get wrapper(): Wrapper<Opening, Closing> {
  return this.#wrapper;
}
```

#### Returns

The **return value** is the [`Wrapper`](https://docs.angular-package.dev/text/wrapper) instance.

#### Example usage

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

// Create tag [quote].
const tag = new Tag(`quote`);

// Returns Wrapper {'[]'}.
tag.wrapper;
```

### `Tag.prototype.value`

The [`get`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get) accessor gets the tag without the attributes.

```typescript
public get value(): string {
  return this.valueOf();
}
```

#### Returns

The **return value** is the tag of a generic type variables in order [`Opening`](https://docs.angular-package.dev/text/tag/generic-type-variables#tag-less-than...-opening-...-...greater-than), [`Name`](https://docs.angular-package.dev/text/tag/generic-type-variables#tag-less-than-name-...greater-than) and [`Closing`](https://docs.angular-package.dev/text/tag/generic-type-variables#tag-less-than...-...-closing-...greater-than) on the template.

#### Example usage

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

// Create tag [quote].
const tag = new Tag(`quote`);

// Returns [quote].
tag.value;
```

### `[Symbol.toStringTag]`

The property, with the help of [`toStringTag`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/toStringTag) of Symbol, changes the default object tag  to `tag` for an instance of the [`Tag`](https://docs.angular-package.dev/text/tag/tag).

{% hint style="info" %}
**Good to know:** The property can be read by the `typeOf()` function of the type package.
{% endhint %}

```typescript
public get [Symbol.toStringTag](): 'tag' {
  return 'tag';
}
```

#### Example usage

```typescript
// Example usage.
import { Tag } from '@angular-package/text';
import { typeOf } from '@angular-package/type';

// Define the tag.
const quoteTag = new Tag('quote');

// Returns 'tag'.
typeOf(quoteTag);
```
