# field.checkbox

A yes/no choice that is sent with a form: remember me, agree to terms. Pair with a text.label

Component: [`<Field>`](https://www.prongs.dev/docs/components/field.md) · Renders: `<input type="checkbox">` · Profile: [UI](https://www.prongs.dev/docs/intents/ui.md)

## Example

```tsx
<Field intent="field.checkbox" id="checkbox" name="checkbox" />
```

## Choosing between neighbours

Find the row that describes your element, and use the intent on the right.

| If it is for… | Use |
|---|---|
| A yes/no choice that is sent with a form: remember me, agree to terms. Pair with a text.label | `field.checkbox` (this page) |
| A setting that takes effect immediately | [`field.switch`](https://www.prongs.dev/docs/intents/field/switch.md) |
| A choice that waits for a submit button (rather than [`field.switch`](https://www.prongs.dev/docs/intents/field/switch.md)) | `field.checkbox` (this page) |

## Connections

Declared in the registry, both directions. Where an intent is used in your own code is something check and the gallery see; this site has no app code.

- Built from: [`input.check`](https://www.prongs.dev/docs/intents/ui.md#input-check)

## For registry authors

**Starter intents.** These are the intents `prongs add` puts in your registry, shown in this site’s theme. Yours are your own `registry.ts`: rename, restyle and add to them, and see them with `prongs add gallery`.

What this intent is built from and its entry in `components/prongs/registry.ts`. You only need this to change how it looks or to add an intent like it.

How field.checkbox resolves, and its definition

Each layer adds to the one before it; a later class wins over an earlier one that sets the same thing.

- [`input.check`](https://www.prongs.dev/docs/intents/ui.md#input-check) — Small square checkbox

  ```
  h-4 w-4 shrink-0 cursor-pointer accent-primary
  ```

- `field.checkbox` (this page) — A yes/no choice that is sent with a form: remember me, agree to terms. Pair with a text.label

Final classes

```
h-4 w-4 shrink-0 cursor-pointer accent-primary
```

Element behaviour

```
{ type: 'checkbox' }
```

Definition

```ts
'field.checkbox': {
  kind: 'semantic',
  description: 'A yes/no choice that is sent with a form: remember me, agree to terms. Pair with a text.label',
  refs: ['input.check'],
  binding: { behavior: { type: 'checkbox' } },
  notFor: [
    {
      context: 'a setting that takes effect immediately',
      instead: 'field.switch',
    },
  ],
},
```
