# HasDownload

> Provides an immutable API for the download attribute.

[API reference](/docs/api/index.md) › [HTML Attribute](/docs/extensions/html-attribute/reference/index.md) › HasDownload

| trait | `UIAwesome\Html\Attribute\HasDownload` |
| --- | --- |
| Source | [`src/HasDownload.php`](https://github.com/ui-awesome/html-attribute/blob/main/src/HasDownload.php#L18) |

Used by 1 type:

- [`UIAwesome\Html\Palpable\A`](/docs/extensions/html/reference/palpable/a/index.md)

Provides an immutable API for the `download` attribute.

See also: <https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/a#download>.

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`download()`](#method-download) | Sets the `download` attribute. | `HasDownload` |

## Method details

### download() <span id="method-download"></span>

```php
public function download(bool|string|Stringable|UnitEnum|null $value): static
```

Sets the `download` attribute.

Controls whether the linked resource is treated as a download.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$value` | `bool\|string\|`[`Stringable`](https://www.php.net/manual/en/class.stringable.php)`\|`[`UnitEnum`](https://www.php.net/manual/en/class.unitenum.php)`\|null` | Download flag or suggested filename; use `true` to enable downloads without a filename, or `null` to remove the attribute. |

**Returns**

`static`: New instance with the updated `download` attribute.

**See also**

- <https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/a#download>