<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/mastering-jetpack-compose-s-new-selectionstate-api-dbetcucdb" -->

---
title: Mastering Jetpack Compose’s New SelectionState API
description: Jetpack Compose's August '26 release added a new SelectionState API that gives hoisted, bidirectional, programmatic control over text selection. Key components...
canonical: https://daily.dev/posts/mastering-jetpack-compose-s-new-selectionstate-api-dbetcucdb
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Mastering Jetpack Compose’s New SelectionState API | daily.dev
og:description: Jetpack Compose's August '26 release added a new SelectionState API that gives hoisted, bidirectional, programmatic control over text selection. Key components...
og:url: https://daily.dev/posts/mastering-jetpack-compose-s-new-selectionstate-api-dbetcucdb
og:image: https://api.daily.dev/og/posts/dbeTCUCDb.png
og:image:alt: Mastering Jetpack Compose’s New SelectionState API
og:image:width: 1200
og:image:height: 630
og:locale: en
---

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

# Mastering Jetpack Compose’s New SelectionState API

**[Medium](https://daily.dev/sources/medium_js)** · 2 min read · 1 upvotes · 0 comments

## Summary

Jetpack Compose's August '26 release added a new SelectionState API that gives hoisted, bidirectional, programmatic control over text selection. Key components include rememberSelectionState(), the SelectionContainer composable, and control methods like selectAll(), clear(), select(TextRange), and extendSelectionByWord(). Selected text is exposed reactively as a List<AnnotatedString> backed by mutableStateOf, allowing composables to observe selection changes. Sample code demonstrates wiring buttons to programmatically manipulate and display the current text selection.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://proandroiddev.com/mastering-jetpack-composes-new-selectionstate-api-13dfa05f49db>

## Questions this post answers

### How do I programmatically select all text in a Jetpack Compose SelectionContainer?

Use the SelectionState API introduced in the Jetpack Compose August '26 release. Create a SelectionState with rememberSelectionState(), pass it to SelectionContainer via the state parameter, then call selectionState.selectAll() from a button or other event handler to select all content in that container programmatically.

_Developers adopting new Compose APIs can track release changes like this on daily.dev._

### How can I select a specific range of text in Jetpack Compose using SelectionState?

Call selectionState.select(TextRange(start, end)) on a SelectionState instance tied to a SelectionContainer, for example selectionState.select(TextRange(0, 4)) to select the first four characters. The SelectionState object, obtained via rememberSelectionState(), also supports selectAll(), clear(), and extendSelectionByWord() for other programmatic selection controls.

_Anyone building custom text interactions in Compose can compare these API options on daily.dev._

### Can one SelectionState be shared across multiple SelectionContainers in Jetpack Compose?

No, the same SelectionState instance cannot be used with multiple SelectionContainers. Each SelectionContainer needs its own SelectionState created via rememberSelectionState(), since the state is scoped to a single container for hoisted, bidirectional selection control.

_Teams debugging selection quirks in Compose can dig into API constraints like this on daily.dev._

## Similar posts on daily.dev

- [Why Jetpack Compose?](https://daily.dev/posts/why-jetpack-compose--uskvq7a4x) · Medium · 0 upvotes · 0 comments
- [What's new in the Jetpack Compose December '25 release](https://daily.dev/posts/what-s-new-in-the-jetpack-compose-december-25-release-tosr73rob) · Android Developers Blog · 7 upvotes · 0 comments
- [Jetpack Compose State Survival Guide: From remember to rememberNavBackStack](https://daily.dev/posts/jetpack-compose-state-survival-guide-from-remember-to-remembernavbackstack-yvth5mecf) · ProAndroidDev · 1 upvotes · 0 comments

---

Tags: [#android](https://daily.dev/tags/android), [#kotlin](https://daily.dev/tags/kotlin), [#jetpack-compose](https://daily.dev/tags/jetpack-compose)

[View this post on daily.dev](https://daily.dev/posts/mastering-jetpack-compose-s-new-selectionstate-api-dbetcucdb)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Mastering Jetpack Compose’s New SelectionState API","url":"https://daily.dev/posts/mastering-jetpack-compose-s-new-selectionstate-api-dbetcucdb","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/mastering-jetpack-compose-s-new-selectionstate-api-dbetcucdb"},"datePublished":"2026-08-30T02:33:47.891Z","dateModified":"2026-09-14T07:44:30.245Z","description":"Jetpack Compose's August '26 release added a new SelectionState API that gives hoisted, bidirectional, programmatic control over text selection. Key components...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/edd3aafa08bea0ac4df64cf6f13ed77b?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/edd3aafa08bea0ac4df64cf6f13ed77b?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Medium","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Medium","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/medium","url":"https://daily.dev/sources/medium_js"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/mastering-jetpack-compose-s-new-selectionstate-api-dbetcucdb","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"android,kotlin,jetpack-compose","timeRequired":"PT2M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Medium","item":"https://daily.dev/sources/medium_js"},{"@type":"ListItem","position":3,"name":"Mastering Jetpack Compose’s New SelectionState API"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/mastering-jetpack-compose-s-new-selectionstate-api-dbetcucdb#faq","mainEntity":[{"@type":"Question","name":"How do I programmatically select all text in a Jetpack Compose SelectionContainer?","acceptedAnswer":{"@type":"Answer","text":"Use the SelectionState API introduced in the Jetpack Compose August '26 release. Create a SelectionState with rememberSelectionState(), pass it to SelectionContainer via the state parameter, then call selectionState.selectAll() from a button or other event handler to select all content in that container programmatically. Developers adopting new Compose APIs can track release changes like this on daily.dev."}},{"@type":"Question","name":"How can I select a specific range of text in Jetpack Compose using SelectionState?","acceptedAnswer":{"@type":"Answer","text":"Call selectionState.select(TextRange(start, end)) on a SelectionState instance tied to a SelectionContainer, for example selectionState.select(TextRange(0, 4)) to select the first four characters. The SelectionState object, obtained via rememberSelectionState(), also supports selectAll(), clear(), and extendSelectionByWord() for other programmatic selection controls. Anyone building custom text interactions in Compose can compare these API options on daily.dev."}},{"@type":"Question","name":"Can one SelectionState be shared across multiple SelectionContainers in Jetpack Compose?","acceptedAnswer":{"@type":"Answer","text":"No, the same SelectionState instance cannot be used with multiple SelectionContainers. Each SelectionContainer needs its own SelectionState created via rememberSelectionState(), since the state is scoped to a single container for hoisted, bidirectional selection control. Teams debugging selection quirks in Compose can dig into API constraints like this on daily.dev."}}]}
```

