# ListBoxItem

## Introduction

The ListBoxItem class is used by the ListBox control for each instance added to the ListBox.Items property.

Gum Forms includes a default ListBoxItem implementation which includes a single label.

## Code Example: Adding ListBoxItems

ListBoxItems can be implicitly instantiated by adding any type of object to a ListBox. The following code creates 20 ListBoxItems, each displaying an integer.

```csharp
// Initialize
var listBox = new ListBox();
listBox.AddToRoot();
listBox.X = 50;
listBox.Y = 50;
listBox.Width = 400;
listBox.Height = 200;

for(int i = 0; i < 20; i++)
{
    listBox.Items.Add(i);
}
```

<figure><img src="https://2695663588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_fzQmxQ1VeUFHcoo2c%2Fuploads%2Fgit-blob-6e7eb8233fe89bf37c7f35d8b503b8773865e0b9%2F13_09%2010%2037.gif?alt=media" alt=""><figcaption><p>ListBoxItems created by adding ints to an Items</p></figcaption></figure>

## Customizing ListBox Items

To customize the displayed text of a ListBoxItem, see the [ListBox Items tutorial](https://docs.flatredball.com/gum/code/getting-started/tutorials/code-only-gum-forms-tutorial/listbox-items).
