Picker

Description

Picker is a versatile UI component used for selecting items from a list of suggestions. It provides support for both multi-selection (with tag-like selections) and single selection modes, and it can render selected items either inline or as separate components. This component is useful when you need to allow users to search, filter, and pick recipients or tags with confirmation feedback via suggestions.

Usage

You instantiate a Picker using the static helper method from Tesserae.UI. The component is generic (Picker) and expects a type that implements the IPickerItem interface. Items can be added using the Items methods, and you can register a callback for when an item is selected using OnItemSelected.

Below is a simple example demonstrating how to create a picker with text suggestions:

API reference

class

Picker<TPickerItem>

public sealed class Picker<TPickerItem> : IComponent, ITabIndex, IObservableListComponent<TPickerItem>, IRoundedStyle where TPickerItem : class, IPickerItem

A multi-select input that lets the user pick one or more typed items from a dropdown, with optional async loading and free-text entry.

Namespace
Tesserae
Implements
IComponent, ITabIndex, IObservableListComponent<TPickerItem>, IRoundedStyle

Constructors

NameDescription
PickerInitializes a new instance of this class.
Constructor
Picker
public Picker(int maximumAllowedSelections = int.MaxValue, bool duplicateSelectionsAllowed = false, int suggestionsTolerance = 0, bool renderSelectionsInline = true, string suggestionsTitleText = null)

Initializes a new instance of this class.

Properties

NameDescription
TabIndexSets the keyboard tab order of the component.
PickerItemsGets or sets the picker items.
SelectedPickerItemsGets or sets the selected picker items.
UnselectedPickerItemsGets or sets the unselected picker items.
MaximumAllowedSelectionsGets or sets the maximum allowed selections.
DuplicateSelectionsAllowedGets or sets the duplicate selections allowed.
SuggestionsToleranceGets or sets the suggestions tolerance.
Property
Picker.TabIndex
public int TabIndex { set ; }

Sets the keyboard tab order of the component.

Property
Picker.PickerItems
public IEnumerable<TPickerItem> PickerItems

Gets or sets the picker items.

Property
Picker.SelectedPickerItems
public IEnumerable<TPickerItem> SelectedPickerItems

Gets or sets the selected picker items.

Property
Picker.UnselectedPickerItems
public IEnumerable<TPickerItem> UnselectedPickerItems

Gets or sets the unselected picker items.

Property
Picker.MaximumAllowedSelections
public int? MaximumAllowedSelections { get; }

Gets or sets the maximum allowed selections.

Property
Picker.DuplicateSelectionsAllowed
public bool DuplicateSelectionsAllowed { get; }

Gets or sets the duplicate selections allowed.

Property
Picker.SuggestionsTolerance
public int SuggestionsTolerance { get; }

Gets or sets the suggestions tolerance.

Methods

NameDescription
AsObservableReturns the component's state as a(n) observable.
ItemsAdds the given items to the component.
OnItemSelectedRegisters a callback invoked when the item selected event fires.
RenderRenders the component's root HTML element.
Method
Picker.AsObservable
public IObservable<IReadOnlyList<TPickerItem>> AsObservable()

Returns the component's state as a(n) observable.

Method
Picker.Items
Overload
Items(TPickerItem[])Adds the given items to the component.
Items(IEnumerable<TPickerItem>)Adds the given items to the component.
Items(TPickerItem[])
public Picker<TPickerItem> Items(params TPickerItem[] items)

Adds the given items to the component.

Parameters

items TPickerItem[]
Items(IEnumerable<TPickerItem>)
public Picker<TPickerItem> Items(IEnumerable<TPickerItem> items)

Adds the given items to the component.

Parameters

items IEnumerable<TPickerItem>
Method
Picker.OnItemSelected
public Picker<TPickerItem> OnItemSelected(ComponentEventHandler<Picker<TPickerItem>, ItemPickedEvent> eventHandler)

Registers a callback invoked when the item selected event fires.

Method
Picker.Render
public HTMLElement Render()

Renders the component's root HTML element.

Samples

Basic Picker with Text Suggestions

In this sample, we create a picker that supports multiple selections. We add a few sample items and register an event handler to log the selected item to the console.

Picker with Inline Selections and Component-based Rendering

This sample demonstrates a picker that renders selected items using an icon alongside text for a richer UI experience.

See also

© 2026 Curiosity. All rights reserved.