Documentation Index
Fetch the complete documentation index at: https://ziva.zeleza.ru/llms.txt
Use this file to discover all available pages before exploring further.
SingleSelectTask
SingleSelectTask provides an interface for selecting one option from a provided list of choices. This is one of the most commonly used task types in Ziva.
Creating a Task
options := []ziva.Item{
{Key: "option1", Name: "Option 1", Description: "First environment"},
{Key: "option2", Name: "Option 2", Description: "Second environment"},
{Key: "option3", Name: "Option 3"},
}
task := ziva.NewSingleSelectTask("Title", options)
Main Methods
Creating with Settings
task := ziva.NewSingleSelectTask("Environment Selection", environments).
WithDefaultItem("staging"). // default by key
WithTimeout(10*time.Second, "production"). // timeout with fallback
WithViewport(5, true). // limit visible items
WithItemsDisabled([]string{"maintenance"}) // disable by key
Getting Results
// After task execution
selected := task.GetSelected() // string - selected key
index := task.GetSelectedIndex() // int - selected item index
Choice Hints
Use the Description field to provide contextual hints. The text appears in the helper area when an item is focused.
options := []ziva.Item{
{Key: "dev", Name: "Development", Description: "Non-production sandbox"},
{Key: "staging", Name: "Staging", Description: "Pre-production tests"},
{Key: "prod", Name: "Production"},
}
See Also