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
  • c

    corneil

    12/09/2021, 10:32 AM
    @darkmoon_uk I was thinking this might be the case. It looks like http://github.com/mpetuska/kmdc has some useful stuff already. It is unfortunate that it will be a duplication of the work being done by Jetbrains and Google.
    👍 1
    b
    • 2
    • 1
  • c

    corneil

    12/09/2021, 10:43 AM
    🤦
    d
    • 2
    • 1
  • j

    jim

    12/09/2021, 2:56 PM
    It's worth noting that the current approach for material support is canvas-based. Using canvas means we get good compatibility and interop with other platforms, but comes with some drawbacks (like performance of loading the entire canvas, not being DOM-based impacts SEO and devtools, etc). Depending on your use case, you may still find value in something like kmdc and wrapping HTML/DOM based widgets for use in Compose for Web.
    👍 5
    👌 3
    s
    e
    c
    • 4
    • 3
  • g

    Greg Steckman

    12/10/2021, 4:50 AM
    Has anyone noticed somewhat sluggish rendering performance? I ran the profiler in Chrome and a lot of time is spent in a function named isInterfaceImpl. I'm not sure if it's something unusual I am doing in my code that is causing this.
    o
    o
    • 3
    • 4
  • l

    LeoColman

    12/11/2021, 3:08 PM
    Hey guys! How do you organize your projects to play around with the UI? I tried to create the structure: -- jsMain -- components -- MyComponent.kt <-- Contains a @Composable function that I want to render -- jsTest -- components -- MyComponentPlayground.kt <-- Launches only MyComponent, so I can develop it instead of rendering all the screen But I don't really know how to run this custom component. I tried creating a
    suspend fun main() {
            renderComposable("root") {
            Style(AppStyleSheet)
            component()
        }
    }
    but I don't know how I'd execute this main. I was going to write a simple main for every component, but that doesn't seem very feasible
    b
    • 2
    • 6
  • d

    Daniel Perez

    12/13/2021, 5:07 AM
    Is it possible to load a .txt file from the resources directory? I am recreating a small website I made in React using Compose for Web and am having a hard time recreating the following in Kotlin:
    import TestVar from './files/TestFile.txt';
    ...
    var text = TestVar.text();
    Can I use the Kotlin/JS module system to recreate the above?
    a
    • 2
    • 3
  • a

    Akram Bensalem

    12/17/2021, 12:30 PM
    Why I don't have option to add the 
    --continuous
     flag to the arguments for the run configuration ? I don't have
    browserDevelopmentRun
    instead I have
    jsBrowserDevelopmentRun
    Any help please ?
    b
    • 2
    • 5
  • a

    Akram Bensalem

    12/19/2021, 8:38 AM
    I want to learn how to write tests in Compose Web but I always get this error
    Or change it via
    browser {
    testTask {
    useKarma {
    useFirefox()
    useChrome()
    useSafari()
    }
    }
    }
    Note: in my computer I have just "Microsoft Edge" What I have to do ?
    o
    j
    • 3
    • 2
  • d

    Dirk Hoffmann

    12/20/2021, 9:58 AM
    I am struggling to get my compose web to run in a multiproject multiplatform layout: root project is defining all plugins but all with apply = false Now project compiles fine, but
    gradle jsBrowserRun
    shows an empty Browser page, I guess because build/processedResources ends up in the subprojects build folder, but build/js ends up in the roots build folder ... how do I get this to work from the js being soley in the subproject?
    b
    • 2
    • 31
  • t

    Tóth István Zoltán

    12/20/2021, 1:19 PM
    Hi! Am I correct that Compose works only for functions but not for classes? I mean is it possible to use a class as a Composable? I worked quite a lot with React and I really didn't like when they started the shift to a function only approach. Seems good at first, but complicates things later.
    a
    b
    +2
    • 5
    • 14
  • a

    Akram Bensalem

    12/21/2021, 7:57 PM
    I'm struggeling with CSS style! and I found that there is a Module 
    compose.web.widgets
     which provides a collection of Composable components that conform to the API and behaviour of some widgets from Jetpack Compose UI like: 
    Column
    , 
    Row
    , etc But it's deprecated is there any issue or disadvantages using them ?
    b
    d
    • 3
    • 4
  • d

    dodalovic

    12/21/2021, 8:57 PM
    Does someone have an example with compose web + router?
    b
    h
    • 3
    • 8
  • f

    Foso

    12/23/2021, 10:59 AM
    Hey everybody, i wrote a tool to convert HTML to Compose for Web Composables https://github.com/Foso/HtmlToComposeWebConverter
    :kotlin-intensifies: 14
    👍 6
    a
    s
    +2
    • 5
    • 11
  • b

    Big Chungus

    12/23/2021, 4:39 PM
    :kotlin-intensifies: 10
    a
    r
    • 3
    • 5
  • c

    Chris Sinco [G]

    12/24/2021, 6:44 AM
    Anyone have issues using the
    Iframe
    builder in 1.0.0? It seems that IntelliJ can't resolve the attributes within the attribute builder which is odd since you can see the inlay hints are registering and I see them in the definition source in the IDE...
    u
    • 2
    • 4
  • u

    [JB] Shagen

    12/24/2021, 11:13 AM
    My fellow Composers and, in particular, Web Composers, I’m writing a small message on behalf of Compose Multiplatform team. It’s about so called Web Widgets. As may of you might already noticed they are obsolete starting from the 1.0 Release. The reason for this is that we’ve decided to invest heavily in reusing widgets (or UI components - whatever you prefer to name it but you got the idea I believe) between Android, Desktop and Native platform. This approach implies that we’ll have a canvas-rendered UI components in Web and this approach has many benefits. But at the same time it has some drawbacks compared to a mature DOM-based widget API which is based on same design concepts like “regular” Compose UI. However as of now we feel like we just don’t have enough time to invest in such API. Apart from concentrating on canvas-rendered components (which is goal #1 for us), we’ve decided to focus on DOM layer since there are still a lot of things that need to be addressed in that aspect. Third goal will just scatter our attention. That said we are planning to remove web widgets completely as soon as we’ll introduce canvas API. It does not mean that we wont reconsider sometime in future when we’ll feel that we have enough expertise and time to try again. Meanwhile I want to point out that community already is delivering some very strong alternatives to what we’ve offered to you. Consider, for instance, this project - https://github.com/mpetuska/kmdc Happy Christmas and/or festive season!
    :kotlin-intensifies: 23
    👀 1
    👍 9
    b
    s
    +2
    • 5
    • 5
  • b

    Big Chungus

    12/26/2021, 10:23 PM
    Is there a particular reason why
    ElementScope<T>
    is an interface, but
    AttrsBuilder<T>
    is a class? It'd be great if you could make
    AttrsBuilder<T>
    an interface as well as this would allow injecting some custom DSL for attrs builder (without polluting global namespace as those DSLs are usually only meant for that particular component based on HTMLDivElement and not all HTMLDivElements) when using compose-web to wrap custom components. Here's how I'm utilising the fact that
    ElementScope<T>
    is an interface already (although it only works for lower-level components and is kinda hacky).
    👀 1
    o
    • 2
    • 10
  • t

    Tim Ortel

    12/28/2021, 10:38 AM
    Can I share compose Code from my desktop and Android app with my web app? I've tried to setup a multiplatform project but it looks like compose.ui, compose.foundation etc do not exist for web
    b
    h
    • 3
    • 9
  • k

    kenkyee

    12/29/2021, 3:58 PM
    Has anyone gotten Compose for Web working with Okta authentication?  Only thing I've dug up is this thread: https://devforum.okta.com/t/support-for-android-jetpack-compose-kotlin/16511 None of the examples here seem to hook into npm libraries unlike the KotlinJS examples: https://compose-web.ui.pages.jetbrains.team/ Basically wondering if it's possible to do OIDC auth to grab a JWT token to do API calls to a backend in Compose for Web...
    g
    • 2
    • 3
  • c

    corneil

    12/31/2021, 8:15 AM
    It seems that we have 2 directions for Compose Web. The current team is working on a canvas based approach similar to Flutter which will provide a shared UI model Jetpack Compose and Desktop. Compose Web also allows a normal web development model and the
    kmdc
    effort aims to provide Material web components. This divergence isn't a bad thing because the WebComponents path provides a path to converting from other web frameworks. Maybe we should name these to paths and be explicit about the shared core. You would probably not use any npm packages in the Web Canvas platform. BTW @Big Chungus how about #kmdc?
    ➕ 4
    b
    g
    • 3
    • 15
  • s

    spierce7

    12/31/2021, 5:06 PM
    similar to Flutter
    Flutter has 2 rendering approaches for web actually. A canvas based approach for speed and correctness, and a dom based approach for binary size, accessibility, and seo. Canvas is the more commonly used one I would imagine.
    b
    m
    • 3
    • 16
  • m

    MrPowerGamerBR

    12/31/2021, 6:47 PM
    Smol bug that I've found but I still need to document it better: While I was trying to integrate EasyMDE in Compose, I found out that if you call a "mutableStateOf(...)" variable within a "ref" block, the compiler will crash with "`Validation failed in file`" (Semi) Unrelated to the bug above: And here's how I ended up implementing it if anyone is interested :3 (the EasyMDE classes were generated by dukat). I know, it seems kinda obvious in handsight but I was banging my head trying to figure out how could I force a recomposition of a "ref" block (even if the "i18nContentDataMap" variable changed, it wasn't recomposing, because "ref" is only called if the element was removed from the current composition), which then I figured out that what I should do is create a div and then create the textarea with JS code. You can't use DomSideEffect within a TextArea because you aren't able to access it there https://gist.github.com/MrPowerGamerBR/bba1208e3db6a29b51cd350f9cf904f4
    b
    • 2
    • 9
  • r

    Rohan Maity

    01/04/2022, 6:24 AM
    Hello while working on multiplatform project, I am sharing mu compose UI between android and Web I have created a  
    composable
      shared multiplatform module, inside that I have put some compose libraries as 
    commonMain
    Android app runs fine, but when I try to run 
    ./gradlew jsBrowserRun
      it fails to resolve all the compose dependencies
    b
    • 2
    • 21
  • r

    Rohan Maity

    01/04/2022, 1:28 PM
    Hello. my multiplatform Compose-web app is not picking up the
    index.html
    I get completely blank error state screen
    b
    • 2
    • 31
  • k

    Kiryushin Andrey

    01/04/2022, 3:23 PM
    Hi! I've tried to use Compose for web in a pure Kotlin JS module, and it fails to compile with a cryptic assertion error within the Kotlin JS compiler backend. Is Compose expected to work with Kotlin JS Gradle plugin at all? Looking through all the samples, I now see that all of them use multiplatform gradle plugin, even if they have JS as the only target... Here is the repro - https://github.com/Kiryushin-Andrey/compose-web-js-bug-repro, it is basically a copy of https://github.com/JetBrains/compose-jb/tree/master/templates/web-template with
    multiplatform
    replaced with
    js
    in gradle scripts.
    r
    • 2
    • 1
  • r

    Rohan Maity

    01/05/2022, 4:03 AM
    Hello, in my multiplatform compose web app, I am facing issue while rendering the generated JS browser says
    The resource from "<http://localhost:8080/my-file.js>" was blocked due to MIME type ("text/html") mismatch (X-Content-Type-Options: nosniff).
    I have confirmed the name and its getting generated in the same folder as index html Not sure what is the reason Anyone faced a similar issue ?
    • 1
    • 1
  • p

    Paul

    01/05/2022, 8:06 AM
    Hey, general question about the intent of compose-web and compose-desktop. When I first read about it, I though it would be a set of tools that would allow me to share UI code across web and desktop targets. But it looks like the web and desktop are quite divergent, and only the very base concepts are shared between. I even noticed that the web widgets (which seemed to be a step in that direction) was deprecated. Is it the intent of these projects to remain divergent, or will they ever converge?
    👀 1
    r
    m
    +4
    • 7
    • 19
  • j

    Joost Klitsie

    01/11/2022, 8:51 AM
    Hello! I was wondering: With release 1.0, is compose for web ready for production in terms of stability? I see some people calling it a toy, but I guess that is only because there aren't that many 3rd party libraries and you have to construct everything by yourself (e.g. like material design, even though there is now a lot of effort put into kmdc). Am I right that in terms of "what you see is what you get", compose for web is stable and production ready right?
    b
    s
    +2
    • 5
    • 11
  • d

    darkmoon_uk

    01/12/2022, 2:19 AM
    As a follow-up to @Joost Klitsie’s question: The much-anticipated :compose-multiplatform: Canvas Compose for Web & iOS... 🙏 When might we see the first public (early-access) builds? Roughly are we talking 3 months, 6 months... a year? I hesitate to ask for sounding impatient which is not my intent; JB do great work and quality takes as long as it takes, but it would be really good to have a clue as it affects some plans I have for a Multiplatform Project already well underway...
    👍 1
    b
    o
    m
    • 4
    • 4
  • o

    Ovsyannikov Alexey

    01/13/2022, 12:55 PM
    Hello everybody 🙂 I am creating a library for compose web, but in case I am trying to use this library I am getting next error:
    e: java.lang.AssertionError: No such value argument slot in IrCallImpl: 6 (total=6).
    Symbol: dev.inmo.jsuikit.elements/TextField|2280372978393256425[0]
    I am looking for compose web module (which is depend on core) and trying to find differences with my project, but can't find any. Can anybody help me to understand what is wrong?
    ✅ 2
    o
    • 2
    • 1
Powered by Linen
Title
o

Ovsyannikov Alexey

01/13/2022, 12:55 PM
Hello everybody 🙂 I am creating a library for compose web, but in case I am trying to use this library I am getting next error:
e: java.lang.AssertionError: No such value argument slot in IrCallImpl: 6 (total=6).
Symbol: dev.inmo.jsuikit.elements/TextField|2280372978393256425[0]
I am looking for compose web module (which is depend on core) and trying to find differences with my project, but can't find any. Can anybody help me to understand what is wrong?
✅ 2
o

Oleksandr Karpovich [JB]

01/13/2022, 3:37 PM
As we discussed this in private messages, the issue was caused by the fact the kotlin-js gradle plugin was applied, while it's necessary to apply multiplatform plugin in order to use compose for web.
👍 2
View count: 13