# Positioning

The FloatingToolbar supports [anchored positioning](https://www.telerik.com/kendo-vue-ui-develop/components/buttons/floatingtoolbar/positioning#anchored-mode) and [free positioning](https://www.telerik.com/kendo-vue-ui-develop/components/buttons/floatingtoolbar/positioning#free-position-mode). It updates its placement while the page scrolls or resizes. You can also [control its visibility](https://www.telerik.com/kendo-vue-ui-develop/components/buttons/floatingtoolbar/positioning#controlling-visibility) and [set its margin](https://www.telerik.com/kendo-vue-ui-develop/components/buttons/floatingtoolbar/positioning#setting-the-margin).

## Anchored Mode

Set the `anchor` prop to an `HTMLElement` to position the FloatingToolbar relative to that element. Pass the element itself, such as the value of a Vue template ref, rather than a selector string. The `position` prop specifies the preferred side of the anchor:

* `top` (default)
* `bottom`
* `left`
* `right`

If the preferred side does not have enough space, collision handling flips the component to the opposite side. The FloatingToolbar follows its anchor while the page scrolls or the viewport resizes.

The following example demonstrates a formatting toolbar anchored to a highlighted phrase. Use the configurator to change `position`.

[Demo Source](https://demos.telerik.com/kendo-vue-ui/buttons/floatingtoolbar/positioning/source.txt)

## Free-Position Mode

When `anchor` is `null` or omitted, the FloatingToolbar aligns within its container according to `containerAlign`. This prop accepts `horizontal` and `vertical` keys and defaults to `{ horizontal: 'center', vertical: 'top' }`.

The available `horizontal` values are `left`, `center` (default), and `right`. The available `vertical` values are `top` (default), `center`, and `bottom`.

Use `appendTo` to choose where the FloatingToolbar is rendered:

* Omit `appendTo` to append it to `document.body` and align it within the page.
* Pass an `HTMLElement` to render it inside a custom container. In free-position mode, `containerAlign` aligns it within that element. Give the container a positioning context, such as `position: relative`.
* Set `appendTo` to `null` to render it inline at its place in the Vue template without moving it to another element. Inline rendering controls its DOM location; use an explicit container element when you also need container-relative alignment.

Changing `anchor` or `appendTo` resets a manually positioned toolbar so that its configured alignment applies again.

The following example demonstrates free positioning inside a custom container. Change the horizontal and vertical alignment to reposition the FloatingToolbar.

[Demo Source](https://demos.telerik.com/kendo-vue-ui/buttons/floatingtoolbar/free-positioning/source.txt)

## Controlling Visibility

Mount and unmount the FloatingToolbar with Vue conditional rendering, such as `v-if`, to show and hide it. The component does not expose a `show` prop. For selection-based actions, set `anchor` to an element representing the current selection when mounting the component.

The following example displays the FloatingToolbar above selected text. Select part of the text to show it and clear the selection to hide it.

[Demo Source](https://demos.telerik.com/kendo-vue-ui/buttons/floatingtoolbar/visibility/source.txt)

## Setting the Margin

Use the `margin` prop with `horizontal` and `vertical` values in pixels. In anchored mode, it controls the gap between the FloatingToolbar and its anchor. In free-position mode, it controls the inset from the alignment container's edge.

The following example shows how increasing the margin insets a bottom-aligned FloatingToolbar from the page edge.

[Demo Source](https://demos.telerik.com/kendo-vue-ui/buttons/floatingtoolbar/margin/source.txt)

## Suggested Links

* [FloatingToolbar Overview](https://www.telerik.com/kendo-vue-ui-develop/components/buttons/floatingtoolbar)
* [Dragging](https://www.telerik.com/kendo-vue-ui-develop/components/buttons/floatingtoolbar/dragging)
