I want users to be able to choose to run a simulation that uses either the historical return on a stock or one where they select the numerical average return across the simulations. One way to do this is to have a checkbox with "Use historical" and if it is not checked have a text box where they can type the numerical value they want to use (perhaps appearing and disappearing when the checkbox is set and cleared). But this seems clunky. Is there something cleaner and more elegant / modern?
- I agree it's awkward when controls just appear suddenly.
- You have two modes:
average, so checkboxes aren't a good solution because they are better at on/off interactions.
- Radio buttons or dropdown selects are not great options because they aren't mobile friendly.
Given this situation, a button bar is a reasonable way to do this:
- This shows the names of both modes clearly. It defaults to historical.
- Selecting average provides a slide-down input box for you to enter percentage. That way, it's hidden when it's not needed.
- The use of the gray background groups the button and the input box into the same visual 'island', providing a clear grouping of the controls.
- The slide-down of the input box below the button provides visual flow indicating what the user should do next (you pressed the button, now fill in the field)