PlutoUI.jl icon indicating copy to clipboard operation
PlutoUI.jl copied to clipboard

Make show_value=true the default for Slider and show the variable name

Open dpsanders opened this issue 5 years ago • 3 comments

Sliders are more useful when the value is displayed next to them. It would be great to have the name of the variable displayed too.

Edit from @fonsp: In this issue we are referring to:

@bind x Slider(1:100, show_value=true)

and whether to make it true by default.

dpsanders avatar Oct 07 '20 20:10 dpsanders

Just for the sake of completeness until the issue is closed (and that I didn't see it in another place), I achieved this as follows if anyone needs it:

begin
	k_slider = @bind K html"<input type='range' min='0.0' max='100' step='1.' value='50.' oninput='k.value=this.value'>"
	
	k_value = html"<output id='k'>50</output>"
	
	md"""
	Strike Price: $k_slider $k_value
	""" 
end

Screenshot from 2020-10-29 14-28-42

Edit from @fonsp: this is built in to PlutoUI 🌈, I have edited the original issue to clarify this. I will hide this comment to prevent confusion for people who stumble into it.

mattborghi avatar Oct 29 '20 17:10 mattborghi

+1, I ALWAYS want the value shown.

KronosTheLate avatar Jun 14 '22 16:06 KronosTheLate