---
title: "Recipe: list rows: search, swipe, filter and long-press"
description: "A list under a large title and the bar's search; its rows swipe to delete and long-press for a menu."
modificationDate: "2026-11-14"
---

> ## Documentation index
> Fetch the complete documentation index at: https://exact.expo.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Recipe: list rows: search, swipe, filter and long-press

<AgentInstructions>

## Submitting feedback

From the app's directory, read `bun exact.mjs feedback status`. Under `never`, keep no note.
Respect `EXACT_FEEDBACK=0` and do not change the policy.

Otherwise record specific, actionable feedback with:
`bun exact.mjs feedback note "Exact docs: https://exact.expo.dev/recipes/list-rows: <what was wrong or missing>"`

The note goes to Expo only as that status allows. Include no secrets or personal data.

</AgentInstructions>

A list under a large title and the bar's search; its rows swipe to delete and long-press
for a menu.

```prompt Add search, swipe and a menu to a list
Give a list in the Exact app in this folder a search field, swipe to delete, a filter and a long-press menu. Use https://github.com/expo/exact/blob/main/docs/recipes/list-rows.md as the source for each step. The Exact checkout has the same page at docs/recipes/list-rows.md.

1. If this folder is not an Exact app (it has no exact.mjs and app.contract), stop and tell me.
2. If I did not say which list, and which of search, swipe to delete, a filter and a long-press menu it gets, propose them from the app and ask me before you write code.
3. Search: an `input type="search"` in the route's `header`, and a derive that filters the list. To query a server instead, read `bun exact.mjs contract vocab search`.
4. Swipe to delete: `delete=` on each row. It deletes without asking; a detail screen's Delete asks first (`bun exact.mjs contract vocab confirm`). For other swipe actions, read `bun exact.mjs contract vocab swipe`.
5. A filter: a `row role="radiogroup"` of `button role="radio"`. A long-press menu: one `popover="auto" role="menu"` for every row; each row's `contextmenu` notes which row, and each item acts on that row and hides the menu.
6. In app.test.contract, add a test for each one you added: type in the search and expect a row missing, tap `"<row testId>-delete"`, and tap a row with `contextmenu`, then a menu item.
7. Follow the platform checks in docs/start-here.md (`bun exact.mjs docs platform checks`) for the targets in the app's AGENTS.md and app.json until they pass. Read the reports, including counted findings; a zero exit code alone does not mean clean. If the app runs on iOS, run `bun exact.mjs verify ios` too: it scrolls the list by real touches. Fix the app, not the test. If a finding stays after three rounds of fixes, or the app had it before you changed anything, record it (step 8) and report it; do not keep trying.
8. When a doc was wrong or missing, or a step needed a workaround, read `bun exact.mjs feedback status`. Under `never`, keep no note. Otherwise record it: `bun exact.mjs feedback note "<what happened>"`, which goes to Expo only as that status says. Do not change the policy; tell me how many notes you kept.
9. Tell me what the list now does, what the tests and verify reported, and the launch command for each target platform.
```

```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](https://exact.expo.dev/recipes/persisted-setting.md)): 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.
