---
title: Actions reference
description: Browse the built-in actions in Nordcraft. Actions in Nordcraft are reusable JavaScript functions that allow you to extend the platform's functionality.
---

# Actions reference

Browse the built-in actions in Nordcraft. Actions in Nordcraft are reusable JavaScript functions that allow you to extend the platform's functionality. Actions are available in [workflows](/workflows/overview) and [event callbacks](/actions/overview#events).

::: tip
To learn more about actions, check out the [actions overview](/actions/overview).
:::

## Clear local storage

Delete all values in local storage.

## Clear session storage

Delete all values in session storage.

## Copy to clipboard

Copy contents to the clipboard.

**Arguments**

| Name  | Type   | Description                 |
| ----- | ------ | --------------------------- |
| Value | String | The value you want to copy. |

## Delete from local storage

Delete a value from local storage (if found) based on the provided key.

**Arguments**

| Name | Type   | Description                         |
| ---- | ------ | ----------------------------------- |
| Key  | String | The key in local storage to delete. |

## Delete from session storage

Delete a value from session storage (if found) based on the provided key.

**Arguments**

| Name | Type   | Description                           |
| ---- | ------ | ------------------------------------- |
| Key  | String | The key in session storage to delete. |

## Focus

Move focus to a DOM element.

**Arguments**

| Name           | Type    | Description                                |
| -------------- | ------- | ------------------------------------------ |
| Element        | Element | The DOM element that should receive focus. |
| Prevent scroll | String  | Prevent scrolling to the focused element.  |

## Go to URL

Navigate to a specified URL.

**Arguments**

| Name | Type   | Description             |
| ---- | ------ | ----------------------- |
| URL  | String | The URL to navigate to. |

## Interval

Run an action every "delay" milliseconds.

**Arguments**

| Name                     | Type   | Description           |
| ------------------------ | ------ | --------------------- |
| Interval in milliseconds | Number | The interval "delay". |

## Log to console

Log a message to the browser console.

**Arguments**

| Name  | Type | Description                              |
| ----- | ---- | ---------------------------------------- |
| Label |      | A label for the message.                 |
| Data  | Any  | The data you want to log to the console. |

## Prevent default

Prevent default browser behavior for this event.

## Save to local storage

Save a provided key/value to local storage by JSON encoding the value.

**Arguments**

| Name  | Type   | Description                                                                                                                            |
| ----- | ------ | -------------------------------------------------------------------------------------------------------------------------------------- |
| Key   | String | The key to be used in local storage.                                                                                                   |
| Value | Any    | The value that should be saved in local storage. This can be anything that is serializable (String, Number, Boolean, Array or Object). |

## Save to session storage

Save a provided key/value to session storage by JSON encoding the value.

**Arguments**

| Name  | Type   | Description                                                                                                                              |
| ----- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------- |
| Key   | String | The key to be used in session storage.                                                                                                   |
| Value | Any    | The value that should be saved in session storage. This can be anything that is serializable (String, Number, Boolean, Array or Object). |

## Set HttpOnly cookie

Save a key/value pair as an Http-Only cookie. Useful for storing JWTs or other tokens.

**Arguments**

| Name               | Type    | Description                                                                                                                                                                                                   |
| ------------------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Name               | String  | The name of the cookie.                                                                                                                                                                                       |
| Value              | String  | The value to be stored in the cookie.                                                                                                                                                                         |
| Expires in         | Number  | (Optional) Time in seconds until the cookie expires. This should be null for JWTs to use the JWT's expiration. If not provided, the cookie will be a session cookie. If set to 0, the cookie will be deleted. |
| SameSite           | String  | (Optional) The SameSite attribute of the cookie. Defaults to Lax.                                                                                                                                             |
| Path               | String  | (Optional) The Path attribute of the cookie. Defaults to /.                                                                                                                                                   |
| Include Subdomains | Boolean | (Optional) Whether to include subdomains when setting the cookie. Defaults to true.                                                                                                                           |

## Set cookie

Save a key/value pair as a non-http-only cookie (readable on the client). Useful for storing user preferences.

**Arguments**

| Name               | Type    | Description                                                                                                                    |
| ------------------ | ------- | ------------------------------------------------------------------------------------------------------------------------------ |
| Name               | String  | The name of the cookie.                                                                                                        |
| Value              | String  | The value to be stored in the cookie.                                                                                          |
| Expires in         | Number  | (Optional) Time in seconds until the cookie expires. If this is null, the cookie will expire at the end of the user's session. |
| SameSite           | String  | (Optional) The SameSite attribute of the cookie. Defaults to Lax.                                                              |
| Path               | String  | (Optional) The Path attribute of the cookie. Defaults to /.                                                                    |
| Include Subdomains | Boolean | (Optional) Whether to include subdomains when setting the cookie. Defaults to true.                                            |

## ~~Set session cookies~~

**Deprecated**: Use [Set HttpOnly cookie](/references/actions#set-httponly-cookie) instead. Save authentication tokens as session cookies.

**Arguments**

| Name         | Type   | Description                                                                                                        |
| ------------ | ------ | ------------------------------------------------------------------------------------------------------------------ |
| Access token | String | Access tokens are the most common way to authenticate with a server.                                               |
| Expires in   | Number | (Optional) Time in seconds until the token expires. Defaults to 3600 (1 hour). This should be left blank for JWTs. |

## Set theme

Sets the application theme. Call with null to reset. This action automatically sets a theme-cookie so the theme persists across sessions. Note: This action is currently only supported when the "style-variables-v2" feature flag is enabled.

**Arguments**

| Name | Type   | Description            |
| ---- | ------ | ---------------------- |
| Name | String | The name of the theme. |

## Share

Share data with title, text, and/or URL using the Navigator.share API.

**Arguments**

| Name  | Type   | Description         |
| ----- | ------ | ------------------- |
| URL   | String | The URL to share.   |
| Title | String | The title to share. |
| Text  | String | The text to share.  |

## Sleep

Run an action after a delay.

**Arguments**

| Name                  | Type   | Description                                                      |
| --------------------- | ------ | ---------------------------------------------------------------- |
| Delay in milliseconds | Number | The number of milliseconds to wait before an action is executed. |

## Stop propagation

Stop the event from bubbling up the DOM to parent elements.
