---
url: /process-functions/security-application-screentag.md
description: An access tag that controls which screens its users can see.
---

# &#x20;ScreenTag&#x20;

An access tag that controls which screens its users can see.

```js
const app = security.application("My Application");
const tag = app.tags.createScreen("Planner Screens");

tag.set("Planner", true);
tag.addUser("user@example.com");
```

## Constructor

Returned by [createScreen()](/process-functions/security-application-tags#createscreen) and [get()](/process-functions/security-application-tags#get) on an application's [tags](/process-functions/security-application-tags). It can't be created directly.

## Overview

* **Hidden by default:** a new screen tag hides every screen until you show them with [set()](#set).
* **Users:** methods that take a user accept their id, email address or a [User](/process-functions/userSecurity-user).

## Methods

### id `id()`  {#id}

Returns the tag's id.

### name `name()`  {#name}

Returns the tag's name.

### type `type()`  {#type}

Returns `"screen"`.

### access `access()`  {#access}

Returns the tag's screen entries. Each key is a screen title and each value is `true` when the screen is visible.

### set `set(screenIdOrTitle, visible)`  {#set}

Shows or hides a screen for the tag's users. Returns `false` when the screen can't be found.

| Parameter | Type | Description |
|---|---|---|
| `screenIdOrTitle` | `string` | The screen's id or title. |
| `visible` | `boolean` | `true` to show the screen, `false` to hide it. |

### clear `clear()`  {#clear}

Removes every screen entry from the tag.

### users `users()`  {#users}

Returns the [User](/process-functions/userSecurity-user) objects that hold this tag.

### hasUser `hasUser(user)`  {#hasuser}

Returns `true` when a user holds this tag.

| Parameter | Type | Description |
|---|---|---|
| `user` | `number \| string \| User` | The user's id or email address, or the user. |

### addUser `addUser(user)`  {#adduser}

Gives a user this tag. Returns `true` when it was added.

| Parameter | Type | Description |
|---|---|---|
| `user` | `number \| string \| User` | The user's id or email address, or the user. |

### removeUser `removeUser(user)`  {#removeuser}

Takes this tag from a user. Returns `true` when it was removed.

| Parameter | Type | Description |
|---|---|---|
| `user` | `number \| string \| User` | The user's id or email address, or the user. |

### json `json(includeAccessEntries)`  {#json}

Returns the tag as an object, with its `id`, `name` and `type`.

| Parameter | Type | Description |
|---|---|---|
| `includeAccessEntries` | `boolean` | Optional. `true` to include the screen entries under `access`. |

## Examples

```js
const app = security.application("My Application");
const tag = app.tags.createScreen("Planner Screens");

tag.set("Planner", true);
tag.set("Admin", false);
tag.addUser("user@example.com");

console.log(tag.access());
console.log(tag.json(true));
```

## Related

* [ApplicationTags](/process-functions/security-application-tags): creates and finds tags.
* [ElementTag](/process-functions/security-application-elementtag): the other kind of tag.
