This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index at /llms.txt, or add .md to any page's URL.
Recipe: list rows: search, swipe, filter and long-press
A list under a large title and the bar's search; its rows swipe to delete and long-press for a menu.
A list under a large title and the bar's search; its rows swipe to delete and long-press
for a menu.
Add search, swipe and a menu to a list
Paste this into Claude, Cursor, Codex, or another agent.
contract
routes nav
home "/"
shape Note
id: string
title: string
component Notes
state query = ""
state notes = [Note(id="1", title="Groceries"), Note(id="2", title="Ideas")]
state aimed = ""
derive shown = notes.filter(n => n.title.toLowerCase().includes(query.trim().toLowerCase()))
action search(v: string)
query = v
action remove(id: string)
notes = notes.filter(n => n.id != id)
action aim(id: string)
aimed = id
view
main navigationKey=`${top(nav).id}` testId="app" width="100%" height="100%"
for e in stack(nav) key=e.id
column navigationKey=`${e.id}` navigationScroll="notes-list" position="absolute" inset=0
header display="flex" flex-wrap="wrap" align-items="center" gap=8 padding="8px 16px"
text "Notes" role="heading" aria-level=1 flex=1
input type="search" value=query input=search placeholder="Search" aria-label="Search notes"
testId="search" width="100%"
list id="notes-list" appearance="auto" listStyle="inset-grouped" flex=1 min-height=0
section
for n in shown key=n.id
row delete=remove(n.id) contextmenu=aim(n.id) contextPopover="menu" testId=`note-${n.id}`
text n.title
column id="menu" popover="auto" role="menu"
button press=remove(aimed) destructive=true popovertarget="menu" popovertargetaction="hide"
testId="menu-delete"
image "symbol:delete"
text "Delete"
contract-test
test "search, swipe to delete, delete from the menu"
type "search" "gro"
expect tree missing "note-2"
type "search" ""
tap "note-2-delete"
expect tree missing "note-2"
tap "note-1" contextmenu
tap "menu-delete"
expect tree missing "note-1"
•
delete= on a row is its swipe to delete (iOS: UIKit's); disabled keeps the row from
deleting. A test taps "<row testId>-delete"; other actions: contract vocab swipe.
•
The swipe deletes without asking (as Mail); a detail screen's Delete asks first
(contract vocab confirm).
•
The empty search field scrolls away on iOS, as UIKit's does; position="sticky" top=0
on the input pins it. Querying a server: contract vocab search.
•
A filter: a row role="radiogroup" of button role="radio"
(a remembered setting): a segmented control, unless you paint them.
•
One long-press menu serves every row: the row notes which (aim); each item acts on
aimed and hides it (iOS: a UIMenu).
•
The list runs under the bar and under a row of only controls pinned beside it (a
composer), blurred as iOS does. A caption or a filled row there stops the rows in a hard
line (lower-list-beside-fixed): put it in a section's header or footer.
•
verify ios scrolls the list by real touches and names what differs from UIKit's.
Is this helpful
Last updated November 14, 2026