Skip to content
Get started
Menu
Get started

Checkbox

PaymentCheckbox lets people agree to something or opt in, such as saving a card. The box, the label and the description form one row that toggles on a tap anywhere.

Receipt options with selected, unselected, mixed, invalid and disabled checkboxes.Receipt options with selected, unselected, mixed, invalid and disabled checkboxes.
Checkbox
Receipt options with selected, unselected, mixed, invalid and disabled checkboxes at 200 percent text.
200% text
Indonesian verification consent with its checkbox aligned to the content gutter and Continue disabled until consent.
VerificationIntro consent (Indonesian)
example/lib/screens/gallery_selection.dart
PaymentCheckbox(
value: _sms,
onChanged: (v) => setState(() => _sms = v),
label: 'SMS receipt',
);

Variants: unchecked, checked, indeterminate.

A checked box is filled with the accent and shows a check mark in onAccent. An unchecked box has a 2 px edge in the 3:1 border color, so it stays visible on any surface.

Pass onChanged: null. The label turns muted, the box uses the disabled color, and taps do nothing. Pass disabledReason; it replaces description while the row is disabled.

const PaymentCheckbox(
value: false,
onChanged: null,
label: 'Use as default card',
disabledReason: 'Save the card first',
);

VerificationIntro uses a checkbox for consent and PaymentConfirmation uses one for changed-total approval. Both use the same 48 dp row and 20 dp mark slot, aligned with the section gutter. The consent sentence uses the label role and wraps at large text.

Indeterminate paints a dash and announces mixed. It ignores value and reports true when tapped, supporting select-all controls. Error text adds a danger icon, text and an unchecked danger edge. Required is spoken; the host still gates submission. HiddenElements hides label, description or error visually while retaining them in semantics. Do not rely on color alone or hide the only visible recovery instruction.

Situation Variant / composition Payment example
Select all statement rows indeterminate Use mixed state when some page rows are selected; consent starts unchecked.

Use Radio for one mutually exclusive choice.

The host supplies unchecked, checked or indeterminate state. A null onChanged disables interaction while keeping the label and description readable.

Do: Use mixed state when some page rows are selected; consent starts unchecked.

Don’t: Hide the phone select-all label.

  • Write the label as the full thing people agree to: “Save this card for next time”, not “Save”.
  • Write it so checking means yes. Avoid negatives such as “Don’t send receipts”.
  • Use the description for a consequence or a detail, not for terms that must be read; link those separately.
  • For a setting that takes effect at once, use a switch instead.
  • The whole row is one target of at least 48 dp and one screen-reader node that reads the label, the description and the checked state together.
  • The painted box takes no focus of its own, so one Tab reaches the row and Space toggles it. Keyboard focus draws the kit’s focus ring.
  • The box centers on the label’s first line, so it stays beside the label when the label wraps at large text.

PaymentCheckbox

class PaymentCheckbox extends StatelessWidget · lib/src/controls/controls.dart

A checkbox with its label, for consent and opt-in choices.

The whole row is one 48 dp target and one screen-reader node ("Save this card, checkbox, checked"). Controlled: the host owns value and gets onChanged. A null onChanged disables the row; pass disabledReason so people know why.

ParameterTypeDefaultDescription
value:requiredbool——
onChanged:requiredValueChanged<bool>?——
indeterminate:boolfalseA select-all dash. Value is ignored while mixed; tapping reports true.
label:requiredString——
description:String?—A muted line under the label.
disabledReason:String?—Replaces description while the row is disabled.
errorText:String?—What checking the box agrees to, as a full phrase: "Save this card for next time", not "Save". Validation message, with a danger icon and edge.
required:boolfalseSpoken as required; the host gates the next step.
hiddenElements:Set<PaymentFieldPart>const {}Visually hidden parts remain in semantics.

PaymentFieldPart

enum PaymentFieldPart · lib/src/foundation/payment_tokens.dart

A hidden field part stays in semantics; consumers arrive in later phases.

ValueDescription
labelLabel field part.
descriptionDescription field part.
errorError field part.
  • Switch for settings that apply immediately.
  • Radio for one choice out of several.