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.
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"];
});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:
| Layout | Description |
|---|---|
Auto | Displays 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. |
Picker | Displays the icon picker. |
Inline | Displays 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.