Compose for Desktop is modern toolkit for building native declarative UI made by JetBrains. It's based on Google's Jetpack Compose
Questions tagged [compose-desktop]
147 questions
1
vote
0 answers
How do I implement dragging from a Jetpack Compose application to somewhere outside?
I can write something like this in my Compose application:
var isDroppable by remember { mutableStateOf(false) }
val (textFieldValue, setTextFieldValue) = remember { mutableStateOf(TextFieldValue()) }
TextField(
value = textFieldValue,
…

Hakanai
- 12,010
- 10
- 62
- 132
1
vote
0 answers
The 'ksp' configuration is deprecated in Kotlin Multiplatform projects. Please use target-specific configurations like 'kspJvm' instead
when I want to run Compose Desktop project i get this warning
The 'ksp' configuration is deprecated in Kotlin Multiplatform projects. Please use
target-specific configurations like 'kspJvm' instead.
Invalid Java installation found at…

MohammadBaqer
- 766
- 6
- 32
1
vote
1 answer
Can I have a child element not use the parent's spacing?
Let's say I have a Composable that opens a popup on click:
@Composable fun SomeParent() {
Row(Modifier.spacedBy(4.dp)) {
DatePicker()
}
}
@Composable
fun DatePicker(modifier: Modifier = Modifier) {
var show by remember {…

Jorn
- 20,612
- 18
- 79
- 126
1
vote
1 answer
Compose onValueChange behaviour isn't consistent
I'm making a sudoku game and solver. For my user interface I used LazyVerticalGrid to create a 9x9 grid. I successfully made it so when you click on a cell it will only accept digits [1-9] via an OutLinedTextField. I then added a conditional that…

JD74
- 257
- 1
- 8
1
vote
1 answer
How to make Compose render my custom Shape?
I have this Composable that draws some text with a custom Shape behind it:
@Composable
fun TextWithIcon(text: String, icon: Shape) {
Box(Modifier.size(48.dp)
.border(1.dp, MaterialTheme.colors.secondaryVariant)
…

Jorn
- 20,612
- 18
- 79
- 126
1
vote
0 answers
Compose: Infinite animation with variable speed
I have this code to get an infinite rotation animation:
@Composable
fun RotatingObject(rpm: Int) {
val infiniteTransition = rememberInfiniteTransition()
val rotation by infiniteTransition.animateFloat(
initialValue = 0f,
…

Altline
- 193
- 3
- 10
1
vote
0 answers
Proper way to store tab states in Compose Multiplatform
What is the proper way to store tab content state in Compose Multiplatform? "Remember" keeps state only during recompositions, not when one view replaces another. On Android ViewModel should be used, but in Compose Multiplatform there is no…

Kiryl Tkach
- 3,118
- 5
- 20
- 36
1
vote
0 answers
Gradle builds on Github Actions hangs
I am building my Jetpack Compose Mac OS app using Github Actions.
Sometimes (most of the times), when gradle executes ./gradlew createReleaseDistributable after a while the build hangs and keeps shows the following trace indefinitely causing the…

Alex Styl
- 3,982
- 2
- 28
- 47
1
vote
1 answer
How to place a window permanently in front of another in Jetpack Compose for desktop?
I'm using jetpack compose for desktop in a kotlin project intended for mac/windows use.
My setup looks something like the code below
@Composable
private fun MainWindow(onExit: () -> Unit) {
val mainWindowState = WindowState(size =…

Alexander Fredheim
- 11
- 1
1
vote
2 answers
Why won't my UI update while a background task is running?
I have this code that should show a counter while a background task is running:
@Composable fun startIt() {
val scope = rememberCoroutineScope()
val running = remember { mutableStateOf(false) }
Button({ scope.launch { task(running) } }) {
…

Jorn
- 20,612
- 18
- 79
- 126
1
vote
1 answer
How to refresh UI in Kotlin with Compose desktop when runBlocking?
I'm learning Kotlin and Compose Desktop and I'm trying refresh the UI before fetch data from an API.
But the request is running inside a runBlocking, thus the UI freezes until request is completed.
This is my code, everything works.
val client =…

ramires.cabral
- 910
- 4
- 13
- 28
1
vote
2 answers
How do I set the window size to fit the contents in Jetpack Compose?
I have some content which is exactly 500x500 pixels which I'd like to show in a window.
If I set the window size via state = WindowState(...), it seems to create a window where the size is actually slightly smaller, so the content gets cut…

Hakanai
- 12,010
- 10
- 62
- 132
1
vote
1 answer
How do you make the Enter key move focus in Kotlin Compose Desktop?
I am making a program with a lot of text fields that needs to shift focus once Enter is pressed. They are all set to single line. (It should go to the next text field, once Enter is pressed)
I was using a focus requester, but it turns out in windows…

Cemos121
- 31
- 4
1
vote
0 answers
How to implement Accessibility in Desktop Compose
I am building an app with Desktop Compose Multiplatform for Windows and MacOS platform.
I need to add accessibility support for users.
In Android we have Accessibility Scanner and TalkBack to announce contentDescription and these tools also helps…

SVK
- 676
- 1
- 5
- 17
1
vote
1 answer
How to build Microsoft and Mac OS App with Compose for Desktop with the right approach
I need to develop a desktop app for Windows and Mac OS with Jetbrains Compose Multiplatform
I will use the Kotlin language to design the UI.
But I need guidance on following points:
Which languages will be required for the core logic / calculations…

SVK
- 676
- 1
- 5
- 17