Skip to content

Typed input value#468

Open
malladinagarjuna2 wants to merge 3 commits intoarmanbilge:mainfrom
malladinagarjuna2:typed-input-value
Open

Typed input value#468
malladinagarjuna2 wants to merge 3 commits intoarmanbilge:mainfrom
malladinagarjuna2:typed-input-value

Conversation

@malladinagarjuna2
Copy link
Copy Markdown

Partially addresses #399.

Adds a typedValue[T] extension on HtmlInputElement[F] that returns the correct type based on the input type string:

  • typedValue["file"]F[FileList]
  • typedValue["checkbox" | "radio"]F[Boolean]
  • typedValue["number" | "range"]F[Double]
  • anything else → F[String]
input.withSelf { self =>
  (
    typ := "file",
    onChange --> { _.evalMap(_ => self.typedValue["file"]).foreach(handleFiles) }
  )
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant