A comprehensive form demonstrating different selection field types: dropdowns, radio buttons, and checkbox lists. You'll learn when to use each type and how to create dynamic options.
Every code snippet below is fully editable! Feel free to modify the code, experiment with different values, and see your changes reflected instantly in the live preview on the right.
Use the play button to run different snippet, or the refresh button to restore the original example.
Let's start with an empty form function. This is where we'll build our selection fields step by step.
First, let's add a dropdown for country selection. Dropdowns are perfect for long lists of options where users need to select one item.
Now let's add radio buttons for experience level. Radio buttons are better for short lists where you want all options visible at once.
orientation property controls whether they're horizontal or vertical. Now let's add a checkbox list for multiple selections. Users can select multiple areas of interest.
min and max to control how many items users must/can select. Perfect for "select all that apply" scenarios. Finally, let's create dynamic options that change based on user selection. The country dropdown will show different options based on the selected region.
form.state() to store values and form.computedValue() to create reactive options. This creates powerful cascading dropdowns! Excellent work! You've mastered selection fields and learned when to use each type. Ready to explore form layout techniques?
Continue to Multi-Column Layouts TutorialOther learning paths: