# HasDraggable

> Provides an immutable API for the draggable attribute.

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

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

Used by 1 type:

- [`UIAwesome\Html\Core\Element\BaseBlock`](/docs/extensions/html-core/reference/element/baseblock/index.md)

Provides an immutable API for the `draggable` attribute.

See also: <https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/draggable>.

## Methods

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

## Method details

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

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

Sets the `draggable` attribute.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$value` | `bool\|string\|`[`UnitEnum`](https://www.php.net/manual/en/class.unitenum.php)`\|null` | Draggable state. Use `true` or `false`, or `null` to remove the attribute. |

**Returns**

`static`: New instance with the updated `draggable` attribute. [`Draggable`](/docs/extensions/html-attribute/reference/values/draggable/index.md) for predefined enum values.

**Throws**

- [`InvalidArgumentException`](https://www.php.net/manual/en/class.invalidargumentexception.php): if the provided value is not valid.