# How do I populate select dropdown from an array of strings?

**URL:** https://discourse.julialang.org/t/how-do-i-populate-select-dropdown-from-an-array-of-strings/61757
**Category:** Pluto
**Created:** [May 25, 2021, 5:48am UTC](https://discourse.julialang.org/t/how-do-i-populate-select-dropdown-from-an-array-of-strings/61757 "2021-05-25T05:48:15Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![scotts](https://avatars.discourse-cdn.com/v4/letter/s/ac8455/32.png) [@scotts](https://discourse.julialang.org/u/scotts)
#### Post date: [May 25, 2021, 5:48am UTC](https://discourse.julialang.org/t/how-do-i-populate-select-dropdown-from-an-array-of-strings/61757/1 "2021-05-25T05:48:15Z")

</div>

I have an array of strings that I want to use to populate an input select dropdown element in Pluto.

Without any detailed documentation I’ve been really struggling. So far, I have found only one way to create the dropdown:

```julia
md"""
$(@bind sites html"<select>
<option value='None'>Select a Site</option>
<option value='S1'>Site 1</option>
<option value='S2'>Site 2</option>
</select>")
"""

```

However, I don’t want to populate it manually like this. I want to use a preexisting array to fill the option values and the text in the dropdown. How can I do this?

---

<div class="post-metadata">

### Author: ![lungben](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lungben/32/12314_2.png) [@lungben](https://discourse.julialang.org/u/lungben)
#### Post date: [May 25, 2021, 6:12am UTC](https://discourse.julialang.org/t/how-do-i-populate-select-dropdown-from-an-array-of-strings/61757/2 "2021-05-25T06:12:23Z")

</div>

Use Select from [GitHub - JuliaPluto/PlutoUI.jl](https://github.com/fonsp/PlutoUI.jl)

Edit:  
if you want to programmatically construct the HTML instead of using PlutoUI, this package is very helpful: [GitHub - JuliaPluto/HypertextLiteral.jl: Julia library for the string interpolation of HTML and SVG](https://github.com/MechanicalRabbit/HypertextLiteral.jl)

---

<div class="post-metadata">

### Author: ![scotts](https://avatars.discourse-cdn.com/v4/letter/s/ac8455/32.png) [@scotts](https://discourse.julialang.org/u/scotts)
#### Post date: [May 25, 2021, 11:51am UTC](https://discourse.julialang.org/t/how-do-i-populate-select-dropdown-from-an-array-of-strings/61757/4 "2021-05-25T11:51:42Z")

</div>

I had not imported Select, so this works, thank you!

```julia
begin
	import Pkg
	Pkg.activate(mktempdir())
	Pkg.add([
			Pkg.PackageSpec(name="PlutoUI", version="0.7")])
	using PlutoUI
end			

site1 = @bind Site1 Select(sites)

```

That’s nice!
