https://kotlinlang.org logo
Docs
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
compose-web
  • j

    John O'Reilly

    10/12/2022, 12:58 PM
    Is there any particular recommended way of having a Kotlin 1.7.20 project with Compose for Desktop and Web (but just Kotlin 1.7.10 for Web as is needed right now)?
    i
    j
    • 3
    • 5
  • n

    Norbi

    10/12/2022, 8:49 PM
    For some time I often get this error during development:
    e: java.lang.IllegalStateException: Provide file symbol
    	at org.jetbrains.kotlin.backend.common.serialization.IdSignatureDeserializer.deserializeFileIdSignature(IdSignatureDeserializer.kt)
    	at org.jetbrains.kotlin.backend.common.serialization.IdSignatureDeserializer.deserializeSignatureData(IdSignatureDeserializer.kt:90)
    Have you seen something similar, or do you have an idea? (I use Kotlin 1.7.10 + Compose/Web 1.2.0 + Idea Kotlin plugin 1.7.20) My workaround is to do a clean build or to disable incremental JS compilation :(
    • 1
    • 1
  • d

    David Herman

    10/13/2022, 3:15 AM
    I'm trying to update my project to Compose for Web 1.2.0 + Kotlin 1.7.10. When I run, I'm getting this error message in my console:
    Uncaught Error: Error loading module 'site'. Its dependency 'androidx-runtime' was not found. Please, check whether 'androidx-runtime' is loaded prior to 'site'
    Anyone else seeing this? I'll drop more details in a 🧵
    • 1
    • 8
  • i

    Ivan Prykhodko

    10/14/2022, 11:23 AM
    Hello everyone, is there any way to apply dynamic resolution in canvas based implementation?
  • i

    Ivan Prykhodko

    10/14/2022, 11:27 AM
    Also does anyone have any suggestions on how to represent TextField as input (mobile browser doesn't open keyboard when i click on it) in canvas based impl?
  • n

    Norbi

    10/14/2022, 12:49 PM
    Is there a type-safe way to set CSS
    margin: auto
    ? Currently I use this:
    property("margin", "auto") // Somehow: margin(auto) ???
    Thanks.
    h
    • 2
    • 1
  • e

    Erik

    10/16/2022, 2:05 PM
    In my
    StyleSheet
    if I have defined a style class
    val x by style {}
    and I want to apply it to a raw selector, e.g. a
    <button>
    , is that possible? For example:
    object MyStyleSheet : StyleSheet() {
        val x by style {}
    
        init {
            "button" by style {
                // Here apply class x from above
            }
        }
    }
    My use case: define 1 style class for round corners and apply that class to the various elements that I want to style like that. Maybe I need a different approach, I'm open to suggestions.
  • e

    Erik

    10/16/2022, 3:09 PM
    I have run into a limitation of the Kotlin language (not sure if really the case, but I feel limited) that others likely will run into as well. I've defined a composable like so
    @Composable
    fun MyComposable(vararg composables: @Composable () -> Unit) { /* impl */ }
    Now I want to let the caller pass some styling also, so I refactor it to:
    @Composable
    fun MyComposable(
        attrs: AttrBuilderContext<HTMLDivElement>? = null,
        vararg composables: @Composable () -> Unit
    ) { /* impl using a div that applies attrs */
    }
    Now all my code no longer compiles, because wherever I used to call e.g.
    MyComposable(
        { /* Some composable */ },
        { /* Some composable */ },
    )
    now suddenly the first lambda is used as the
    attrs
    parameter! It doesn't compile, luckily, because it's not allowed to call a
    @Composable
    function from a non-composable context: the
    AttrBuilderContext
    happens to be a lambda that
    @Composable () -> Unit
    fits into... 🤦‍♂️ A coincidence, but one that will likely happen to more users. The workaround beats the purpose of using a lambda in the first place:
    MyComposable(
        composables = arrayOf(
            { /* Some composable */ },
            { /* Some composable */ },
        )
    )
    This works, and is not nice. See also this thread.
    n
    • 2
    • 5
  • s

    Sebastien Leclerc Lavallee

    10/17/2022, 4:06 PM
    Hello everyone! I have a simple edit page to update a user profile. My UserProfile is something like that:
    data class UserProfile(var name: String, var email: String, var password: String)
    Inside my view model, I have something like that:
    class ViewModel {
      var userProfile by mutableStateOf(UserProfile())
    }
    And now I use it like that:
    fun EditProfileScreen(viewModel: ViewModel) {
      TextInput(value = viewModel.userProfile.email, attrs = {
        onInput { viewModel.userProfile.email = it.value }
      }
    }
    Now, from what I experienced / understand, if I modify a field from my user profile, I can’t modify it directly like I did. I would have to do something like that:
    viewModel.userProfile = viewModel.userProfile.copy(email = newEmail)
    I need to copy the whole object because Compose won’t be able to detect a change and won’t trigger a recompose. And when copying, it’s a new object and this will recompose. Now is the copy way of doing thing would be the best way? Or should I do expand my UserProfile with multiple state like:
    class ViewModel {
      private var userProfile = UserProfile()
      var email by mutableStateOf(userProfile.email)
      var name by mutableStateOf(userProfile.name)
    }
    And edit them directly and when I click save, I would get the current value from all states. Or have states as read only and then have setter function to update the main class:
    val email by mutableStateOf(userProfile.email)
      private set
    
    fun setEmail(newEmail) {
      userProfile.email = newEmail
      email = newEmail
    }
    Or is there any other way of doing this that I don’t think of? Thanks! 🙂
    r
    • 2
    • 7
  • e

    Erik

    10/17/2022, 8:11 PM
    Is Gradle task
    jsBrowserDistribution
    (produces ./build/distributions/) still the way to publish a compose website? I think so, but it's not very well documented AFAI can find
    b
    • 2
    • 5
  • k

    Kristian Nedrevold

    10/18/2022, 2:01 PM
    How do you define validators for Input fields? I see that there is an onInvalid method, but I can't seem to figure out how to set validity
    • 1
    • 2
  • n

    Norbi

    10/22/2022, 6:29 PM
    I've just seen a new compose-jb release: https://github.com/JetBrains/compose-jb/releases/tag/v1.3.0-alpha01-dev827 Does it already support Kotlin 1.7.20 in case of Compose/Web as well? Thanks.
    h
    c
    • 3
    • 9
  • d

    Dragos Rachieru

    10/24/2022, 1:56 PM
    Hello, I'm trying to use compose web with canvas but I'm getting some errors when running the project:
    onWasmReady is not defined
    I searched the examples and they look like I need to use webpack
    4.9.0
    When I set that version, I get a new error:
    cli.isMultipleCompiler is not a function
    d
    z
    +3
    • 6
    • 23
  • e

    Erik

    10/29/2022, 8:06 AM
    The CSS variables example found here doesn't work. In my code I cannot set the variable, e.g.
    MyVariables.contentBackgroundColor(Color("blue"))
    seems impossible. Do I need to import anything? I can't find a setter/`invoke` operator in the source either. Was it removed?
    • 1
    • 3
  • e

    Erik

    10/29/2022, 9:02 AM
    How would you do color calculations? E.g. I have some RGB or hex color. How would you make it e.g. 15% darker or lighter?
    d
    d
    n
    • 4
    • 15
  • b

    Big Chungus

    11/01/2022, 3:38 PM
    I'm curious if there are any rumours about CfW canvas on the upcoming Kotlin/Wasm? Seems like a natural fit and a good way to reduce the number of wasm-to-js jumps
    o
    d
    b
    • 4
    • 9
  • a

    Andromadus Naruto

    11/04/2022, 3:18 PM
    Good day. Does anyone have an idea when Compose Multiplatform (Web) will be compatible with Kotlin 1.7.20?
    i
    j
    h
    • 4
    • 7
  • l

    Loboda Deni

    11/07/2022, 10:32 AM
    Does anyone know if it's possible to store image resources in another gradle module?
    m
    o
    +2
    • 5
    • 7
  • a

    andylamax

    11/07/2022, 3:45 PM
    is there a way to setup a compose library (even with `expect`/`actual`) so that I can have different implementation for Compose4Web (Dom) and Compose4Web (Canvas) ?
    j
    b
    h
    • 4
    • 10
  • j

    Jeff Lockhart

    11/09/2022, 5:06 PM
    Are there plans for compose web with canvas to support text selection?
    z
    • 2
    • 1
  • s

    Sam Stone

    11/09/2022, 7:35 PM
    Does Compose web by default use material design?
    b
    • 2
    • 3
  • f

    FunkyMuse

    11/11/2022, 8:13 AM
    Is there any list to know what's currently supported by compose4web canvas?
  • o

    oday

    11/11/2022, 9:22 AM
    hi
  • o

    oday

    11/11/2022, 9:23 AM
    I’m just starting out with this, and I would like for example to use
    Modifier
    , the main goal is to use a Composable component that I made elsewhere, here on web
    h
    r
    +2
    • 5
    • 26
  • l

    Loboda Deni

    11/11/2022, 12:09 PM
    Is it possible to create preview for some widgets like @Preview function?
    h
    b
    • 3
    • 4
  • c

    CLOVIS

    11/11/2022, 7:24 PM
    Hi! Is there a small navigation library available for Compose Web yet? I don't need anything big, just something basic that works well with Compose. Hopefully multiplatform. I've been trying to roll my own thing out but I'm not convinced by the results.
    c
    h
    +3
    • 6
    • 17
  • t

    theapache64

    11/16/2022, 5:27 AM
    Another Compose Web App : https://twitter.com/theapache64/status/1592740231627018245 🚀
    h
    • 2
    • 10
  • j

    jeff

    11/16/2022, 8:09 PM
    Let's say I have
    images.forEach { Img(image.url, ...) }
    Now, I change images, and get a recomposition. What's the recommended way to make the
    Img
    s slide into their new position instead of instantly popping? I tried adding some css transitions but no luck.
    o
    • 2
    • 1
  • e

    Erik

    11/16/2022, 10:40 PM
    Just cross-posting this issue here for visibility. Maybe someone knows something about it: https://github.com/JetBrains/compose-jb/issues/2474
  • c

    CLOVIS

    11/19/2022, 11:37 AM
    Is it possible to make web components out of Compose Web composables?
    a
    • 2
    • 2
Powered by Linen
Title
c

CLOVIS

11/19/2022, 11:37 AM
Is it possible to make web components out of Compose Web composables?
a

andylamax

11/19/2022, 3:23 PM
Not at the moment, especially not when the compiler cant yet generate ESX compatible code
c

CLOVIS

11/19/2022, 4:50 PM
Ok, too bad
View count: 31