> 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-button.md).

# Icon button

The UI component **Icon Button** is a component which can trigger an [Action](https://docs.appfarm.io/reference/actions.md). It is very similar to the [Button](https://docs.appfarm.io/library/ui-components/button.md) component, but with some changes and additional properties. While a Button can contain an icon and text, an Icon Button contains just an [Icon](https://docs.appfarm.io/library/ui-components/icon.md), and an optional badge.

As with a normal Button, the *On Click* event handler can be used to connect the component to an action, and every time a user clicks the button, the action will be triggered.

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

## Settings

Here are some of the properties in Appfarm Create which are configurable for an **Icon Button:**

### Disabled

When true, the button cannot be clicked.

### **Icon / Icon Value**

Icons can be connected to the button. Icon Value can be connected to an Enum data source, if applicable. Icon is used as a fallback if Icon Value is not found. The default icon is a plus sign.

### Tooltip

Text shown in a tooltip on the button.

### **Tab Index**

If the end user navigates with the Tab key, this is the position in the queue where the Button will become focused. The default ordering is always logically correct based on the position of components on the page, so it is recommended to leave this property blank (unless the default must be changed).

### Appearance

**Color**

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

**Size**

Small, Medium (default), Large or Custom. With Custom, set **Button Size** and **Icon Size** in pixels. If left empty, they are 40 px and 24 px, the same as Medium.

### **Badge**

A badge can be used to display a numerical or String value to the user. For example, in an app that has shopping functionality, an Icon Button with a shopping cart icon can be configured with a Badge to display the number of items that the user currently has in their cart. An example of the badge is found in the [Showroom](https://showroom.appfarm.app/ui-components/iconbutton).

To add a badge, select **Enable Badge**, then set **Badge Value** and **Badge Color** (default Secondary).

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

### Conditional Properties

If the button's appearance should differ depending on a condition which can change over time, then using Conditional Properties is recommended. The properties, and conditions for when they should override the given default, are given in this section.

### Custom color

In the **Styles** tab, the **Custom Color** section lets you set an **Icon Color** and a **Background Color** that override the theme colors.

### Event Handlers

Actions are configured here, and these are run each time the button is clicked.


---

# 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-button.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.
