Package-level declarations

Find & replace for the Compose Text Editor: the FindBar UI, the FindState holder and its rememberFindState factory, the findShortcut modifier, localizable FindBarStrings, and the match highlight styles.

Types

Link copied to clipboard
data class FindBarStrings(val placeholder: String, val clearSearch: String, val noMatches: String, val previousMatch: String, val nextMatch: String, val close: String, val matchCount: (current: Int, total: Int) -> String, val replacePlaceholder: String, val replace: String, val replaceAll: String, val showReplace: String, val hideReplace: String)

Localizable strings for the FindBar component. Provide a custom implementation to localize the Find UI.

Link copied to clipboard
class FindCurrentMatchStyle(color: Color = Color(0x80FF9800)) : RichSpanStyle

Highlight style for the current/active find match. Uses a semi-transparent orange background by default to distinguish from other matches.

Link copied to clipboard
class FindMatchStyle(color: Color = Color(0x60FFEB3B)) : RichSpanStyle

Default highlight style for all find matches (non-current). Uses a semi-transparent yellow background by default.

Link copied to clipboard
class FindState(val textState: TextEditorState, scope: CoroutineScope)

State management for the Find feature.

Functions

Link copied to clipboard
fun TextEditorState.findAll(query: String, caseSensitive: Boolean = false): List<TextEditorRange>

Find all occurrences of a query string in the text editor.

Link copied to clipboard
fun FindBar(state: FindState, onClose: () -> Unit, modifier: Modifier = Modifier, strings: FindBarStrings = FindBarStrings.Default, requestFocus: Boolean = true)

A find bar UI component that provides search and replace functionality.

Link copied to clipboard

Returns the index into matches of the match nearest the cursor.

Link copied to clipboard
fun Modifier.findShortcut(onToggle: () -> Unit): Modifier

Intercepts the standard find shortcut (Ctrl+F on Win/Linux, Cmd+F on macOS) and invokes onToggle when triggered. Repeated presses toggle the find bar — the consumer's onToggle callback is expected to flip its own visibility state.

Link copied to clipboard

Creates and remembers a FindState for the given TextEditorState.