Some legacy Material 2 components for Compose HTML, based on the obsolete mwc
branch of Material Web (preferred) and Material Components for the web (or material-components-web, or mdc
) (fallback)
There will be no further development effort in this legacy Material 2 portion of this project. Here is a list of reasons and alternatives:
- The material-web team is working on Material 3 support and the Material 2 branch (
mwc
) is no longer under active development. Existing Compose wrappers of their Material 2 components are still kept in the:compose-html-material-legacy
subproject but not updated. - KMDC wrapping around material-components-web (
mdc
) provides a much more complete set of Material Design components for Compose HTML.
Some configurations are needed to use this library due to the immaturities of this project and Kotlin/JS.
Prior to v0.3.0:
implementation("com.huanshankeji:compose-web-material:$version")
Since v0.3.0:
implementation("com.huanshankeji:compose-html-material-legacy:$version")
Call mwcRequires()
in your main
function before calling any component Composable functions.
If you use this library in an app project with Webpack which Kotlin/JS currently uses, you might want to configure it as recommended by Material Web and Material Components for the web. Some instructions on how to do this simply are as below.
If you use a version prior to v0.3.0, this plugin helps add the dependency to this project (if you do this you can skip the "Add the dependency" step above) and the devNpm
dependencies:
Prior to v0.3.0:
plugins {
id("com.huanshankeji.compose-web-material-conventions") version someVersion
}
Since v0.3.0:
plugins {
id("com.huanshankeji.compose-web-material-conventions-legacy") version someVersion
}
However, the plugin doesn't make further adjustments to the webpack configuration, so you also need to refer to the demo further adjustments and the demo HTML page to add your own. Just copy and possibly adapt them as you like.
Also note that there is a new approach to adding CSS and SCSS support in the Kotlin Gradle Plugin since 1.8, which replaces the function of this plugin.