# Loading States
`Unicorn` requires an AJAX request for any component updates, so it is helpful to provide some context to the user that an action is happening.
## Toggling Elements
Elements with the `unicorn:loading` attribute are only visible when an action is in process.
```html
Updating!
```
When the _Update_ button is clicked, the "Updating!" message will show until the action is complete, and then it will re-hide itself.
```{warning}
Loading elements get shown or removed with the [`hidden`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/hidden) attribute. One drawback to this approach is that setting the style `display` property overrides this functionality.
```
You can also hide an element while an action is processed by adding a `remove` modifier.
:::{code} html
:force: true
Not currently updating!
:::
If there are multiple actions that happen in the component, you can show or hide a loading element for a specific action by targeting another element's `id` with `unicorn:target`.
```html
Updating!
Deleting!
```
An element's `unicorn:key` can also be targeted.
```html
Updating!
Deleting!
```
```{note}
An asterisk can be used as wildcard to target more than one element at a time.
:::{code} html
:force: true
Updating!
:::
```
## Toggling Attributes
Elements with an action event can also include an `unicorn:loading` attribute with either an `attr` or `class` modifier.
### attr
Set the specified attribute on the element that is triggering the action.
This example will disable the _Update_ button when it is clicked and remove the attribute once the action is completed.
:::{code} html
:force: true
:::
### class
Add the specified class(es) to the element that is triggering the action.
This example will add `loading` and `spinner` classes to the _Update_ button when it is clicked and remove the classes once the action is completed.
:::{code} html
:force: true
:::
### class.remove
Remove the specified class from the element that is triggering the action.
This example will remove a `active` class from the _Update_ button when it is clicked and add the class back once the action is completed.
:::{code} html
:force: true