Skip to content

Display popup dialog or modal #549

Answered by bitspittle
adityatri asked this question in Q&A
Discussion options

You must be logged in to vote

Silk does not currently have a modal widget (one day, we plan to!), but here's something I implemented myself in an old project. Feel free to check it out and modify it as needed for your case. (Silk does have an Overlay widget that creates a full screen transparent gray foundation which we use here)

Here, my modal class is designed to allow a row of title elements that appear at the top, a row at the bottom (useful for buttons), and then the content area, which lays things out as a column:

import androidx.compose.runtime.*
import com.varabyte.kobweb.compose.css.*
import com.varabyte.kobweb.compose.dom.ElementRefScope
import com.varabyte.kobweb.compose.foundation.layout.Column
import com.…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@adityatri
Comment options

Answer selected by adityatri
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants