Icons

Let people choose an icon instead of typing its name

Introduction

The icon editor edits a string property that stores an icon's name, such as a trip's or an amenity's icon.

The icon picker open under a trip's Icon field, with a search box and a grid of icons

To use the icon editor, call UseIconEditor():

fields.Add(trip => trip.Icon).UseIconEditor();

Limiting the available icons

By default, the icon editor offers every registered icon in a picker that searches the icons' names and keywords. You can limit the available icons by setting the Icons property to the names of the available icons.

The example below offers five icons:

using StellarAdmin.Resources.Editors;

fields.Add(trip => trip.Icon).UseIconEditor(icon =>
{
    icon.Icons = ["mountain", "sailboat", "utensils", "landmark", "tent"];
});
A trip's Icon field offering five icons in an inline grid

When limiting the number of icons, and the Icons property contains fewer than 24 icons, the icons are displayed inline as per the screenshot above. You can control the layout by setting the Layout property to one of the following:

LayoutDescription
AutoDisplays an inline grid of icons when Icons has 24 names or fewer. Displays the picker when Icons is not set of contains more than 24 icon names.
PickerDisplays the icon picker.
InlineDisplays an inline grid of icons, even when Icons has more than 24 names.

In an inline row, the icon editor is always a button that opens the picker.

The trips grid with a row being edited, its icon shown as a button that opens the icon picker

On this page