> ## 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

> Single option selection task from a list

# 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

```go theme={null}
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)
```

<img src="https://mintcdn.com/terem/7tfdR1JkDhuUAiXc/images/pic_2.png?fit=max&auto=format&n=7tfdR1JkDhuUAiXc&q=85&s=fb22218f1d789964f0b43bce8f0358f2" alt="Screenshot: single-select task" width="955" height="423" data-path="images/pic_2.png" />

## Main Methods

### Creating with Settings

```go theme={null}
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

```go theme={null}
// 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.

```go theme={null}
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

* [MultiSelectTask](/en/components/multiselect-task) - for multiple option selection
* [YesNoTask](/en/components/yesno-task) - for binary choice
