Thread
#compose-web
    Fabio Santo

    Fabio Santo

    1 year ago
    Hey everyone, I'm playing with compose for web, how do you use a
    Input
    composable? In need to get the value out of it, I can't find anything to hook my state to.... should I use the
    ref
    attribute maybe ?
    jim

    jim

    1 year ago
    Compose for Web is still in its very early stages, and it looks to me like perhaps the Input field is missing an
    onChange
    callback. Which, if I'm not mistaken, probably means that
    Input
    widget needs an additional parameter. This is probably a fairly straight-forward change for the community if you'd like to contribute by making a pull request on github. cc @Oleksandr Karpovich [JB] @Akif Abasov [JB]
    o

    Oleksandr Karpovich [JB]

    1 year ago
    Hi @Fabio Santo We have some example here https://github.com/JetBrains/compose-jb/tree/master/tutorials/Web/Events_Handling#oninput It depends on the input type you have. Text Area or Text input have handlers which provide an easy access to the typed value. Input types that do not provide such a shortcut, could access:
    event.nativeEvent.target.asDynamic().value
    That's not convenient at all. Although could work as a workaround till we come up with a better way.
    hfhbd

    hfhbd

    1 year ago
    (event.nativeEvent.target as HTMLInputElement).value
    works too