Skip to content

scommons/scommons-material-ui

Repository files navigation

CI Coverage Status Scala.js

Scala Commons Material UI

Scala.js facades for Material-UI (v4) components and APIs.

It uses common scalajs-reactjs binding/facade library.

How to add it to your project

val scommonsMaterialUiVer = "1.0.0-SNAPSHOT"

libraryDependencies ++= Seq(
  "org.scommons.material-ui" %%% "scommons-material-ui-core" % scommonsMaterialUiVer,
  
  // mocks of native Components and APIs
  "org.scommons.material-ui" %%% "scommons-material-ui-test" % scommonsMaterialUiVer % "test"
)

Latest SNAPSHOT version is published to Sonatype Repo, just make sure you added the proper dependency resolver to your build.sbt settings:

resolvers += "Sonatype Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots/"

Quick Start

import io.github.shogowada.scalajs.reactjs.ReactDOM
import org.scalajs.dom
import scommons.materialui._
import scommons.materialui.styles._
import scommons.react._

object App extends FunctionComponent[Unit] {

  protected def render(compProps: Props): ReactElement = {
    <.Button(^.variant := "contained", ^.color := "primary")(
      "Hello World"
    )
  }
}

object AppMain {

  def main(args: Array[String]): Unit = {
    val mountNode = dom.document.getElementById("root")

    dom.document.title = "Demo material-ui app"

    ReactDOM.render(<(App()).empty, mountNode)
  }
}

Components Demos

Please, see README.md in showcase sub-folder for how to build and run showcase app locally.