Skip to content

glutinum-org/Glutinum.Feliz.ReactSignaturePadWrapper

Repository files navigation

Glutinum.Feliz.ReactSignaturePadWrapper

NuGet

Binding for react-signature-pad-wrapper.

Usage

open Feliz
open Glutinum.SignaturePad
open Glutinum.Feliz.ReactSignaturePadWrapper

open type Glutinum.Feliz.ReactSignaturePadWrapper.Exports

[<ReactComponent>]
let App () =
    let signaturePadRef = React.useRef<SignaturePad option> None

    Html.div [
        SignaturePad [
            signaturePad.ref signaturePadRef
            signaturePad.redrawOnResize true
        ]

        Html.button [
            prop.text "Clear"
            prop.onClick (fun _ ->
                if signaturePadRef.current.IsSome then
                    signaturePadRef.current.Value.clear ()
            )
        ]
        Html.button [
            prop.text "Save"
            prop.onClick (fun _ ->
                if signaturePadRef.current.IsSome then
                    let base64URL = signaturePadRef.current.Value.toDataURL ()
                    debugBase64 base64URL
            )
        ]
    ]

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published