> For the complete documentation index, see [llms.txt](https://docs.appfarm.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.appfarm.io/library/ui-components/icon.md).

# Icon

The **Icon** component is used to display information visually within your apps. [Enum](https://docs.appfarm.io/reference/data-model/enumerated-types.md) values can be linked to **Icons** during their definition, and **Icons** can be otherwise used to display information in an intuitive way. These icons can be selected from within our internal library.

{% hint style="info" %}
Showroom: [Icon example](https://showroom.appfarm.app/ui-components/icon), with its setup in Appfarm Create ([register](https://showroom.appfarm.app/sign-up) for access).
{% endhint %}

### Icon / Icon Value

**Icon** is a static icon. The default is a star. **Icon Value** can be bound to an enum property, so the icon follows the enum value's icon. **Icon** is used as a fallback if **Icon Value** does not provide an icon.

### Tooltip

Text shown in a tooltip on the icon.

### Appearance

**Icon Color**

The color of the icon, based on the active theme: Inherit (default), Primary, Secondary, Action, Disabled, Error, Info, Success or Warning.

**Size**

The size of the icon in pixels. The default is 24.

### Badge

A common use for the **Icon** component is to combine it with a Badge. This badge can be used to display a numerical or String value to the user. For example, in an app with built-in notifications, a bell icon can be used with a Badge that displays the number of new notifications the logged-in user has. Alternatively, in an e-commerce app, a cart icon can be used with a Badge to display the number of items currently in the cart.

Select **Enable Badge** to show the badge. Set the value to display in **Badge Value**, and the color in **Badge Color** (default Secondary).

{% hint style="info" %}
The Badge is automatically hidden if the output is 0 or an empty string.
{% endhint %}

### Conditional Properties

The Badge color, Icon, and Icon Colour can all be changed during runtime based on a condition. For instance, the Icon can be displayed in the "Error" color (red) if a rating is under 25%.

### Custom color

In the **Styles** tab, the **Custom Color** section lets you set a color that overrides the theme color selected in **Icon Color**.

### On Click

Icons support On Click functionality to link the UI component to an action. Icon Buttons can also be used to achieve this functionality, which is recommended.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.appfarm.io/library/ui-components/icon.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
