Squircle Shape

A Compose Multiplatform library providing customizable Squircle shapes for UI components.
✨ Features
- Customizable Squircle Shapes: Create UI shapes that smoothly transition between squares and circles.
- Integration with
MaterialTheme: Use squircle shapes directly in Jetpack Compose themes.
- Corner Smoothing: Fine-tune the smoothness of corners for a delightful design.
- Multiplatform Support: Available for Android, iOS, Desktop (JVM), and Web (WasmJS).
- Canvas Drawing: Easily draw squircle shapes on canvases with
drawSquircle().
🆕 What's New in Version 3.0.0?
📋 Requirements
For Multiplatform Projects:
- Kotlin:
2.0.21
- Compose:
1.7.1
For Android-only Projects:
- Kotlin:
2.0.21
- Jetpack Compose:
1.7.1
- Minimum SDK:
23
- Compile SDK:
35
📦 Setup
Gradle Kotlin DSL (Multiplatform)
- Add the dependency in your shared module's
build.gradle.kts:
sourceSets {
commonMain.dependencies{
implementation("com.composevisualeditor.apoloapps:squircle-shape:<version>")
}
}
- Sync and rebuild the project. 🔄️🔨✅
Gradle Kotlin DSL Setup (For Android-only projects).
-
- Add the Squircle Shape dependency in your module
build.gradle.kts file.
- Latest version:

dependencies {
implementation("com.composevisualeditor.apoloapps:cve-squircle-shape-android:<version>")
}
- Or if you're using a version catalog (e.g.
libs.versions.toml), declare it in the catalog instead.
[versions]
squircle-shape = "<version>"
[libraries]
squircle-shape = { group = "com.composevisualeditor.apoloapps", name = "cve-squircle-shape-android", version.ref = "squircle-shape" }
- Then include the dependency in your module
build.gradle.kts file.
dependencies {
implementation(libs.squircle.shape)
}
- Sync and rebuild the project. 🔄️🔨✅
🚀 Usage
1. Using Squircle Shapes with MaterialTheme
Define squircle shapes in your theme to use them consistently across your app:
val shapes = Shapes(
small = SquircleShape(radius = 16.dp, cornerSmoothing = CornerSmoothing.Medium),
medium = SquircleShape(radius = 32.dp, cornerSmoothing = CornerSmoothing.Medium),
large = SquircleShape(percent = 100, cornerSmoothing = CornerSmoothing.Medium)
)
MaterialTheme(
shapes = shapes
) {
Button(
onClick = { },
shape = MaterialTheme.shapes.large
) {
Text(text = "Full Squircle")
}
}

2. Using Squircle Shapes separately
Clip UI components separately by using a SquircleShape() function.
Image(
modifier = Modifier
.size(128.dp)
.clip(
shape = SquircleShape(
percent = 100,
cornerSmoothing = CornerSmoothing.Medium
)
),
painter = painterResource(R.drawable.mlbb_novaria),
contentDescription = "An image of Novaria.",
contentScale = ContentScale.Crop
)

You can customize the radii for all corners, or for each corner independently.
Supported corner values are:
Int for percent-based corner radius in range 0..100
Float for pixel-based corner radius e.g. 50f
Dp for density pixel-based corner radius e.g. 16.dp
3. Draw a Squircle on Canvas
You can draw squircle shapes on a canvas for custom graphics.
Note: currently drawSquircle only accepts pixel-based values for each corner:
Canvas(
modifier = Modifier.size(150.dp),
onDraw = {
drawSquircle(
color = Color.Blue,
topLeft = Offset.Zero,
size = this.size,
topLeftCorner = 32.dp.toPx(),
topRightCorner = 8.dp.toPx(),
bottomRightCorner = 32.dp.toPx(),
bottomLeftCorner = 8.dp.toPx(),
cornerSmoothing = .6f
)
}
)
📄 License
This project is open source and available under the MIT License.
Contact
Created by @stoyan-vuchev - feel free to contact me!
E-mail - contact@stoyanvuchev.com
Special thanks to @stoyan-vuchev
Forked by @ApoloApps