---
title: "checkbox"
image: "https://adonia.pages.dev/og.png"
version: "next"
---

> Documentation Index
> Fetch the complete documentation index at: https://adonia.pages.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# checkbox

<!-- Generated by `pnpm docs:fields` from packages/core/src/schema/fields/checkbox.ts. Edit the TSDoc, not this file. -->

Single checkbox bound to a boolean attribute.

| | |
| --- | --- |
| Builder | `F.checkbox(attribute: string): Checkbox` |
| Wire type key | `checkbox` |
| Class chain | `Checkbox` → `BooleanField` → `Field` |
| Detail projection | `text-entry` |
| Column counterpart | `boolean` cell, i.e. `C.boolean(attribute)` |

## Example

```ts
import { F } from '@adonia/core'

F.checkbox('acceptsTerms').label('I accept the terms').required()
```

## Props

Beyond the shared [field DSL](/reference/fields#the-shared-field-dsl):

| Prop | Declared on | Behaviour |
| --- | --- | --- |
| `inline(): this` | `Checkbox` | Renders the label beside the box instead of above it — the layout a consent checkbox wants, and the reason `checkbox` exists next to `toggle` at all. |
| `asInteger(): this` | `BooleanField` | Stores the sqlite-shaped `0`/`1` integer instead of a boolean (§7.3). Needed when the model does NOT declare a boolean column consumer; with it, `BooleanField.defaultDehydrate` writes `1`/`0`, which `BooleanField.defaultHydrate` reads straight back. |

## Validation

Vine base: `vine.boolean()`.

§11.1 mapping: `vine.boolean()`.

Contributed by `BooleanField.vineSchema()` in `packages/core/src/schema/fields/boolean_field.ts`. The shared modifiers (`required`, `nullable`, `requiredWhen`, `unique`, optionality) are applied on top by `Field.buildValidation`, and a `rules()` override replaces the base entirely — the validator compiler never branches on the field class.

## Declared in

- `packages/core/src/schema/fields/checkbox.ts` — `Checkbox`
- `packages/core/src/schema/fields/boolean_field.ts` — `BooleanField`

Source: https://adonia.pages.dev/reference/fields/checkbox/index.mdx
