# tui/find-panel Find a panel by its string tag. Returns panel ID or 0. When multiple instances of the same app exist (auto-tagged as `"editor"`, `"editor2"`, etc.), a search for `"editor"` will find any matching instance via prefix matching, preferring the currently focused panel. ## Syntax
[tui/find-panel arg1]
## Parameters - `arg1` — tag string to search for ## Returns Panel ID as a number, or 0 if no matching panel is found. ## Notes - The returned panel ID can be passed to any workspace stdlib function that accepts a panel identifier — these all accept both numeric IDs and string tags. - When using `tui/eval`, `tui/eval-file`, `tui/shutdown`, `tui/focus-id`, and similar, you can pass the tag string directly instead of calling `tui/find-panel` first:
# Instead of:
set id [tui/find-panel "editor"]
[tui/eval $id "(+ 1 2)"]

# Do directly:
[tui/eval "editor" "(+ 1 2)"]
## Matching behavior 1. First tries an exact match on the tag string. 2. If no exact match, falls back to prefix match — e.g. `"editor"` matches `"editor2"`. 3. Among prefix matches, prefers the currently focused panel. 4. If no focused match, returns the first prefix match in pool order. ## Example
set ed [tui/find-panel "editor"]
# Returns the panel ID of the first editor instance (preferring focused).
# Works with auto-tagged instances: "editor", "editor2", "editor3".