# api-news

Published articles for api-news.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## Mastering Jetpack Compose's New SelectionState API

DevFeed: [Mastering Jetpack Compose's New SelectionState API](<https://devfeed.tech/articles/mastering-jetpack-compose-s-new-selectionstate-api-25985.md>)

Original publisher: [Read original article](<https://proandroiddev.com/mastering-jetpack-composes-new-selectionstate-api-13dfa05f49db?source=rss-711ab22c5c77------2>)

Author: Nav Singh

Published: 2026-08-27T01:17:44Z

Content type: tutorial

Language: en

Sources: [Stories by Nav Singh 🇨🇦 on Medium](<https://devfeed.tech/sources/stories-by-nav-singh-on-medium.md>)

Topics: [Jetpack Compose](<https://devfeed.tech/topics/jetpack-compose.md>), [Compose](<https://devfeed.tech/topics/compose.md>), [API](<https://devfeed.tech/topics/api.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [androiddev](<https://devfeed.tech/tags/androiddev.md>), [api](<https://devfeed.tech/tags/api.md>), [api-news](<https://devfeed.tech/tags/api-news.md>), [code](<https://devfeed.tech/tags/code.md>), [compose](<https://devfeed.tech/tags/compose.md>), [jetpack-compose](<https://devfeed.tech/tags/jetpack-compose.md>), [reactive](<https://devfeed.tech/tags/reactive.md>)

### AI overview

This tutorial introduces Jetpack Compose's SelectionState API, released in August 2026, for hoisted bidirectional selection control and reactive text observation. It demonstrates programmatic selection, clearing, range selection, word-based expansion, and access to selected text.

### Source excerpt

Image generated using Gemini The Jetpack Compose August '26 release introduced a new API SelectionState for hoisted, bidirectional control and reactive text observation. Core ComponentsSelectionState An object that provides access to the selected text and methods for controlling it programmatically 🛑 We cannot use the same SelectionState with multiple SelectionContainersval selectionState = rememberSelectionState()SelectionContainer: A composable function that enables text selection of its content. SelectionContainer(state = selectionState) { Text( "Text content to be selected programmatically." ) }Programmatic Control Methods selectionState.selectAll(): Selects all the content in the container Button( onClick = { selectionState.selectAll() }) { Text("Select All") } selectionState.clear(): Clears the active selection Button(onClick = { selectionState.clear() }) { Text("Clear selection") } selectionState.select(TextRange): Selects a specific range of text Button( onClick = { selectionState.select(TextRange(0, 4)) }) { Text("Range selection") } selectionState.extendSelectionByWord(): Expands the selection of words This selects the first word in the container if there is no selection. The selection continues to the next Composable Text, if the next word is in a different Composable Text.Button( onClick = { selectionState.extendSelectionByWord()}) { Text("Extend selection") }Mutliple Text Components selectionSelected texts Provides access to the selected text. Returns List<AnnotatedString> Backed by mutableStateOf -- Observable by Composablesprivate var _selectedTexts by mutableStateOf<List<AnnotatedString>>Text(text = "Selected text: ${selectionState.selectedTexts}")Sample Code@Composable fun ProgrammaticSelectionExample() { val selectionState = rememberSelectionState() Column{ Row { Button( onClick = { selectionState.selectAll() }, ) { Text("Select All") } Button( onClick = { selectionState.clear() }, ) { Text("Clear selection") } } Row { Button( onClick = { selectionS