Build responsive apps with compose
Vary
is a lightweight, intuitive responsive layout library for Compose
It helps you effortlessly adapt your UI to different screen sizes like phones, tablets, and desktops using a clean, Kotlin-native DSL. Whether it’s switching entire UI layouts or just tweaking a single values, Vary
provides a simple and performant way to build fully responsive interfaces.
dependencies
block of your build.gradle.kts
file in your commonMain
source set.
Step 1
/gradle/libs.versions.toml
file under versionsStep 2
/gradle/libs.versions.toml
file under librariesStep 3
dependencies
block of your build.gradle.kts
file in your commonMain
source set.Step 4
Vary
provider. This should be done once at the top level of your application.
Make it yours
Vary
calls LocalWindowInfo.current.containerSize.width
to get the width, but you can provide your own implementationvary
for switching UI layouts and for selecting values.
xs
incase no other size is declared Vary
provides the following sizes
Name | Label | Breakpoint |
---|---|---|
ExtraSmall | xs | 0 |
Small | sm | 640 |
Medium | md | 768 |
Large | lg | 1024 |
ExtraLarge | xl | 1280 |
ExtraExtraLarge | xxl | 1536 |
Vary
is an open source library and we’re always looking for ways to improve it, you can view more by clicking the link below.