Anchored region

An anchored region is a container component which enables authors to create layouts where the contents of the anchored region can be positioned relative to another "anchor" element. Additionally, the anchored region can react to the available space between the anchor and a parent "viewport" element such that the region is placed on the side of the anchor with the most available space, or even resize itself based on that space.

<FluentAnchoredRegion> wraps the <fluent-anchored-region> element, a web component implementation of an anchored region leveraging the Fluent UI design system.

Examples

Fixed

Example

Anchored region

anchor in fixed container
inside
Download: 

Dynamic (default)

The anchored region (the yellow block) is anchored to the button. It will dynamically position itself based on the available space.
Example
anchor
Download: 

Locked to default

Each region is anchored to the button with a specific lock position.
Example
anchor
Download: 

Scaling via update

Example
anchor
Download: 

Scaling via offset

Example
anchor
Download: 

Inset

Example
anchor
Download: 

Thresholds

Example
anchor
Download: 

Toggle anchor

Example
Set anchor 1 Set anchor 2
1
Download: 

Toggle position and size

Example
anchor
toggle horizontal toggle vertical small large
Download: 

RTL Dynamic

Example
anchor
Download: 

Size to Anchor

Example
anchor
Download: 

RTL Fill

Example
anchor
Download: 

Start & End

Example
anchor
Download: 

RTL Start & End

Example
anchor
Download: 

Add to fixed region

Example
outside & fixed

No actual output shown here.The result of this example is added to the fixed region shown at the top of the examples section

Download: 

Documentation

FluentAnchoredRegion Class

Parameters

Name
Type
Default
Description
Anchorstring?
Gets or sets the HTML ID of the anchor element this region is positioned relative to.
This must be set for the component positioning logic to be active.
AutoFocusbool
False
Gets or sets whether the element should receive the focus when the component is loaded.
AutoUpdateModeAutoUpdateMode?
Auto
Defines what triggers the anchored region to revaluate positioning.
Default is 'Anchor'.
In 'anchor' mode only anchor resizes and attribute changes will provoke an update.
In 'auto' mode the component also updates because of - any scroll event on the document, window resizes and viewport resizes. See FluentAnchoredRegion.AutoUpdateMode
ChildContentRenderFragment?
Gets or sets the content to be rendered inside the component.
FixedPlacementbool?
Gets or sets a value indicating whether the region is positioned using css 'position: fixed'.
Otherwise the region uses 'position: absolute'.
Fixed placement allows the region to break out of parent containers.
HorizontalDefaultPositionHorizontalPosition?
Unset
Gets or sets the default horizontal position of the region relative to the anchor element.
Default is unset. See HorizontalPosition
HorizontalInsetbool
False
Gets or sets a value indicating whether the region overlaps the anchor on the horizontal axis.
Default is false which places the region adjacent to the anchor element.
HorizontalPositioningModeAxisPositioningMode?
Dynamic
Sets what logic the component uses to determine horizontal placement.
Locktodefault forces the default position.
Dynamic decides placement based on available space.
Uncontrolled (default) does not control placement on the horizontal axis.
See AxisPositioningMode
HorizontalScalingAxisScalingMode?
Content
Defines how the width of the region is calculated.
Default is 'Content'. See AxisScalingMode
HorizontalThresholdint
0
How narrow the space allocated to the default position has to be before the widest area is selected for layout.
HorizontalViewportLockbool
False
Gets or sets a value indicating whether the region remains in the viewport (ie. detaches from the anchor) on the horizontal axis.
ShadowElevationShadow
None
VerticalDefaultPositionVerticalPosition?
Unset
Gets or sets the default vertical position of the region relative to the anchor element.
Default is 'Unset'.See VerticalPosition
VerticalInsetbool
False
Gets or sets a value indicating whether the region overlaps the anchor on the vertical axis.
VerticalPositioningModeAxisPositioningMode?
Dynamic
Sets what logic the component uses to determine vertical placement.
Locktodefault forces the default position.
Dynamic decides placement based on available space.
Uncontrolled (default) does not control placement on the vertical axis.
See AxisPositioningMode
VerticalScalingAxisScalingMode?
Content
Defines how the height of the region is calculated.
Default is 'Content'. See AxisScalingMode
VerticalThresholdint
0
How short the space allocated to the default position has to be before the tallest area
is selected for layout.
VerticalViewportLockbool?
Gets or sets a value indicating whether the region remains in the viewport (ie. detaches from the anchor) on the vertical axis.
Viewportstring?
Gets or sets the HTML ID of the viewport element this region is positioned relative to.
If unset the parent element of the anchored region is used.

Methods

Name
Parameters
Type
Description
FocusToNextElementAsyncTask
Moves the focus to the next element included in this anchor region only.
FocusToOriginalElementAsyncTask
Moves the focus to the initial element that triggered the anchor region.
Anchor
Auto
Unset
Start
End
Left
Right
Center
Uncontrolled
Locktodefault
Dynamic
Content
Fill
Anchor
None
Tooltip
Flyout
Dialog
Unset
Top
Bottom
Center
Uncontrolled
Locktodefault
Dynamic
Content
Fill
Anchor
An error has occurred. This application may no longer respond until reloaded. Reload 🗙