---
order: 0
title: Indicator
description: An addon to display drag hitbox information on drop targets.
---

import SectionMessage from '@atlaskit/section-message';
import ClosestEdgeExample from '../../examples/constellation/closest-edge';
import ConditionalExample from '../../examples/constellation/conditional';
import GapExample from '../../examples/constellation/gap';
import TreeItemExample from '../../examples/constellation/tree-item';

<SectionMessage
  title="Positioning"
>

Ensure that the parent element of the `<DropIndicator/>` has [non-static positioning](https://developer.mozilla.org/en-US/docs/Web/CSS/position). The drop indicator uses `position: absolute` so will be positioned relative
to the closest ancestor with non-static positioning.

Generally, you will want to add `position: relative` to the element you want to position the line against.

</SectionMessage>

This package contains `react` components to display hitbox information. Hitbox information is usually generated by [`@atlaskit/pragmatic-drag-and-drop-hitbox`](drag-and-drop/packages/hitbox). These packages use `@emotion/react` for styling.

You do not _need_ to use these packages to display hitbox information, they have been created for your convenience. These packages embody our [design guidelines](/components/pragmatic-drag-and-drop/design-guidelines)

- [`@atlaskit/pragmatic-drag-and-drop-hitbox/box`](/components/pragmatic-drag-and-drop/packages/indicator/box) displays a line relative to a _box_ (eg a `Card`)
- [`@atlaskit/pragmatic-drag-and-drop-hitbox/tree-item`](#tree-item) use lines and borders to communicate tree based operations (eg reordering, changing parents and so on).

## Box

This package provides a `<DropIndicator/>` component to draw drop indicators (lines) relative to box elements (eg `<Card/>`).

```ts
import { DropIndicator } from '@atlaskit/pragmatic-drag-and-drop-react-indicator/box';
```

When performing reordering operations a drop indicator is used to communicate the intended resting place of the `draggable` item. The orientation of the drop indicator should always match the direction of the content flow.

### Edge

Use `edge` to specify which edge of the drop target the drop indicator should be rendered on.

<Example Component={ClosestEdgeExample} />

In order to help people be successful with performance, we have made `edge` a _required_ prop. This will force you to only render the indicator when it is relevant (minimising `react` and DOM nodes)

<Example Component={ConditionalExample} />

### Gap

Use `gap` to specify the distance between each draggable item.

The line will be drawn at an offset of half this value, resulting in the line being drawn between draggable items.

<Example Component={GapExample} />

## Box (without terminal)

<SectionMessage
  title="Not recommended"
>

We do not recommend using this variant without good reason. The indicator with
a terminal is recommended for most use cases.

</SectionMessage>

There is also a version of the box indicator that does not include a terminal.

```ts
import { DropIndicator } from '@atlaskit/pragmatic-drag-and-drop-react-indicator/box-without-terminal';
```

## Tree item

This package provides a `<DropIndicator/>` component to draw drop indicators in a tree. The `<DropIndicator/>` is used to visually communicate an `instruction` (eg `"reorder-above"`) generated by the [tree item hitbox](./hitbox/about#tree-item).

- Lines are used to indicate reordering
- A border is used to indicate that an item will be made a child (`"make-child"`)
- Blocked instructions are drawn in a warning color. It was an intentional choice to provide users with a visual indication that an `instruction` is blocked during a drag.

```ts
import { DropIndicator } from '@atlaskit/pragmatic-drag-and-drop-react-indicator/tree-item';
```

<Example Component={TreeItemExample} />
