Is it possible to have multiple Kino.Input Fields in one Livebook cell?

Hey everyone,

is it possible in a livebook to have multiple inputs generated from one cell? Maybe even next to each other.

username = Kino.Input.text("Username")
password = Kino.Input.password("Password")

renders to


but I was hoping for something like

Maybe someone can help me :slight_smile:

Thanks
~ Max

1 Like

check kino form in latest version: Kino.Control — Kino v0.5.0
(see the “Building a chat app with Kino.Control” Kino example in livebook)

inputs = [
  first_name: Kino.Input.text("First name"),
  last_name: Kino.Input.text("Last name")
]

form = Kino.Control.form(inputs, submit: "Greet")

3 Likes

You can also render the inputs individually:

username = Kino.Input.text("Username") |> Kino.render()
password = Kino.Input.password("Password") |> Kino.render()
Kino.nothing()

Converting to a form also works, but it makes everything evented.

5 Likes

Thank you all for your solutions :slight_smile:

Is there any difference between

username = Kino.Input.text("Username") |> Kino.render()
password = Kino.Input.password("Password") |> Kino.render()
Kino.nothing()

and

username = Kino.Input.text("Username") |> Kino.render()
password = Kino.Input.password("Password") 

?

It is the same. :slight_smile:

1 Like