https://kotlinlang.org logo
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
  • g

    Greg Steckman

    07/20/2021, 2:02 AM
    @Oleksandr Karpovich [JB] The release notes for build228 ask about use cases for accessing the event target on an input. One use case is to limit the types of characters that can be entered into a TextInput.
    :thank-you: 1
    h
    o
    • 3
    • 9
  • t

    Tristan

    07/23/2021, 2:25 PM
    Hello, Is
    @Preview
    available with compose-web?
    a
    o
    • 3
    • 3
  • s

    Skovisen

    07/25/2021, 7:52 PM
    An external library I use exposes a function that returns an
    HTMLDivElement
    . My current solution appends this node to the body via
    document.body.appendChild(..)
    but it feels subpar, and I’d like to know what the alternatives are. Is it possible to take this return value and make a composable of it?
    o
    s
    • 3
    • 4
  • n

    Nikolai Wotton

    07/29/2021, 6:34 PM
    I’ve worked a little bit now with both compose for web and compose for android and I’ve noticed quite a few differences. Is the plan to have them eventually meet in the middle as a KMM code-shareable library or are they destined to diverge?
    ➕ 3
    j
    s
    +3
    • 6
    • 10
  • j

    juliocbcotta

    07/31/2021, 6:36 PM
    Hey, is there any Compose Web sample integrating it with Firebase Firestore ?
    b
    • 2
    • 1
  • a

    Arslan Armanuly

    08/01/2021, 10:00 AM
    Had an issue with the multiplatform project with compose-web fronted and ktor backend. apparently adding compose compiler plugin forces having compose runtime in the jvm. in this case i guess it is not that lethal although adding unnecessary dependency is weird
    b
    j
    +2
    • 5
    • 9
  • m

    MrPowerGamerBR

    08/02/2021, 12:57 AM
    I think I found a compiler bug 👀
    a
    o
    +3
    • 6
    • 17
  • m

    MrPowerGamerBR

    08/02/2021, 3:47 PM
    First, yet another bug that I've found that I didn't seem to find someone else reporting this:
    var disableButton by remember { mutableStateOf(false) }
    
                    Button(attrs = {
                        style {
                            width(100.percent)
                        }
    
                        if (disableButton)
                            disabled()
                    }) {
                        Text("This is a button")
                    }
    
                    Button(attrs = {
                        onClick {
                            disableButton = !disableButton
                        }
                    }) {
                        Text("Toggle button")
                    }
    Clicking the second button disables the first button... but it also removes the style (the width: 100%) of the first button!
    😥 1
    o
    • 2
    • 5
  • m

    MrPowerGamerBR

    08/02/2021, 3:47 PM
    Now, something that (I guess) fits this channel: (because, well, related to Compose Web) https://github.com/JetBrains/compose-jb/commit/36295121a2e1446941f006432eb13698fdaa67d9
    👀 1
    k
    u
    • 3
    • 6
  • b

    Big Chungus

    08/03/2021, 11:22 AM
    What's the latest compose-web version?
    o
    h
    l
    • 4
    • 23
  • a

    Alexander Kurasov[JB]

    08/04/2021, 2:01 PM
    We are happy to announce that Compose Multiplatform went Alpha today. The build
    1.0.0-alpha2
    is already available in the Maven repo.  While its API is not completely stabilized, we will strive to minimize API changes in future, focusing on stabilizing the framework on its way to beta and 1.0.  We believe that though the current version may have certain issues, it already could be used for early prototyping and PoC preparations of real applications built on Compose Multiplatform technology.  And as usual - feel free to share feedback about Compose Multiplatform, so that we could improve it. Enjoy composing! P.S. Some details about the Release could be found here - https://blog.jetbrains.com/kotlin/2021/08/compose-multiplatform-goes-alpha/
    :kotlin-intensifies: 31
    🎉 12
    :jetpack-compose: 16
    m
    s
    +4
    • 7
    • 8
  • a

    Arslan Armanuly

    08/04/2021, 4:12 PM
    having trouble with compilation, running task
    browserRun
    gives runtime error that
    renderComposable
    hasn't been replaced by the compose compiler. running
    browserDevelopmentRun
    gives compile error with assertion error(see the reply),
    browserProductionRun
    gives same assertion error
    u
    o
    • 3
    • 17
  • j

    juliocbcotta

    08/04/2021, 7:10 PM
    Is there a Material library that I can use in Compose Web?
    b
    h
    +2
    • 5
    • 8
  • c

    Chachako

    08/06/2021, 6:25 AM
    Why is the current Compose-Web APIs look so strange? Is it possible to use the APIs that is consistent with Desktop, Android?
    ✅ 1
    c
    n
    +2
    • 5
    • 4
  • o

    Oliver.O

    08/06/2021, 12:34 PM
    I'm currently hitting this one:
    Project `...` has `compose` and `kotlinx.serialization` plugins applied!
    >>> Consider using these plugins in separate modules to avoid compilation errors
    In a multiplatform build, it seems there is no way to apply a plugin to a selected module only. Am I correct to assume that a single multiplatform build script cannot be configured to create modules that way?
    ✅ 1
    a
    j
    o
    • 4
    • 5
  • d

    darkmoon_uk

    08/06/2021, 1:10 PM
    Is it a correct impression that '_multiplatform widgets_' for Compose Web are not being developed any further at this point? And that the focus is on polishing HTML+CSS integration only; pending some internal PoC into Canvas Rendering for 'full Compose' later on?
    ✅ 1
    👀 2
    o
    • 2
    • 1
  • b

    Big Chungus

    08/07/2021, 9:35 PM
    Bundle sizes of compose-web are very concerning. my mock sandbox app (that doesn't do anything really..) comes up as 7+MB as production executable. I'm attaching the output if anyone's interested. The source is here. Development bundle is going at 26MB.
    compose-web-sample.zip
    🤨 1
    m
    c
    l
    • 4
    • 14
  • b

    benkuly

    08/11/2021, 2:46 PM
    What components are supported in web? Is there a list or something? Is
    Image
    supported?
    👍 1
    o
    • 2
    • 4
  • s

    sonder-joker

    08/14/2021, 4:19 AM
    I am a little confused about remember function . Compare to react usememory, what's the difference?
    k
    c
    a
    • 4
    • 8
  • m

    Marius Ailinca

    08/14/2021, 10:05 AM
    Hi! Kudos Kotlin! Can we use react npm dependencies with compose-web? Thanks!
    ❤️ 1
    :yes: 2
    f
    • 2
    • 1
  • m

    Marius Ailinca

    08/17/2021, 1:25 PM
    Don't know if this is the proper place to ask this question so sorry if not. I am starting with compose for web with no prior knowledge of the JS ecosystem. I have an error that seems to be related to the version of node which I can't find where I can set it. Gradle uses a version from ~/.gradle/nodejs/node-v14.15.4-linux-x64/. If I don't specify in gradle.properties to use webpack ver4 (kotlin.js.webpack.major.version=4) than I have a runtime issue: Execution failed for task ':jsBrowserDevelopmentRun'.
    [webpack-cli] Invalid configuration object. Object has been initialized using a configuration object that does not match the API schema.
    _- configuration has an unknown property '_assetEmittingWrittenFiles'. These properties are valid: ..._
    👍 1
    ✅ 1
    o
    f
    c
    • 4
    • 5
  • n

    Nikolai Wotton

    08/18/2021, 6:40 PM
    I’ve been making a project in compose for web with relatively few problems thus far, but just hit a snag where it won’t run anymore.
    ./gradlew build
    works fine, but
    ./gradlew jsBrowserProductionRun
    fails consistently now. I’ve rolled back changes to where it was definitely working, so I’m guessing something wrong with my system not the repo. Anyone seen this before? Stacktrace in thread
    ✅ 1
    t
    • 2
    • 8
  • n

    Nikola Milovic

    08/20/2021, 3:48 PM
    Anyone had this happen on Multiplatform web project?
    Caused by: org.gradle.internal.resolve.ArtifactNotFoundException: Could not find runtime-1.0.0-alpha2-samplessources.jar (org.jetbrains.compose.runtime:runtime:1.0.0-alpha2).
    I had similar issue in another library and had to move to default compiler and not IR, and now idk if that breaks
    implementation(compose.runtime)
       implementation(compose.web.widgets)
    I have a KMP project and a web-app module with this in the build gradle
    ✅ 1
    c
    r
    • 3
    • 3
  • a

    andylamax

    08/21/2021, 4:07 AM
    It is getting tricky to author a universal multiplatform Composable at the moment coz I see that The Jetpack Compose Modifier and Compose 4 Desktop are using the exactly same modifier, located at
    androidx.compose.ui.Modifier
    while Compose for Web Modifier is entirely different and currently located at
    org.jetbrains.compose.common.ui.Modifier
    , Isn't this a cry out for expect/actual declaration? Or maybe I am missing something, Can someone in the Compose 4 Web team explain to me why such a decision was made?
    👍 3
    👍🏼 1
    d
    n
    • 3
    • 23
  • t

    Tomasz Krakowiak

    08/21/2021, 6:13 AM
    Are there plans to implement SSR and hydration for compose-web?
    👍 4
    j
    • 2
    • 1
  • d

    Derek Ellis

    08/22/2021, 12:00 AM
    If I'm understanding things correctly, if I pass a plain JS object created like
    js("{...}")
    (or with the
    jsObject()
    helper) to a composable function, there wouldn't be any way for the composable to know when to recompose if a property in that object changed because there's no real equality comparisons for plain JS objects. So if I want to pass data to a composable function, I don't really have a choice but to use Kotlin classes, right?
    ➕ 1
    👀 1
    a
    j
    • 3
    • 2
  • a

    andylamax

    08/22/2021, 2:24 PM
    I remember seeing a
    Modifier.css { }
    somewhere, where is it? Which package? or was it a custom implementation from someone?
    u
    • 2
    • 2
  • u

    [JB] Shagen

    08/24/2021, 12:38 PM
    Hey how you all've been doing? This weeks changes in Compose for Web. https://github.com/JetBrains/compose-jb/releases/tag/v1.0.0-alpha4-build321
    🆒 2
    🚀 14
    h
    d
    • 3
    • 7
  • h

    hfhbd

    08/26/2021, 8:32 AM
    Anybody else getting IR errors during
    compileProductionLibraryKotlinJs
    with latest compose version? https://youtrack.jetbrains.com/issue/KT-48425
    o
    • 2
    • 5
  • d

    Dazai

    08/28/2021, 12:24 AM
    can some one point me to a resource or let me know how to use ktor as a backend to serve a compose-web client?
    👍 1
    b
    c
    h
    • 4
    • 13
Powered by Linen
Title
d

Dazai

08/28/2021, 12:24 AM
can some one point me to a resource or let me know how to use ktor as a backend to serve a compose-web client?
👍 1
b

Big Chungus

08/28/2021, 2:16 AM
https://github.com/mpetuska/kamp/tree/master/app
Not compose-web client, but it doesn't matter sine ktor is just serving js
But if you really need compose setup, I'm currently reworking that app with compose-web on another branch https://github.com/mpetuska/kamp/tree/feature%2Fcompose/app
c

CLOVIS

08/28/2021, 9:31 AM
Essentially the idea would be to copy the JS file generated by Compose into the Ktor server's resource directory, and then tell Ktor to serve it. Here are the exact changes I did to enable that: https://gitlab.com/arcachon-ville/formulaide/-/merge_requests/18/diffs My case is a Kotlin React app, not Kotlin Compose, but it's exactly the same.
d

Dazai

08/29/2021, 12:16 AM
thanks for the helpful examples. do you guys have any examples for routing? like if i click a button on the home page, how do I want to make it take me to the about page/component instead?
b

Big Chungus

08/29/2021, 12:17 AM
Use react-router-dom
d

Dazai

08/29/2021, 12:17 AM
or if i want to call an endpoint with query parameters or something? right now i'm running into cors errors trying to use ktor to get a response from a website like ktor.io in the example
oh will that work well with compose?
i've never used it
b

Big Chungus

08/29/2021, 12:18 AM
Oh wait, it's compose. Then just use hash routing and render your tree depending on parsed hash path
Bit manual, though
d

Dazai

08/29/2021, 1:51 AM
https://github.com/hfhbd/routing-compose this lib looks like it could work pretty well
:jetpack-compose: 1
h

hfhbd

08/30/2021, 6:17 PM
Often it does 😄 BTW the idea of server side rending, like the old days with PHP, is not (yet, maybe never) possible with Compose: https://ktor.io/docs/html-dsl.html#html_response You do have to create a new Gradle module, implement your JS application, create the executable js file and serve it with Ktor. (of course you could rendering your
index.html
file with Ktor...) The packing could be done by Gradle tasks, see the official Ktor server templates created by the Kotlin plugin (new project, Kotlin, server template).
View count: 9