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§
- Text
Menu Item - One tappable action.
Constants§
- MENU_
HEIGHT - Capsule height (dp) — the measured 133 px @3x.
Functions§
- Caret
Action Menu - 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).
- Liquid
Text Menu - The liquid-glass text edit menu.
- Text
Selection Menu - A floating Copy / Cut / Paste / Select-all menu shown just above the text
selection.
center_x/line_top_yanchor it over the selection;visibleis false while a handle drag is in flight.can_pastehides 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 providestrue.