You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the MultiSelect component allows setting a maximum limit for selections using the Limit() method. However, there's no way to set a minimum number of required selections. Adding a minimum limit would enhance form validation capabilities.
Proposed Solution
Introduce a new method, perhaps called MinLimit(n int), to set the minimum number of selections required for a MultiSelect field.
P.S. AtLeast(n int) might be great as well.
Example Usage
huh.NewMultiSelect[string]().
Title("Select at least 2 but no more than 4 toppings").
Options(
huh.NewOption("Cheese", "cheese"),
huh.NewOption("Tomatoes", "tomatoes"),
huh.NewOption("Onions", "onions"),
huh.NewOption("Lettuce", "lettuce"),
huh.NewOption("Pickles", "pickles"),
).
MinLimit(2). // New method to set minimum selectionsLimit(4). // Existing method for maximum selectionsValue(&toppings)
The text was updated successfully, but these errors were encountered:
Description
Currently, the
MultiSelect
component allows setting a maximum limit for selections using theLimit()
method. However, there's no way to set a minimum number of required selections. Adding a minimum limit would enhance form validation capabilities.Proposed Solution
Introduce a new method, perhaps called
MinLimit(n int)
, to set the minimum number of selections required for aMultiSelect
field.P.S.
AtLeast(n int)
might be great as well.Example Usage
The text was updated successfully, but these errors were encountered: