Skip to main content

Module text_selection_menu

Module text_selection_menu 

Source
Expand description

The floating text edit menu: a liquid-glass capsule of actions above the selection / caret, matched against the reference recording (example/target/text-selection/).

Geometry and material (all measured): a 44 dp glass capsule — weak backdrop blur (content behind stays readable through the body), a whisper of dark tint, a top rim highlight — holding white ~15 sp labels separated by 1 dp hairlines (17 dp tall, centered). When the actions don’t fit the window, the overflow lives behind a trailing chevron sitting in a lighter glass disc that fills the capsule’s end cap (pressing it flashes the disc white and pages the items).

Placement: centered over the selection, clamped to a 20 dp screen margin; the capsule’s bottom rides 15 dp above the selection’s first line.

Motion (from the 120 fps reference): the menu dissolves in ~70 ms the moment a handle drag starts, and rematerializes in place ~250 ms after release with a ~140 ms fade (no scale, no slide).

Structs§

TextMenuItem
One tappable action.

Constants§

MENU_HEIGHT
Capsule height (dp) — the measured 133 px @3x.

Functions§

CaretActionMenu
A floating Paste / Select all / Undo / Redo menu shown near the collapsed caret. Opened by tapping the cursor handle (there is no selection to Copy/Cut, so this offers the caret-relevant actions instead).
LiquidTextMenu
The liquid-glass text edit menu.
TextSelectionMenu
A floating Copy / Cut / Paste / Select-all menu shown just above the text selection. center_x / line_top_y anchor it over the selection; visible is false while a handle drag is in flight. can_paste hides the Paste item when the clipboard is empty. Each action runs against the focused field; the caller is expected to dismiss the menu.
local_on_light_surface
CompositionLocal marking the surface the floating glass sits over as LIGHT. Liquid glass is transparent, so its labels and hairlines must flip to dark ink over a light backdrop to stay readable — the same content over a dark app keeps its near-white ink. Defaults to false (dark surface), preserving the existing look; a light-themed screen provides true.