---
url: /documentation/input-types/relation.md
description: >-
  Configure REST-backed post or taxonomy relation inputs with filtering,
  multiple selection, and duplicate prevention.
---

# Relation Input

Enables to reference items through a WP-JSON endpoint.

```js
{
  input: {
    type: 'relation', // [!code focus:2]
    restBase: 'slider'
  }
}
```

:::warning
Post types and taxonomies must be exposed in the REST API to be available in the relation input. Read [this cookbook recipe](/cookbook/expose-in-rest) to learn how.
:::

:::tip
If you want to reference posts or terms, you probably want to use the [`post`](post) and [`term`](term) input types instead.
:::

## Input Options

| Option | Values | Default | Description |
| - | - | - | - |
| `restBase` | `string` | - | Rest base (`/wp-json/wp/v2/<restBase>`) can be post type or taxonomy. Use `categories` for the default post categories. |
| `placeholder` | `string` | `'Element suchen'` | Text displayed as search input placeholder. |
| `multiple` | `boolean` | `false` | Whether multiple items can be selected. |
| `allowDuplicates` | `boolean` | `true` | Whether duplicate items can be added if multiple is true. |
| `editLink` | `string \| boolean` | `true` | Declare edit link for individual items, `%s` will be replaced with its post ID. If set to `false`, edit links will be disabled. If set to `true`, a default edit link will be determined automatically. |

## Conditions

The `relation` input type supports the following conditions for [dynamic visibility](/documentation/concepts/elements/definition#dynamic-visibility):

| Condition | Payload | Description |
| - | - | - |
| `isEmpty` | `boolean`defaults to `true` | Checks whether an item has been selected or not. |
