Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support scrollbars for text fields #705

Closed
igordmn opened this issue May 27, 2021 · 3 comments
Closed

Support scrollbars for text fields #705

igordmn opened this issue May 27, 2021 · 3 comments
Assignees
Labels
desktop enhancement New feature or request scroll

Comments

@igordmn
Copy link
Collaborator

igordmn commented May 27, 2021

0.4.0-build211

Currently there is no way to add scrollbars to the text field because text fields have their own scroll state that is not accessible outside of the text field.

import androidx.compose.desktop.Window
import androidx.compose.foundation.VerticalScrollbar
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.rememberScrollbarAdapter
import androidx.compose.foundation.text.BasicTextField
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier

fun main() = Window {
    val scrollState = rememberScrollState()
    Box(
        modifier = Modifier.fillMaxSize()
    ) {
        BasicTextField((1..10000).joinToString { "x" }, {}, Modifier.fillMaxSize())
        VerticalScrollbar(
            rememberScrollbarAdapter(scrollState),
            modifier = Modifier.align(Alignment.CenterEnd).fillMaxHeight()
        )
    }
}
@igordmn igordmn added the scroll label May 27, 2021
@igordmn igordmn self-assigned this May 27, 2021
@igordmn
Copy link
Collaborator Author

igordmn commented May 27, 2021

See also another related issue with scroll and text field: #26

@akurasov akurasov added the enhancement New feature or request label Jul 19, 2021
@m-sasha
Copy link
Member

m-sasha commented Jul 18, 2023

Implemented in JetBrains/compose-multiplatform-core#384

@m-sasha m-sasha closed this as completed Jul 18, 2023
@okushnikov
Copy link
Collaborator

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.

@JetBrains JetBrains locked and limited conversation to collaborators Dec 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
desktop enhancement New feature or request scroll
Projects
None yet
Development

No branches or pull requests

4 participants