---
title: "React Forms Checkbox Example | Mobiscroll"
component: "Forms"
framework: "React"
library_version: "6.1.5"
url: "https://demo.mobiscroll.com/react/forms/checkbox"
---

# Checkbox - React Forms demo

React checkbox and checklist demo and styling with or without description text. Supports disabled styling. For React and Next.JS.

- [Live demo](https://demo.mobiscroll.com/react/forms/checkbox)
- [View React JS code on GitHub](https://github.com/acidb/mobiscroll-demos-react/tree/main/src/demos/form-components/forms/checkbox)
- [View React TS code on GitHub](https://github.com/acidb/mobiscroll-demos-react-ts/tree/main/src/demos/form-components/forms/checkbox)
- This demo in other frameworks: [JavaScript](https://demo.mobiscroll.com/javascript/forms/checkbox.md), [jQuery](https://demo.mobiscroll.com/jquery/forms/checkbox.md), [Angular](https://demo.mobiscroll.com/angular/forms/checkbox.md), [Vue](https://demo.mobiscroll.com/vue/forms/checkbox.md)

## Description

Use checkboxes for multiple choice lists or properties or `true/false` properties of an event. Different color presets are available.

## What this demo shows

- This demo shows different examples for checkboxes.
- **Checkbox states** Checkboxes in checked and unchecked states.
- **Disabled states** Disabled checkboxes in both checked and unchecked states.
- **Supporting content** Checkboxes with titles and descriptive text.
- **Color presets** The primary, secondary, success, danger, warning, and info checkbox colors.
- **Selection patterns** Checkboxes for selecting multiple options and setting `true/false` event properties.

## Best for

- **Multiple-choice lists** Letting users select any number of options from a list.
- **Event properties** Setting independent `true/false` properties for an event.
- **Settings forms** Pairing checkbox titles with descriptive text when an option needs additional context.
- **Unavailable options** Showing checked or unchecked values that users cannot currently change.
- **Color-coded options** Applying preset colors when checkboxes need distinct visual meaning.

## Tutorial

```html
<Checkbox label="Option 1" description="Checked checkbox" defaultChecked={true} />
<Checkbox label="Option 2" description="Empty checkbox" />
<Checkbox label="Option 3" description="Disabled checkbox" disabled={true} />
<Checkbox label="Option 4" description="Disabled and checked checkbox" disabled={true} defaultChecked={true} />
```

```html
<Checkbox label="Primary" color="primary" defaultChecked={true} />
<Checkbox label="Secondary" color="secondary" defaultChecked={true} />
<Checkbox label="Success" color="success" defaultChecked={true} />
<Checkbox label="Danger" color="danger" defaultChecked={true} />
<Checkbox label="Warning" color="warning" defaultChecked={true} />
<Checkbox label="Info" color="info" defaultChecked={true} />
```

## Code

### JSX

```jsx
import { Checkbox, Page, setOptions } from '@mobiscroll/react';

setOptions({
  theme: 'ios',
  themeVariant: 'light'
});

function App() {
  return (
    <Page>
      <div className="mbsc-form-group">
        <div className="mbsc-form-group-title">Checkbox</div>
        <Checkbox label="Option 1" description="Checked checkbox" defaultChecked={true} />
        <Checkbox label="Option 2" description="Empty checkbox" />
        <Checkbox label="Option 3" description="Disabled checkbox" disabled={true} />
        <Checkbox label="Option 4" description="Disabled and checked checkbox" disabled={true} defaultChecked={true} />
      </div>
      <div className="mbsc-form-group">
        <div className="mbsc-form-group-title">Checkbox colors</div>
        <Checkbox label="Primary" color="primary" defaultChecked={true} />
        <Checkbox label="Secondary" color="secondary" defaultChecked={true} />
        <Checkbox label="Success" color="success" defaultChecked={true} />
        <Checkbox label="Danger" color="danger" defaultChecked={true} />
        <Checkbox label="Warning" color="warning" defaultChecked={true} />
        <Checkbox label="Info" color="info" defaultChecked={true} />
      </div>
    </Page>
  );
}

export default App;
```

### TSX

```tsx
import { Checkbox, Page, setOptions } from '@mobiscroll/react';
import { FC } from 'react';

setOptions({
  theme: 'ios',
  themeVariant: 'light'
});

const App: FC = () => (
  <Page>
    <div className="mbsc-form-group">
      <div className="mbsc-form-group-title">Checkbox</div>
      <Checkbox label="Option 1" description="Checked checkbox" defaultChecked={true} />
      <Checkbox label="Option 2" description="Empty checkbox" />
      <Checkbox label="Option 3" description="Disabled checkbox" disabled={true} />
      <Checkbox label="Option 4" description="Disabled and checked checkbox" disabled={true} defaultChecked={true} />
    </div>
    <div className="mbsc-form-group">
      <div className="mbsc-form-group-title">Checkbox colors</div>
      <Checkbox label="Primary" color="primary" defaultChecked={true} />
      <Checkbox label="Secondary" color="secondary" defaultChecked={true} />
      <Checkbox label="Success" color="success" defaultChecked={true} />
      <Checkbox label="Danger" color="danger" defaultChecked={true} />
      <Checkbox label="Warning" color="warning" defaultChecked={true} />
      <Checkbox label="Info" color="info" defaultChecked={true} />
    </div>
  </Page>
);
export default App;
```

## Implementation notes

- `label` sets the checkbox's primary text; `description` adds secondary supporting text below/beside it.
- `disabled` (boolean prop/attribute) disables the checkbox in either its checked or unchecked state; it does not change the checked value.
- `color` accepts six presets: `primary`, `secondary`, `success`, `danger`, `warning`, `info` (no `light`/`dark` variant for checkboxes).
- Checked state handling differs by framework: React exposes `checked`/`defaultChecked` (controlled/uncontrolled); Vue two-way binds via `v-model` on a `ref<boolean>`, with no separate `defaultChecked` - the bound ref's initial value is the initial checked state; Angular two-way binds via `[(ngModel)]`; JS/jQuery uses the native `checked` attribute on `input[type="checkbox"][mbsc-checkbox]`.
- Framework differences: React `<Checkbox label="..." description="..." defaultChecked={true} disabled={true} color="primary" />`; Vue `<MbscCheckbox v-model="option1" label="..." description="..." :disabled="true" color="primary" />`; Angular `<mbsc-checkbox label="..." description="..." [(ngModel)]="ch1" [disabled]="true" color="primary"></mbsc-checkbox>`; JS/jQuery `<label><input mbsc-checkbox type="checkbox" data-label="..." data-description="..." data-color="primary" checked disabled /></label>`.

## Run it in your project

1. If not signed up yet, or don't own a license, you can [start a free trial](https://mobiscroll.com/starttrial).

2. Clone the repository:

   ```
   git clone https://github.com/acidb/mobiscroll-demos-react.git
   ```

3. If not installed yet, install the Mobiscroll CLI from NPM:

   ```
   npm install -g @mobiscroll/cli
   ```

4. Config Mobiscroll - open a terminal window in the root directory and run:

   ```
   mobiscroll config react
   ```

5. Install dependencies - open a terminal window in the root directory and run:

   ```
   npm install
   ```

6. Run the project:

   ```
   npm run dev
   ```

On a trial, add `--trial` to the config command: `mobiscroll config react --trial`.

Running a demo locally requires a Mobiscroll trial or a license; setup is per framework at https://mobiscroll.com/docs/react/getting-started/installation

## Related demos

- Next: [Switch](https://demo.mobiscroll.com/react/forms/switch.md) - React switch/toggle demo with or without description. Alternative to the checkbox. Supports disabled styling.
