# FloatingActionButton Positioning

The FloatingActionButton provides options for aligning and positioning it in relation to the browser viewport or a CSS containing block. The [`positionMode`](https://www.telerik.com/kendo-angular-ui-develop/components/buttons/api/floatingactionbuttoncomponent#positionMode) input defines the positioning context, while the [`align`](https://www.telerik.com/kendo-angular-ui-develop/components/buttons/api/floatingactionbuttoncomponent#align) and [`offset`](https://www.telerik.com/kendo-angular-ui-develop/components/buttons/api/floatingactionbuttoncomponent#offset) inputs place the button and fine-tune its distance from the edges.

## Position Mode

The FloatingActionButton can be positioned in one of two ways, depending on [`positionMode`](https://www.telerik.com/kendo-angular-ui-develop/components/buttons/api/floatingactionbuttoncomponent#positionMode):

* `fixed` (Default)—Positions the FloatingActionButton relative to the viewport. It stays in the same place when the page scrolls.
* `absolute`—Positions the FloatingActionButton relative to the nearest positioned ancestor. If no positioned ancestor exists, the browser uses the document `body`, and the button moves with page scrolling.

Тo position the FloatingActionButton relative to a specific area in `absolute` mode, place it inside that area and set a CSS position value, such as `relative`, on the area. The nearest positioned ancestor defines the containing block.

The following example lets you switch between fixed and absolute positioning while the page scrolls.

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

## Alignment

The FloatingActionButton allows you to set horizontal and vertical alignment with regard to the viewport, HTML element, or Angular Component. Use [`align`](https://www.telerik.com/kendo-angular-ui-develop/components/buttons/api/floatingactionbuttoncomponent#align) to set the FloatingActionButton's horizontal and vertical position within the active positioning context.

The `horizontal` setting defines the possible horizontal alignment of the FloatingActionButton and provides the following options:

* `start`—Uses the start point of the container.
* `center`—Uses the center point of the container.
* `end` (Default)—Uses the end point of the container.

The `vertical` setting defines the possible vertical alignment of the FloatingActionButton and provides the following options:

* `top`—Uses the top point of the container.
* `middle`—Uses the middle point of the container.
* `bottom` (Default)—Uses the bottom point of the container.

> Centering the FloatingActionButton in both dimensions is not a typical use case. Still, you can adjust a centered position with [offsets](https://www.telerik.com/kendo-angular-ui-develop/components/buttons/floatingactionbutton/positioning#offset). Setting `horizontal: 'center'` and `vertical: 'middle'` at the same time is not supported.

The following example displays the supported horizontal and vertical alignment points.

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

## Offset

The FloatingActionButton allows you to use [`offset`](https://www.telerik.com/kendo-angular-ui-develop/components/buttons/api/floatingactionbuttoncomponent#offset) to adjust the position set by [`align`](https://www.telerik.com/kendo-angular-ui-develop/components/buttons/api/floatingactionbuttoncomponent#align).

The available `offset` values are:

* `x`—Sets the horizontal offset.
* `y`—Sets the vertical offset.

For edge alignments, the default offset places the button 16 pixels from the container boundary. When an axis uses `center` or `middle`, its default offset places the button at 50% on that axis. Set a non-default value to move the button away from the center.

For corner alignments, positive offsets move the button inward from its edges. At bottom-center, positive `x` moves the button right, and positive `y` moves it up. Negative offsets reverse those directions and can move the button beyond the container boundary.

The following example lets you change the horizontal and vertical offsets in pixels.

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

## Suggested Links

* [FloatingActionButton Overview](https://www.telerik.com/kendo-angular-ui-develop/components/buttons/floatingactionbutton)
* [Appearance](https://www.telerik.com/kendo-angular-ui-develop/components/buttons/floatingactionbutton/appearance)
* [API Reference of the FloatingActionButton](https://www.telerik.com/kendo-angular-ui-develop/components/buttons/api/floatingactionbuttoncomponent)
