# Is it possible to use variables in Pluto sliders?

**URL:** <https://discourse.julialang.org/t/is-it-possible-to-use-variables-in-pluto-sliders/48828>\
**Category:** Visualization\
**Tags:** pluto\
**Created:** [October 22, 2020, 4:10pm UTC](https://discourse.julialang.org/t/is-it-possible-to-use-variables-in-pluto-sliders/48828 "2020-10-22T16:10:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mihalybaci](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mihalybaci/32/13528_2.png) [@mihalybaci](https://discourse.julialang.org/u/mihalybaci)\
**Post date:** [October 22, 2020, 4:10pm UTC](https://discourse.julialang.org/t/is-it-possible-to-use-variables-in-pluto-sliders/48828/1 "2020-10-22T16:10:05Z")

</div>

So far I am loving the interactivity in Pluto notebooks, but I am frequently hitting a roadblock in setting up sliders. I find I have to manually set the slider range like this

```julia
begin
	number_slider = @bind number html"<input type=range min=1 max=111>"
	md" **Number: $number_slider**"
end

```

Ideally, I would like to be able to dynamically set the min/max,

```julia
begin
    minval = 4
	maxval = 111
	number_slider = @bind number html"<input type=range min=$minval max=$maxval>"
	md" **Number of cases: $number_slider**"
end

```

however, the above code just reverts to the default range of 0 to 100.

Is there a way to dynamically set the slider range (so that I can tie it to things like array length)?

---

<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:** [October 22, 2020, 4:15pm UTC](https://discourse.julialang.org/t/is-it-possible-to-use-variables-in-pluto-sliders/48828/2 "2020-10-22T16:15:52Z")

</div>

You can use PlutoUI:

[https://github.com/fonsp/PlutoUI.jl](https://github.com/fonsp/PlutoUI.jl)

```julia
number_slider = @bind number PlutoUI.Slider(minval:maxval)

```

---

<div class="post-metadata">

**Author:** ![mihalybaci](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mihalybaci/32/13528_2.png) [@mihalybaci](https://discourse.julialang.org/u/mihalybaci)\
**Post date:** [October 22, 2020, 4:21pm UTC](https://discourse.julialang.org/t/is-it-possible-to-use-variables-in-pluto-sliders/48828/3 "2020-10-22T16:21:52Z")

</div>

Ahhhh, I suppose I should have checked there first. That’s fantastic. Thanks!
