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

# Button

The UI component **Button** is a component which can trigger an [Action](https://docs.appfarm.io/reference/actions.md). The *On Click* event handler can be used to connect the UI component to an action, and every time a user clicks the button, the action will be triggered.

{% hint style="info" %}
Showroom: [Button example](https://showroom.appfarm.app/ui-components/button), 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 a **Button:**

### **Label, Tooltip and Disabled**

**Label** is the text shown on the button. **Tooltip** is shown when the user hovers over the button. **Disabled** disables the button, either always or based on a condition.

### **Icon / Icon Value**

Icons can be connected to a button, which will show alongside the Label. Icon Value can be connected to an Enum data source, if applicable. When an icon is set, **Icon placement** sets whether it appears at the `Start` (default) or `End` of the label.

### **Auto Focus**

A boolean value which determines if the Button will be focussed when the page renders and is first shown to the user.

### **Tab Index**

If the end user navigates with the Tab key, this is the position in the queue where the Button will become focussed. 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).

### **Button Color**

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

### **Variant**

A button can have the variant `Text`, `Outlined` or `Contained`. When left empty (`Default`), the button uses the variant set in the app's [Theme](https://docs.appfarm.io/reference/resources/themes.md). The differences between how these look are demonstrated in the [Showroom](https://showroom.appfarm.app/ui-components/button).

### **Size**

The size of the button: `Small`, `Medium` (default) or `Large`.

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

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