Command palette

@yasinsensoy/native

React Native · APIs and utilities

Overlay placement

Position of a floating element (Menu, Popover, Tooltip…) relative to its trigger: the side and the alignment on that side.

4 exports

Position of a floating element (Menu, Popover, Tooltip…) relative to its trigger: the side and the alignment on that side. The same as Placement on web.

  • "auto": The best position is chosen; if it does not fit the screen it moves elsewhere. Menu/Popover start below with left edges aligned; Tooltip above and centered.
  • "top", "bottom", "left", "right": Centered on that side.
  • "bottom-left": Below; left edges aligned, opening to the right. "bottom-right" aligns the right edges. "top-left", "top-right" the same above.
  • "right-top": On the right; top edges aligned. "left-bottom" on the left, bottom edges aligned.

If the chosen position does not fit the screen it flips to the opposite side and/or the opposite alignment.

type Placement = "auto" | Side | `${"top" | "bottom"}-${"left" | "center" | "right"}` | `${"left" | "right"}-${"top" | "center" | "bottom"}`

Side

type

The side the floating element is placed on relative to its anchor.

type Side = "top" | "right" | "bottom" | "left"

Positions other than "auto".

type FixedPlacement = Exclude<Placement, "auto">

Insets

interface

Unusable insets at the screen edges (notch, status bar…).

NameTypeDescription
topnumberTop.
rightnumberRight.
bottomnumberBottom.
leftnumberLeft.