Icon
An Icon is one of the 176 built-in icons, picked by name: <tb:Icon name="settings" />. The icons are vector shapes that the toolbox draws with the painter, so there is no image to import, and an icon is sharp at every size. An icon takes its size from the element and its color from the theme text color --tb-color-text, as a Label does, so every theme and skin colors the icons with no extra work.
![]()
![]()
How to add it:
<tb:Icon name="settings" />
<tb:Icon icon="heart-filled"
style="width: 32px; height: 32px; color: #e55;" />
<ui:Button>
<tb:Icon name="save" />
</ui:Button>
var icon = new Icon("download");
icon.IconName = "upload"; // swaps the shape
icon.style.width = 32; // the size is the element size
icon.style.color = Color.cyan; // the color is the text color
// The set, with no element
foreach (var name in IconSet.Names) Debug.Log(name);
bool has = IconSet.Contains("trophy");
name is the name of the element, and the icon uses it when icon is empty. This keeps the common case short. Use icon when you need the element name for Q<Icon>("name").
The size and the color
The default size is 20 by 20 pixels. Set width and height in USS or in code, and the icon draws in the smaller side, centered. The icons are drawn on a grid of 24 units with a stroke of 2 units, so the line grows with the size and keeps its weight. Some icons, such as play and heart-filled, are solid. The icon draws in its own color, which is --tb-color-text by default. To color icons, set color on them: .my-row .tb-icon { color: #e55; } colors every icon of a row. An icon repaints when the pointer goes over its parent or the parent takes the focus, so a hover rule such as .my-button:hover .tb-icon works.
A USS background-image on the icon replaces the drawing, so a theme can swap one icon for a picture.
Unknown names
An unknown name draws nothing and logs one warning for that name, whatever the number of icons that use it. An empty name draws nothing and logs nothing.
The names
Arrows (21): arrow-up, arrow-down, arrow-left, arrow-right, arrow-up-right, arrows-horizontal, move, chevron-up, chevron-down, chevron-left, chevron-right, caret-up, caret-down, caret-left, caret-right, undo, redo, refresh, log-in, log-out, external-link
Actions (34): close, check, plus, minus, check-circle, x-circle, plus-circle, minus-circle, menu, more-horizontal, more-vertical, grip, search, zoom-in, zoom-out, filter, sort, copy, clipboard, edit, trash, save, download, upload, share, link, send, power, toggle-on, toggle-off, checkbox, checkbox-checked, radio, radio-off
Media (27): play, pause, stop, record, skip-next, skip-previous, fast-forward, rewind, shuffle, repeat, loop, volume, mute, maximize, restore, backspace, return, eyedropper, waveform, note, music, mic, headphones, camera, video, image, palette
Files and data (18): folder, file, file-text, package, inbox, database, code, terminal, bug, printer, book, bar-chart, line-chart, pie-chart, trending-up, trending-down, activity, hash
Interface (37): home, settings, sliders, grid, list, table, layers, sidebar, columns, window, user, users, lock, unlock, key, eye, eye-off, shield, shield-check, bell, mail, message, calendar, clock, hourglass, pin, flag, bookmark, tag, cursor, info, help, alert, warning, ban, thumbs-up, smile
Nature and weather (11): sun, moon, cloud, bolt, flame, droplet, leaf, globe, wifi, signal, battery
Games and shop (18): heart, heart-filled, star, star-filled, sparkle, crown, trophy, gift, cart, coin, gem, sword, crosshair, gamepad, map, compass, lightbulb, bolt-circle
Shapes (10): circle, dot, square, triangle, diamond, hexagon, align-left, align-center, align-right, type
In a text
An InlineIconLabel shows an icon of the set between words: Press {settings} to open the options. The icon has the size of the text and its color. A gamepad button, a prompt glyph or an icon you registered with the same name wins, so write {icon:menu} to pick the set icon on purpose.
Settings
| Member | Description |
|---|---|
IconName (icon) |
The name of the icon. Empty uses the name of the element. |
Icon(name) |
The constructor that takes the name. |
Static members
| Member | Description |
|---|---|
IconSet.Names |
The names of all icons, in the order of the gallery. |
IconSet.Count |
The number of icons. |
IconSet.Contains(name) |
True when the set has the name. |
IconSet.TryGetIndex(name, out index) |
Finds the index of an icon with no log. |
IconSet.Resolve(name) |
Finds the index, and logs one warning for an unknown name. |
The MediaIcon uses the same shapes for play, pause, volume, mute, loop, maximize, restore, backspace, return, eyedropper, waveform, note and search, so an icon exists once.