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

    Oluwasomidotun Victor

    09/11/2022, 1:18 PM
    Hello I just started with compose web, I don't know if someone can help with resources to learn compose web
  • s

    spierce7

    09/11/2022, 6:17 PM
    Has anyone found a way to position html inside of compose canvas widgets yet, I wonder?
  • s

    S.

    09/11/2022, 7:08 PM
    Yes, we already decided the release date of Compose Multiplatform 1.2.0
    https://github.com/JetBrains/compose-jb/issues/2254 just asking whether we have some more details about the release date?
  • d

    Dmitriy Malayev

    09/15/2022, 7:52 AM
    Any tips on making a header and footer with Kotlin and IntelliJ ?
    c
    • 2
    • 3
  • t

    Tunji Dahunsi

    09/17/2022, 12:46 PM
    Does Compose Web have something similar to renderToString() from React, or way of easily creating one? I need it for server side rendering
    b
    • 2
    • 4
  • c

    Christian Lippka

    09/18/2022, 3:59 PM
    I like to start a project using ktor latest as backend and compose-web latest as frontend. I find multiple tutorials and templates for both of them separately but I can’t figure out how to combine the gradle configurations to have a multiplatform build with ktor and compose-web as browser frontend. Does anyone have an example gradle config that works?
    b
    h
    f
    • 4
    • 20
  • j

    jossiwolf

    09/18/2022, 6:00 PM
    Has there been any thought/ideas around Compose Web components <> canvas-based components interop?
    s
    d
    a
    • 4
    • 9
  • e

    Eduardo Zuza

    09/21/2022, 9:32 PM
    I have 2 questions... using compose web how can I set focus on a given input? ... when I could use the DOM, for example: document.getElementById("inQtd"), I put it in several places in my font and it doesn't recover anything. Grateful
    b
    • 2
    • 4
  • d

    Derek Gelormini

    09/23/2022, 5:54 PM
    👋 Starting to play around with Compose Web and just wondering if there are any good examples of submitting multipart form data to a ktor backend? I’m able to upload files to my ktor endpoint fine via
    curl
    , but when I try submitting the form from compose, the multipart data never shows up. Coming from an Android background so my web skills are pretty rusty these days--definitely could just be missing something obvious
    b
    n
    • 3
    • 9
  • e

    Erik

    09/24/2022, 2:11 PM
    How do I scroll a scrollable element to the bottom from Kotlin/jb-compose code? Use case: I have an element that can grow in vertical size (child elements are added to the bottom), and that has a max height, and on overflow it scrolls, e.g.:
    Div(attrs = {
        style {
            maxHeight(8.em)
            overflow("scroll")
        }
    }) { /* content */ }
    When the content overflows, I'd like the scrollable element to scroll to the bottom (by default it stays at the current scroll position, which is the top if never scrolled). I've found solutions in JS that probably work, but I'd like to know if this can be done nicely from my Kotlin code.
    b
    • 2
    • 18
  • s

    Sebastien Leclerc Lavallee

    09/25/2022, 4:15 AM
    Is there a compose web compiler working with Kotlin 1.7.20-RC? I did update my compose to:
    id("org.jetbrains.compose") version "1.2.0-beta02-dev795"
    But after compiling, I get that error: `This version (1.3.0) of the Compose Compiler requires Kotlin version 1.7.10 but you appear to be using Kotlin version 1.7.20-RC which is not known to be compatible. Please fix your configuration (or
    suppressKotlinVersionCompatibilityCheck
    but don't say I didn't warn you!).` Thanks!
    m
    h
    • 3
    • 5
  • m

    Michael Paus

    09/25/2022, 12:03 PM
    Can anybody tell me how to read/write a file in a browser based multiplatform Compose application. I am using Okio for the other platforms but that does not seem to work in a browser although it does support JS. Note: I am not talking about accessing the users local file system. I just need to cache some files locally over multiple sessions inside the browsers sandbox. (I have to admit that I know next to nothing about browser work, so please bear with me.)
    b
    c
    s
    • 4
    • 6
  • s

    steamstreet

    09/30/2022, 4:05 AM
    I’m trying to include a rich HTML editor, and TinyMCE seems to be pretty good, and they have a web components implementation. I’m able to create the component, which was quite straightforward. Here’s kind of the starting point:
    import androidx.compose.runtime.Composable
    import kotlinx.browser.document
    import org.jetbrains.compose.web.attributes.AttrsScope
    import org.jetbrains.compose.web.dom.ElementBuilder
    import org.jetbrains.compose.web.dom.TagElement
    import org.jetbrains.compose.web.dom.Text
    import org.w3c.dom.Element
    import org.w3c.dom.HTMLElement
    
    private open class ElementBuilderImplementation<TElement : Element>(private val tagName: String) :
        ElementBuilder<TElement> {
        private val el: Element by lazy { document.createElement(tagName) }
    
        @Suppress("UNCHECKED_CAST")
        override fun create(): TElement = el.cloneNode() as TElement
    }
    
    class TinyMCEAttrsScope(
        attrsScope: AttrsScope<HTMLElement>
    ) : AttrsScope<HTMLElement> by attrsScope {
    
        fun apiKey(key: String): TinyMCEAttrsScope = apply {
            attr("api-key", key)
        }
    
        fun hideMenuBar(): TinyMCEAttrsScope = apply {
            attr("menubar", "false")
        }
    
        fun plugins(vararg list: String): TinyMCEAttrsScope = apply {
            attr("plugins", list.joinToString(" "))
        }
    
        fun toolbar(defn: String): TinyMCEAttrsScope = apply {
            attr("toolbar", defn)
        }
    }
    
    @Composable
    fun tinyMce(attrs: TinyMCEAttrsScope.() -> Unit = {}, content: String) = TagElement(
        ElementBuilderImplementation<HTMLElement>("tinymce-editor"), applyAttrs = {
            val tinymceAttrsBuilder = TinyMCEAttrsScope(this)
            tinymceAttrsBuilder.attrs()
        }) {
     Text(content)
    }
    What I’m struggling with is events. The developer claims that input events are fired, but I’ve tried different ways to install the handler to no avail. I’ve tried to get other events as well, and I just don’t get callbacks. Any thoughts on how I would install these event handlers?
    • 1
    • 2
  • e

    Erik

    09/30/2022, 8:24 AM
    If I declare a stylesheet property like
    val styleA by style { /*..*/ }
    , is there a way to define a
    styleB
    that inherits from
    styleA
    ?
  • l

    Leon Linhart

    10/02/2022, 6:20 PM
    Is it possible to configure the canvas background to be transparent when using the WebAssembly target? I guess I would have to customize the clear color (assuming the skiko layer is configured to support alpha) but I can't find the API to do that.
  • j

    John O'Reilly

    10/04/2022, 5:44 PM
    Has anyone been able to get Compose for Web app working with Kotlin 1.7.20.....using
    1.2.0-beta03-dev803
    and getting following
    java.lang.AssertionError: org.jetbrains.kotlin.ir.expressions.impl.IrCallImpl@7bda6b02: No such value argument slot: 1
    	at org.jetbrains.kotlin.ir.expressions.IrMemberAccessExpression.putValueArgument(IrMemberAccessExpression.kt:50)
    	at androidx.compose.compiler.plugins.kotlin.lower.ComposerParamTransformer.withComposerParamIfNeeded(ComposerParamTransformer.kt:214)
    h
    • 2
    • 8
  • d

    Dragos Rachieru

    10/04/2022, 9:18 PM
    Can I create a PWA using compose for desktop? Can I do it for canvas as well?
    b
    d
    c
    • 4
    • 9
  • j

    John O'Reilly

    10/05/2022, 1:51 PM
    should there be a
    1.0.0-beta03
    version for Compose for Web (as there is for Desktop)?
    i
    h
    +2
    • 5
    • 15
  • m

    Mihai Voicescu

    10/06/2022, 1:46 PM
    What do you use for state management? As far as I know Redux is a popular choice, but given that the rest of the team is heavily using MVVM architecture I am wondering if an MVVM architecture would make sense on the web.
    c
    • 2
    • 1
  • e

    Erik

    10/06/2022, 3:40 PM
    If I want to apply a color to some element, can I modify only one of its color properties? E.g. it might have RGB color
    (r, g, b)
    , and I only want to set
    a = 0.3
    . Is there a way to simply set A, without changing RGB? (Or, more advanced, is there a way to transform RGBA by multiplying it with a vector of RGBA factors? For example, to reduce alpha to 30% of its current value, I'd multiply by [1, 1, 1, 0.3].)
    • 1
    • 1
  • j

    jeran

    10/06/2022, 6:26 PM
    hi everyone, i’m working on trying to get a compose/canvas project working. i’ve got a simple project that displays a hello world
    Text
    composable centered in a
    Box
    . running
    ./gradlew jsBrowserRun
    works fine. it opens to localhost:8080 and displays what I expect. but i’m trying to figure out how to eventually embed this in a website. I thought that
    ./gradlew jsBrowserDistribution
    was the command I wanted, and then I could open
    foo/build/distributions/index.html
    locally and I should see the same result. but right now i’m just getting an empty screen. i have a separate project that uses the compose/dom approach, and calling
    ./gradlew jsBrowserDistribution
    and navigating to
    foo/build/distributions/index.html
    works fine. Is there a step I’m missing for the compose/canvas approach?
    m
    • 2
    • 3
  • k

    Kostas C

    10/07/2022, 5:01 PM
    Hey! What's the preferred way to do data charts in compose for web? Chartscss.org should be easy enough to implement but does anyone have a working example with javascript based charts?
    h
    • 2
    • 1
  • j

    jeran

    10/07/2022, 7:27 PM
    hello again, has anyone figured out how to load fonts in compose/canvas?
    a
    d
    j
    • 4
    • 26
  • k

    Kristian Nedrevold

    10/08/2022, 1:10 PM
    Are there any good resources for learning compose-web besides what is listed at https://compose-web.ui.pages.jetbrains.team/? The docs on kotlinlang seems to have a lot for kotlin react, but not much for compose-web.
    c
    • 2
    • 1
  • a

    Ayfri

    10/08/2022, 2:07 PM
    Hi, I have a very weird error, I can't use the
    required
    attribute since beta, it leads to an error that this specific function isn't a function when accessing the website, I'm using Kt 1.7.10 and tried with both 1.2.0-beta01 & beta02, I also use this attribute in a function where there is a boolean
    required
    argument.
    h
    • 2
    • 7
  • m

    magnumrocha

    10/11/2022, 10:27 AM
    morning guys, is there any Compose Web StyleSheet open-source code/framework ?
    b
    • 2
    • 7
  • t

    than_

    10/11/2022, 11:34 AM
    Hi, trying again compose web after some time. If I remember correctly (and that is a big if) there used to be an alternative to dom api that provided layouts like
    Column
    Row
    etc. Can't really find anything like it now. Is it available somewhere?
    m
    b
    • 3
    • 4
  • a

    Ayfri

    10/11/2022, 10:51 PM
    message has been deleted
    i
    • 2
    • 1
  • z

    zt

    10/12/2022, 1:14 AM
    Using the canvas feature, how can I load an image from a url?
    m
    • 2
    • 1
  • z

    zt

    10/12/2022, 3:10 AM
    Also, how can I style text with a font from a URL in the canvas?
Powered by Linen
Title
z

zt

10/12/2022, 3:10 AM
Also, how can I style text with a font from a URL in the canvas?
View count: 20