swoogles / laminar_timepicker   0.2.3

GitHub

Basic TimePicker that should easily fit into Laminar projects

Scala versions: 2.13
Scala.js versions: 1.x

This is just one small contribution to the Laminar ecosystem. It is my first UI component, and it's very narrowly useful at the moment. I just love Laminar and want to make it easier for people to experiment with it!

To use:

libraryDependencies += "com.billdingsoftware" %%% "timepicker" % "0.2.3"

The simplest use-case is:

TimePicker("08:03 AM") match {
  case TimePicker(
    component: Div, 
    $time: Signal[WallTime]
  ) =>
    div(
      child.text <-- $time.map("time: " + _),
      component
    )
}

This will use AM/PM, 12 hour notation. If you prefer 24 hour notation, omit the AM/PM and that selector will not be shown.

TimePicker("15:00")

If you want to change the default minute delta of 5 minutes, provide that value via:

TimePicker("15:00", minuteDelta = 15)

You can also drop in custom up/down button elements via:

  TimePicker(
    initialTime = "09:30",
    incrementRep = span("Inc"),
    decrementRep = span("Dec")
  )