Compose HTML Material

Material 3 wrapper components for Compose HTML based on Material Web and maicol07's Material Web Additions
For unified multiplatform APIs which are more akin to those in androidx.compose, check out Compose Multiplatform HTML Unified which also depends on this library. Also see its side-by-side demo site for the visual effects of the components.
For Material 2, you are recommended to check out KMDC instead. For information on our obsolete work on legacy Material 2 components, check out the legacy README. Note that this is no longer maintained and should not be used for new projects.
Check out the API documentation here.
Supported components
Not all Material Design components are supported because not all of them are supported by the underlying libraries. For more details see:
- for Material Web:
- for Material Web Additions:
Here is a list of supported component APIs:
Note: Some Material Web components like elevation, focus-ring, and ripple are not wrapped in this library as they are styling/utility components typically used internally by other components, not directly in application code.
"labs" components
Here is a list of supported component APIs in the Material Web "labs" directory, which "contains experimental features that are not recommended for production" as they state:
You should opt in to @MaterialWebLabsApi to use them.
Brief Instructions
Add the dependency
With Gradle:
kotlin {
sourceSets {
jsMain {
dependencies {
implementation("com.huanshankeji:compose-html-material3:$version")
}
}
}
}
compose-html-material3-maicol07-material-web-additions
There is an additional module compose-html-material3-maicol07-material-web-additions that adds more Material 3 components from the maicol07 Material Web Additions library. This library was chosen because its style closely follows the original Material Web library's API patterns. It adds components missing in the original Material Web, such as Snackbar and Top App Bar.
Supported component APIs:
MdSnackbar
MdSmallTopAppBar, MdCenterAlignedTopAppBar, MdMediumTopAppBar, MdLargeTopAppBar
You should opt in to @MaterialWebAdditionsApi to use them.
To add this module as a dependency:
kotlin {
sourceSets {
jsMain {
dependencies {
implementation("com.huanshankeji:compose-html-material3-maicol07-material-web-additions:$version")
}
}
}
}
Material Symbols & Icons
The Material 3 module uses Material Symbols & Icons, but doesn't depend on the stylesheet directly. For Material Icons to work properly, you may need to configure your project following the quick instructions below or the developer guide.
Quick instructions
In short, there are 3 ways to add the Material Symbols & Icons dependency: