AncrelDocumentationv0.3.0

Search documentation

    Documentation / frontend

    复选框

    用 label 扩大可点击区域。对于独立选项,可以设置 defaultChecked,由浏览器保存后续选择。若控件在 Field 内,字段标签也会与复选框关联。

    Live example

    Open playground ↗
    Print options

    App.tsx

    'use client'
    
    import { Checkbox } from '@ancrel/ui'
    import '@ancrel/tokens/css'
    import '@ancrel/ui/styles.css'
    
    export default function App() {
      return (
        <fieldset>
          <legend>Print options</legend>
          <Checkbox label="Include page numbers" name="pageNumbers" defaultChecked />
          <Checkbox label="Double-sided" name="duplex" />
        </fieldset>
      )
    }
    

    Expected behavior

    Include page numbers starts checked. Double-sided starts unchecked. Clicking either label toggles only its own option.

    From the workspace root, build @ancrel/tokens and @ancrel/ui, then run pnpm --filter @ancrel/example-checkbox test.

    部分选中

    当一组项目中仅有部分被选中时,把汇总控件的 checked 设为 mixed。点击后,onCheckedChange 会收到 true 及原生输入对应的 React 事件。由调用方更新选中集合,再从集合计算汇总状态。禁用控件会同时禁用标签激活。

    State matrix

    StateTheme / density
    defaultdark/compact, dark/comfortable, light/compact, light/comfortable
    focus-visibledark/compact, dark/comfortable, light/compact, light/comfortable
    disableddark/compact, dark/comfortable, light/compact, light/comfortable

    设计令牌

    --ac-sys-action-accent

    接口

    Props

    PropTypeRequiredDefault
    aboutstring | undefinedNo—
    acceptstring | undefinedNo—
    accessKeystring | undefinedNo—
    altstring | undefinedNo—
    aria-activedescendantstring | undefinedNo—
    aria-atomic(boolean | "true" | "false") | undefinedNo—
    aria-autocomplete"list" | "none" | "inline" | "both" | undefinedNo—
    aria-braillelabelstring | undefinedNo—
    aria-brailleroledescriptionstring | undefinedNo—
    aria-busy(boolean | "true" | "false") | undefinedNo—
    aria-checkedboolean | "mixed" | "true" | "false" | undefinedNo—
    aria-colcountnumber | undefinedNo—
    aria-colindexnumber | undefinedNo—
    aria-colindextextstring | undefinedNo—
    aria-colspannumber | undefinedNo—
    aria-controlsstring | undefinedNo—
    aria-currentboolean | "step" | "true" | "false" | "page" | "location" | "date" | "time" | undefinedNo—
    aria-describedbystring | undefinedNo—
    aria-descriptionstring | undefinedNo—
    aria-detailsstring | undefinedNo—
    aria-disabled(boolean | "true" | "false") | undefinedNo—
    aria-dropeffect"none" | "link" | "copy" | "execute" | "move" | "popup" | undefinedNo—
    aria-errormessagestring | undefinedNo—
    aria-expanded(boolean | "true" | "false") | undefinedNo—
    aria-flowtostring | undefinedNo—
    aria-grabbed(boolean | "true" | "false") | undefinedNo—
    aria-haspopupboolean | "true" | "false" | "dialog" | "grid" | "listbox" | "menu" | "tree" | undefinedNo—
    aria-hidden(boolean | "true" | "false") | undefinedNo—
    aria-invalidboolean | "true" | "false" | "grammar" | "spelling" | undefinedNo—
    aria-keyshortcutsstring | undefinedNo—
    aria-labelstring | undefinedNo—
    aria-labelledbystring | undefinedNo—
    aria-levelnumber | undefinedNo—
    aria-live"off" | "assertive" | "polite" | undefinedNo—
    aria-modal(boolean | "true" | "false") | undefinedNo—
    aria-multiline(boolean | "true" | "false") | undefinedNo—
    aria-multiselectable(boolean | "true" | "false") | undefinedNo—
    aria-orientation"horizontal" | "vertical" | undefinedNo—
    aria-ownsstring | undefinedNo—
    aria-placeholderstring | undefinedNo—
    aria-posinsetnumber | undefinedNo—
    aria-pressedboolean | "mixed" | "true" | "false" | undefinedNo—
    aria-readonly(boolean | "true" | "false") | undefinedNo—
    aria-relevant"text" | "additions" | "additions removals" | "additions text" | "all" | "removals" | "removals additions" | "removals text" | "text additions" | "text removals" | undefinedNo—
    aria-required(boolean | "true" | "false") | undefinedNo—
    aria-roledescriptionstring | undefinedNo—
    aria-rowcountnumber | undefinedNo—
    aria-rowindexnumber | undefinedNo—
    aria-rowindextextstring | undefinedNo—
    aria-rowspannumber | undefinedNo—
    aria-selected(boolean | "true" | "false") | undefinedNo—
    aria-setsizenumber | undefinedNo—
    aria-sort"ascending" | "descending" | "none" | "other" | undefinedNo—
    aria-valuemaxnumber | undefinedNo—
    aria-valueminnumber | undefinedNo—
    aria-valuenownumber | undefinedNo—
    aria-valuetextstring | undefinedNo—
    autoCapitalize"none" | "off" | "on" | "sentences" | "words" | "characters" | (string & {}) | undefinedNo—
    autoCompleteReact.HTMLInputAutoCompleteAttribute | undefinedNo—
    autoCorrectstring | undefinedNo—
    autoFocusboolean | undefinedNo—
    autoSavestring | undefinedNo—
    captureboolean | "user" | "environment" | undefinedNo—
    checkedboolean | 'mixed'No—
    childrenReact.ReactNodeNo—
    classNamestring | undefinedNo—
    colorstring | undefinedNo—
    contentstring | undefinedNo—
    contentEditable(boolean | "true" | "false") | "inherit" | "plaintext-only" | undefinedNo—
    contextMenustring | undefinedNo—
    dangerouslySetInnerHTML{ __html: string | TrustedHTML; } | undefinedNo—
    datatypestring | undefinedNo—
    defaultCheckedbooleanNo—
    defaultValuestring | number | readonly string[] | undefinedNo—
    dirstring | undefinedNo—
    disabledboolean | undefinedNo—
    draggable(boolean | "true" | "false") | undefinedNo—
    enterKeyHint"enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefinedNo—
    exportpartsstring | undefinedNo—
    formstring | undefinedNo—
    formActionstring | ((formData: FormData) => void | Promise<void>) | undefinedNo—
    formEncTypestring | undefinedNo—
    formMethodstring | undefinedNo—
    formNoValidateboolean | undefinedNo—
    formTargetstring | undefinedNo—
    heightstring | number | undefinedNo—
    hiddenboolean | undefinedNo—
    idstring | undefinedNo—
    inertboolean | undefinedNo—
    inlistanyNo—
    inputMode"numeric" | "none" | "search" | "text" | "tel" | "url" | "email" | "decimal" | undefinedNo—
    isstring | undefinedNo—
    itemIDstring | undefinedNo—
    itemPropstring | undefinedNo—
    itemRefstring | undefinedNo—
    itemScopeboolean | undefinedNo—
    itemTypestring | undefinedNo—
    keyReact.Key | null | undefinedNo—
    labelReactNodeNo—
    langstring | undefinedNo—
    liststring | undefinedNo—
    maxstring | number | undefinedNo—
    maxLengthnumber | undefinedNo—
    minstring | number | undefinedNo—
    minLengthnumber | undefinedNo—
    multipleboolean | undefinedNo—
    namestring | undefinedNo—
    noncestring | undefinedNo—
    onAbortReact.ReactEventHandler<HTMLInputElement> | undefinedNo—
    onAbortCaptureReact.ReactEventHandler<HTMLInputElement> | undefinedNo—
    onAnimationEndReact.AnimationEventHandler<HTMLInputElement> | undefinedNo—
    onAnimationEndCaptureReact.AnimationEventHandler<HTMLInputElement> | undefinedNo—
    onAnimationIterationReact.AnimationEventHandler<HTMLInputElement> | undefinedNo—
    onAnimationIterationCaptureReact.AnimationEventHandler<HTMLInputElement> | undefinedNo—
    onAnimationStartReact.AnimationEventHandler<HTMLInputElement> | undefinedNo—
    onAnimationStartCaptureReact.AnimationEventHandler<HTMLInputElement> | undefinedNo—
    onAuxClickReact.MouseEventHandler<HTMLInputElement> | undefinedNo—
    onAuxClickCaptureReact.MouseEventHandler<HTMLInputElement> | undefinedNo—
    onBeforeInputReact.InputEventHandler<HTMLInputElement> | undefinedNo—
    onBeforeInputCaptureReact.FormEventHandler<HTMLInputElement> | undefinedNo—
    onBeforeToggleReact.ToggleEventHandler<HTMLInputElement> | undefinedNo—
    onBlurReact.FocusEventHandler<HTMLInputElement> | undefinedNo—
    onBlurCaptureReact.FocusEventHandler<HTMLInputElement> | undefinedNo—
    onCanPlayReact.ReactEventHandler<HTMLInputElement> | undefinedNo—
    onCanPlayCaptureReact.ReactEventHandler<HTMLInputElement> | undefinedNo—
    onCanPlayThroughReact.ReactEventHandler<HTMLInputElement> | undefinedNo—
    onCanPlayThroughCaptureReact.ReactEventHandler<HTMLInputElement> | undefinedNo—
    onChangeCaptureReact.FormEventHandler<HTMLInputElement> | undefinedNo—
    onCheckedChange((next: boolean, event: React.ChangeEvent<HTMLInputElement>) => void) | undefinedNo—
    onClickReact.MouseEventHandler<HTMLInputElement> | undefinedNo—
    onClickCaptureReact.MouseEventHandler<HTMLInputElement> | undefinedNo—
    onCompositionEndReact.CompositionEventHandler<HTMLInputElement> | undefinedNo—
    onCompositionEndCaptureReact.CompositionEventHandler<HTMLInputElement> | undefinedNo—
    onCompositionStartReact.CompositionEventHandler<HTMLInputElement> | undefinedNo—
    onCompositionStartCaptureReact.CompositionEventHandler<HTMLInputElement> | undefinedNo—
    onCompositionUpdateReact.CompositionEventHandler<HTMLInputElement> | undefinedNo—
    onCompositionUpdateCaptureReact.CompositionEventHandler<HTMLInputElement> | undefinedNo—
    onContextMenuReact.MouseEventHandler<HTMLInputElement> | undefinedNo—
    onContextMenuCaptureReact.MouseEventHandler<HTMLInputElement> | undefinedNo—
    onCopyReact.ClipboardEventHandler<HTMLInputElement> | undefinedNo—
    onCopyCaptureReact.ClipboardEventHandler<HTMLInputElement> | undefinedNo—
    onCutReact.ClipboardEventHandler<HTMLInputElement> | undefinedNo—
    onCutCaptureReact.ClipboardEventHandler<HTMLInputElement> | undefinedNo—
    onDoubleClickReact.MouseEventHandler<HTMLInputElement> | undefinedNo—
    onDoubleClickCaptureReact.MouseEventHandler<HTMLInputElement> | undefinedNo—
    onDragReact.DragEventHandler<HTMLInputElement> | undefinedNo—
    onDragCaptureReact.DragEventHandler<HTMLInputElement> | undefinedNo—
    onDragEndReact.DragEventHandler<HTMLInputElement> | undefinedNo—
    onDragEndCaptureReact.DragEventHandler<HTMLInputElement> | undefinedNo—
    onDragEnterReact.DragEventHandler<HTMLInputElement> | undefinedNo—
    onDragEnterCaptureReact.DragEventHandler<HTMLInputElement> | undefinedNo—
    onDragExitReact.DragEventHandler<HTMLInputElement> | undefinedNo—
    onDragExitCaptureReact.DragEventHandler<HTMLInputElement> | undefinedNo—
    onDragLeaveReact.DragEventHandler<HTMLInputElement> | undefinedNo—
    onDragLeaveCaptureReact.DragEventHandler<HTMLInputElement> | undefinedNo—
    onDragOverReact.DragEventHandler<HTMLInputElement> | undefinedNo—
    onDragOverCaptureReact.DragEventHandler<HTMLInputElement> | undefinedNo—
    onDragStartReact.DragEventHandler<HTMLInputElement> | undefinedNo—
    onDragStartCaptureReact.DragEventHandler<HTMLInputElement> | undefinedNo—
    onDropReact.DragEventHandler<HTMLInputElement> | undefinedNo—
    onDropCaptureReact.DragEventHandler<HTMLInputElement> | undefinedNo—
    onDurationChangeReact.ReactEventHandler<HTMLInputElement> | undefinedNo—
    onDurationChangeCaptureReact.ReactEventHandler<HTMLInputElement> | undefinedNo—
    onEmptiedReact.ReactEventHandler<HTMLInputElement> | undefinedNo—
    onEmptiedCaptureReact.ReactEventHandler<HTMLInputElement> | undefinedNo—
    onEncryptedReact.ReactEventHandler<HTMLInputElement> | undefinedNo—
    onEncryptedCaptureReact.ReactEventHandler<HTMLInputElement> | undefinedNo—
    onEndedReact.ReactEventHandler<HTMLInputElement> | undefinedNo—
    onEndedCaptureReact.ReactEventHandler<HTMLInputElement> | undefinedNo—
    onErrorReact.ReactEventHandler<HTMLInputElement> | undefinedNo—
    onErrorCaptureReact.ReactEventHandler<HTMLInputElement> | undefinedNo—
    onFocusReact.FocusEventHandler<HTMLInputElement> | undefinedNo—
    onFocusCaptureReact.FocusEventHandler<HTMLInputElement> | undefinedNo—
    onGotPointerCaptureReact.PointerEventHandler<HTMLInputElement> | undefinedNo—
    onGotPointerCaptureCaptureReact.PointerEventHandler<HTMLInputElement> | undefinedNo—
    onInputReact.FormEventHandler<HTMLInputElement> | undefinedNo—
    onInputCaptureReact.FormEventHandler<HTMLInputElement> | undefinedNo—
    onInvalidReact.FormEventHandler<HTMLInputElement> | undefinedNo—
    onInvalidCaptureReact.FormEventHandler<HTMLInputElement> | undefinedNo—
    onKeyDownReact.KeyboardEventHandler<HTMLInputElement> | undefinedNo—
    onKeyDownCaptureReact.KeyboardEventHandler<HTMLInputElement> | undefinedNo—
    onKeyPressReact.KeyboardEventHandler<HTMLInputElement> | undefinedNo—
    onKeyPressCaptureReact.KeyboardEventHandler<HTMLInputElement> | undefinedNo—
    onKeyUpReact.KeyboardEventHandler<HTMLInputElement> | undefinedNo—
    onKeyUpCaptureReact.KeyboardEventHandler<HTMLInputElement> | undefinedNo—
    onLoadReact.ReactEventHandler<HTMLInputElement> | undefinedNo—
    onLoadCaptureReact.ReactEventHandler<HTMLInputElement> | undefinedNo—
    onLoadStartReact.ReactEventHandler<HTMLInputElement> | undefinedNo—
    onLoadStartCaptureReact.ReactEventHandler<HTMLInputElement> | undefinedNo—
    onLoadedDataReact.ReactEventHandler<HTMLInputElement> | undefinedNo—
    onLoadedDataCaptureReact.ReactEventHandler<HTMLInputElement> | undefinedNo—
    onLoadedMetadataReact.ReactEventHandler<HTMLInputElement> | undefinedNo—
    onLoadedMetadataCaptureReact.ReactEventHandler<HTMLInputElement> | undefinedNo—
    onLostPointerCaptureReact.PointerEventHandler<HTMLInputElement> | undefinedNo—
    onLostPointerCaptureCaptureReact.PointerEventHandler<HTMLInputElement> | undefinedNo—
    onMouseDownReact.MouseEventHandler<HTMLInputElement> | undefinedNo—
    onMouseDownCaptureReact.MouseEventHandler<HTMLInputElement> | undefinedNo—
    onMouseEnterReact.MouseEventHandler<HTMLInputElement> | undefinedNo—
    onMouseLeaveReact.MouseEventHandler<HTMLInputElement> | undefinedNo—
    onMouseMoveReact.MouseEventHandler<HTMLInputElement> | undefinedNo—
    onMouseMoveCaptureReact.MouseEventHandler<HTMLInputElement> | undefinedNo—
    onMouseOutReact.MouseEventHandler<HTMLInputElement> | undefinedNo—
    onMouseOutCaptureReact.MouseEventHandler<HTMLInputElement> | undefinedNo—
    onMouseOverReact.MouseEventHandler<HTMLInputElement> | undefinedNo—
    onMouseOverCaptureReact.MouseEventHandler<HTMLInputElement> | undefinedNo—
    onMouseUpReact.MouseEventHandler<HTMLInputElement> | undefinedNo—
    onMouseUpCaptureReact.MouseEventHandler<HTMLInputElement> | undefinedNo—
    onPasteReact.ClipboardEventHandler<HTMLInputElement> | undefinedNo—
    onPasteCaptureReact.ClipboardEventHandler<HTMLInputElement> | undefinedNo—
    onPauseReact.ReactEventHandler<HTMLInputElement> | undefinedNo—
    onPauseCaptureReact.ReactEventHandler<HTMLInputElement> | undefinedNo—
    onPlayReact.ReactEventHandler<HTMLInputElement> | undefinedNo—
    onPlayCaptureReact.ReactEventHandler<HTMLInputElement> | undefinedNo—
    onPlayingReact.ReactEventHandler<HTMLInputElement> | undefinedNo—
    onPlayingCaptureReact.ReactEventHandler<HTMLInputElement> | undefinedNo—
    onPointerCancelReact.PointerEventHandler<HTMLInputElement> | undefinedNo—
    onPointerCancelCaptureReact.PointerEventHandler<HTMLInputElement> | undefinedNo—
    onPointerDownReact.PointerEventHandler<HTMLInputElement> | undefinedNo—
    onPointerDownCaptureReact.PointerEventHandler<HTMLInputElement> | undefinedNo—
    onPointerEnterReact.PointerEventHandler<HTMLInputElement> | undefinedNo—
    onPointerLeaveReact.PointerEventHandler<HTMLInputElement> | undefinedNo—
    onPointerMoveReact.PointerEventHandler<HTMLInputElement> | undefinedNo—
    onPointerMoveCaptureReact.PointerEventHandler<HTMLInputElement> | undefinedNo—
    onPointerOutReact.PointerEventHandler<HTMLInputElement> | undefinedNo—
    onPointerOutCaptureReact.PointerEventHandler<HTMLInputElement> | undefinedNo—
    onPointerOverReact.PointerEventHandler<HTMLInputElement> | undefinedNo—
    onPointerOverCaptureReact.PointerEventHandler<HTMLInputElement> | undefinedNo—
    onPointerUpReact.PointerEventHandler<HTMLInputElement> | undefinedNo—
    onPointerUpCaptureReact.PointerEventHandler<HTMLInputElement> | undefinedNo—
    onProgressReact.ReactEventHandler<HTMLInputElement> | undefinedNo—
    onProgressCaptureReact.ReactEventHandler<HTMLInputElement> | undefinedNo—
    onRateChangeReact.ReactEventHandler<HTMLInputElement> | undefinedNo—
    onRateChangeCaptureReact.ReactEventHandler<HTMLInputElement> | undefinedNo—
    onResetReact.FormEventHandler<HTMLInputElement> | undefinedNo—
    onResetCaptureReact.FormEventHandler<HTMLInputElement> | undefinedNo—
    onScrollReact.UIEventHandler<HTMLInputElement> | undefinedNo—
    onScrollCaptureReact.UIEventHandler<HTMLInputElement> | undefinedNo—
    onScrollEndReact.UIEventHandler<HTMLInputElement> | undefinedNo—
    onScrollEndCaptureReact.UIEventHandler<HTMLInputElement> | undefinedNo—
    onSeekedReact.ReactEventHandler<HTMLInputElement> | undefinedNo—
    onSeekedCaptureReact.ReactEventHandler<HTMLInputElement> | undefinedNo—
    onSeekingReact.ReactEventHandler<HTMLInputElement> | undefinedNo—
    onSeekingCaptureReact.ReactEventHandler<HTMLInputElement> | undefinedNo—
    onSelectReact.ReactEventHandler<HTMLInputElement> | undefinedNo—
    onSelectCaptureReact.ReactEventHandler<HTMLInputElement> | undefinedNo—
    onStalledReact.ReactEventHandler<HTMLInputElement> | undefinedNo—
    onStalledCaptureReact.ReactEventHandler<HTMLInputElement> | undefinedNo—
    onSubmitReact.FormEventHandler<HTMLInputElement> | undefinedNo—
    onSubmitCaptureReact.FormEventHandler<HTMLInputElement> | undefinedNo—
    onSuspendReact.ReactEventHandler<HTMLInputElement> | undefinedNo—
    onSuspendCaptureReact.ReactEventHandler<HTMLInputElement> | undefinedNo—
    onTimeUpdateReact.ReactEventHandler<HTMLInputElement> | undefinedNo—
    onTimeUpdateCaptureReact.ReactEventHandler<HTMLInputElement> | undefinedNo—
    onToggleReact.ToggleEventHandler<HTMLInputElement> | undefinedNo—
    onTouchCancelReact.TouchEventHandler<HTMLInputElement> | undefinedNo—
    onTouchCancelCaptureReact.TouchEventHandler<HTMLInputElement> | undefinedNo—
    onTouchEndReact.TouchEventHandler<HTMLInputElement> | undefinedNo—
    onTouchEndCaptureReact.TouchEventHandler<HTMLInputElement> | undefinedNo—
    onTouchMoveReact.TouchEventHandler<HTMLInputElement> | undefinedNo—
    onTouchMoveCaptureReact.TouchEventHandler<HTMLInputElement> | undefinedNo—
    onTouchStartReact.TouchEventHandler<HTMLInputElement> | undefinedNo—
    onTouchStartCaptureReact.TouchEventHandler<HTMLInputElement> | undefinedNo—
    onTransitionCancelReact.TransitionEventHandler<HTMLInputElement> | undefinedNo—
    onTransitionCancelCaptureReact.TransitionEventHandler<HTMLInputElement> | undefinedNo—
    onTransitionEndReact.TransitionEventHandler<HTMLInputElement> | undefinedNo—
    onTransitionEndCaptureReact.TransitionEventHandler<HTMLInputElement> | undefinedNo—
    onTransitionRunReact.TransitionEventHandler<HTMLInputElement> | undefinedNo—
    onTransitionRunCaptureReact.TransitionEventHandler<HTMLInputElement> | undefinedNo—
    onTransitionStartReact.TransitionEventHandler<HTMLInputElement> | undefinedNo—
    onTransitionStartCaptureReact.TransitionEventHandler<HTMLInputElement> | undefinedNo—
    onVolumeChangeReact.ReactEventHandler<HTMLInputElement> | undefinedNo—
    onVolumeChangeCaptureReact.ReactEventHandler<HTMLInputElement> | undefinedNo—
    onWaitingReact.ReactEventHandler<HTMLInputElement> | undefinedNo—
    onWaitingCaptureReact.ReactEventHandler<HTMLInputElement> | undefinedNo—
    onWheelReact.WheelEventHandler<HTMLInputElement> | undefinedNo—
    onWheelCaptureReact.WheelEventHandler<HTMLInputElement> | undefinedNo—
    partstring | undefinedNo—
    patternstring | undefinedNo—
    placeholderstring | undefinedNo—
    popover"" | "auto" | "manual" | "hint" | undefinedNo—
    popoverTargetstring | undefinedNo—
    popoverTargetAction"toggle" | "show" | "hide" | undefinedNo—
    prefixstring | undefinedNo—
    propertystring | undefinedNo—
    radioGroupstring | undefinedNo—
    readOnlyboolean | undefinedNo—
    refReact.Ref<HTMLInputElement> | undefinedNo—
    relstring | undefinedNo—
    requiredboolean | undefinedNo—
    resourcestring | undefinedNo—
    resultsnumber | undefinedNo—
    revstring | undefinedNo—
    roleReact.AriaRole | undefinedNo—
    securitystring | undefinedNo—
    slotstring | undefinedNo—
    spellCheck(boolean | "true" | "false") | undefinedNo—
    srcstring | undefinedNo—
    stepstring | number | undefinedNo—
    suppressContentEditableWarningboolean | undefinedNo—
    suppressHydrationWarningboolean | undefinedNo—
    tabIndexnumber | undefinedNo—
    titlestring | undefinedNo—
    translate"yes" | "no" | undefinedNo—
    typeofstring | undefinedNo—
    unselectable"off" | "on" | undefinedNo—
    valuestring | number | readonly string[] | undefinedNo—
    vocabstring | undefinedNo—
    widthstring | number | undefinedNo—

    Constraints

    • Provide a visible label, a Field label or an accessible name.
    • Use checked with onCheckedChange for controlled selection.

    Anti-patterns

    • Storing mixed as a submitted form value.
    • Combining defaultChecked with a controlled checked value.