# DomOptimalPositionOptions

interface

The `getOptimalPosition()` helper options.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-utils/src/dom/position.ts#L443)

<a id="properties">

## Properties

<a id="member-element">

### `element: HTMLElement` _(readonly)_

Element that is to be positioned.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-utils/src/dom/position.ts#L448)

<a id="member-fitInViewport">

### `fitInViewport?: boolean` _(readonly)_

When set, the algorithm will chose such a position which fits `element` the most inside visible viewport.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-utils/src/dom/position.ts#L476)

<a id="member-limiter">

### `limiter?: RectSource | () => ( RectSource | null ) | null` _(readonly)_

When set, the algorithm will chose position which fits the most in the limiter's bounding rect.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-utils/src/dom/position.ts#L470)

<a id="member-positions">

### `positions: readonly Array<PositioningFunction>` _(readonly)_

An array of positioning functions.

**Note**: Positioning functions are processed in the order of preference. The first function that works in the current environment (e.g. offers the complete fit in the viewport geometry) will be picked by `getOptimalPosition()`.

**Note**: Any positioning function returning `null` is ignored.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-utils/src/dom/position.ts#L464)

<a id="member-target">

### `target: RectSource | () => RectSource` _(readonly)_

Target with respect to which the `element` is to be positioned.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-utils/src/dom/position.ts#L453)

<a id="member-viewportOffsetConfig">

### `viewportOffsetConfig?: object` _(readonly)_

Viewport offset config object. It restricts the visible viewport available to the `getOptimalPosition()` from each side.

```typescript
{
	top: 50,
	right: 50,
	bottom: 50,
	left: 50
}
```

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-utils/src/dom/position.ts#L490)

---

Full index of the CKEditor 5 API reference: [llms.txt](llms.txt)
