> For the complete documentation index, see [llms.txt](https://docs.servoy.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.servoy.com/reference/servoyextensions/ui-components/input-control/checkbox.md).

# Checkbox

(part of package '[Bootstrap Components](/reference/servoyextensions/packages/ui-component-packages/bootstrap-components.md)')\
Extends designtime/SolutionModel: [JSWebComponent](/reference/servoycore/dev-api/solutionmodel/jswebcomponent.md)\
Extends runtime: [RuntimeWebComponent](/reference/servoycore/dev-api/forms/runtimeform/elements/runtimewebcomponent.md)

This is a reference page; many components have detailed usage guides [here](https://docs.servoy.com/guides/develop/application-design/ui-components).

## Properties

### dataProviderID

Checkbox is a standard input component that can have two states: checked and unchecked. Type: [Dataprovider](/reference/servoy-developer/component_and_service_property_types.md#dataprovider)

***

### enabled

Flag indicating whether the checkbox is enabled for user interaction. Type: [Enabled](/reference/servoy-developer/component_and_service_property_types.md#protected) Default Value: true

***

### selectedValue

The value returned when the checkbox is checked (default is 1) Type: [String](/reference/servoycore/dev-api/js-lib/string.md)

***

### showAs

Option whether checkbox text is shown as plain text, sanitized html or trusted html (as is). Type: [String](/reference/servoycore/dev-api/js-lib/string.md)

***

### styleClass

Set the styleclasses that should be applied at to this component Type: [Styleclass](/reference/servoy-developer/component_and_service_property_types.md#styleclass) Default Value: "checkbox"

***

### tabSeq

Tab sequence order for keyboard navigation. Type: [Tabseq](/reference/servoy-developer/component_and_service_property_types.md#tabseq)

***

### text

The text label displayed next to the checkbox. Type: [Tagstring](/reference/servoy-developer/component_and_service_property_types.md#tagstring) Default Value: "Checkbox"

***

### toolTipText

Tooltip text displayed when hovering over the checkbox. Type: [Tagstring](/reference/servoy-developer/component_and_service_property_types.md#tagstring)

***

### visible

Whether the button is visible or not Type: [Visible](/reference/servoy-developer/component_and_service_property_types.md#visible)

***

## Events

### onActionMethodID(event,dataTarget)

Click event. dataTarget parameter is used to identify inner html elements (by their data-target attribute)

**Parameters:**

> * {[JSEvent](/reference/servoycore/dev-api/application/jsevent.md)} event The event object containing details about the click event (e.g. target element, mouse coordinates)
> * {[String](/reference/servoycore/dev-api/js-lib/string.md)} dataTarget The identifier for inner html elements defined by their data-target attribute

***

### onDataChangeMethodID(oldValue,newValue,event)

Handle changed data, return false if the value should not be accepted.\
JSEvent.data will contain extra information about dataproviderid, its scope and the scope id (record datasource or form/global variable scope)

**Parameters:**

> * {[${dataproviderType}](/reference/servoy-developer/component_and_service_property_types.md#dataprovider)} oldValue The previous value from the data provider
> * {[${dataproviderType}](/reference/servoy-developer/component_and_service_property_types.md#dataprovider)} newValue The new value to be set in the data provider
> * {[JSEvent](/reference/servoycore/dev-api/application/jsevent.md)} event The event object associated with the data change

**Returns:** {[Boolean](/reference/servoycore/dev-api/js-lib/boolean.md)}

***

### onFocusGainedMethodID(event)

**@param** {JSEvent} event The event object containing details about the focus gained event (e.g. target element, timestamp)

**Parameters:**

> * {[JSEvent](/reference/servoycore/dev-api/application/jsevent.md)} event

***

### onFocusLostMethodID(event)

**@param** {JSEvent} event The event object containing details about the focus lost event (e.g. target element, timestamp)

**Parameters:**

> * {[JSEvent](/reference/servoycore/dev-api/application/jsevent.md)} event

***

## API

### requestFocus(mustExecuteOnFocusGainedMethod)

Request the focus to this checkbox.

**Example:**

```js
myElement.requestFocus();
```

**Parameters:**

> * {[Boolean](/reference/servoycore/dev-api/js-lib/boolean.md)} \[mustExecuteOnFocusGainedMethod] If false will not execute the onFocusGained method; the default value is true

***

***


---

# 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.servoy.com/reference/servoyextensions/ui-components/input-control/checkbox.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.
