prongs
GitHub

field.checkbox

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

Component

Renders

<input type="checkbox">

Profile

Comes from

starter
Read https://www.prongs.dev/docs/intents/field/checkbox.md and tell me whether field.checkbox fits what I am building.

Example

Preview
<Layout intent="layout.lockup">
<Field intent="field.checkbox" id="remember" />
<Text intent="text.label" as="label" htmlFor="remember">Remember me on this device</Text>
</Layout>

Connections

Choosing between neighbours

  • If it is

    Use

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

    field.checkbox
  • A setting that takes effect immediately

    field.switch
  • A choice that waits for a submit button

    rather than field.switch
    field.checkbox

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

    Small square checkbox

    h-4 w-4 shrink-0 cursor-pointer accent-primary
  • field.checkbox

    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',
},
],
},