HomeGetting StartedColor SystemTypographySpacingIconographyLayoutInstallationUsageAngularBlazorReactSvelteVueThemingTypographyCustomizationCSS-Only ComponentsFormsIconsIllustrationsAccessibilityGlobal ConfigurationTailwind CSSSass LibraryForge MCP ServerDropdown OptionsFocus Indicator ClippingAll componentsButtonButton AreaChipFloating Action ButtonIcon ButtonSplit ButtonAutocompleteButton ToggleCalendarCheckboxChip FieldColor PickerDate PickerDate Range PickerFile PickerLabelRadioSelectSliderSwitchText FieldTime PickerApp BarApp LauncherDrawerMenuPaginatorSkip LinkStepperTabsView SwitcherAccordionApp LayoutCardDividerExpansion PanelScaffoldSplit ViewStackStructured CardToolbarBadgeBannerBusy IndicatorCircular ProgressDialogInline MessageLinear ProgressPage StateSkeletonToastTooltipAvatarIconKeyLabel ValueListMeterSecretTableTimelineTimestampTreeKeyboard ShortcutPopoverIntroductionColorTypographySpacingShapeBorderElevationLayeringAnimationUsageIcon LibraryBlocksRoadmapChangelogBlog

Checkbox

Checkboxes allow for selecting multiple options from a set.

SelectedUnselectedMixed

Overview

Checkboxes are selection controls that allow users to select multiple options from a set. They appear as small squares that display a checkmark when selected. Checkboxes are independent of each other, meaning selecting one does not affect the others in the same group.

Usage

forge-checkbox selects one or more independent options through checked and indeterminate, participates natively in form submission and validation (required, readonly, name), and supports dense and label-position. Use a checkbox when a user can pick any number of options from a list; use a radio button instead when exactly one option in a set must be chosen, or a switch instead to toggle a single setting on or off.

Rules

Do
Use checkboxes when a user can select zero, one, or many options from a list.Pair every checkbox with a clear, clickable label — don't rely on the box alone.Use the indeterminate state to reflect a parent checkbox whose children are partially selected.
Don't
Don't use a checkbox for a single on/off setting — use a switch instead.Don't use a checkbox when only one option in a set can be selected — use a radio button instead.Don't treat indeterminate as user-settable — it's a display-only state the app computes from the children's selection.

Indeterminate

Set checked and indeterminate to render distinct marks — indeterminate reflects a parent checkbox whose children are only partially selected.

Checked and indeterminate render distinct marks.

Label position

Set label-position to control whether the label sits before or after the checkbox.

label-position controls whether the label sits before or after the checkbox.

Dense

Set dense to reduce the checkbox’s size for compact layouts.

Dense reduces the checkbox's size for compact layouts.

Disabled and readonly

disabled excludes the checkbox from the form; readonly keeps it in the form but locks its value.

Disabled excludes the checkbox from the form; readonly keeps it in the form but locks its value.

Checkboxes select single values for submission in a form.

import "@tylertech/forge/checkbox";
Properties
PropertyAttributeTypeDefaultDescription
checkedcheckedbooleanfalseGets/sets whether the checkbox is checked.
defaultCheckeddefault-checkedbooleanfalseGets/sets whether the checkbox is checked by default.
indeterminateindeterminatebooleanfalseGets/sets the indeterminate state.
valuevaluestring'on'Controls the value submitted with a form when checked.
densedensebooleanfalseControls whether the checkbox is dense.
disableddisabledbooleanfalseControls whether the checkbox is disabled.
requiredrequiredbooleanfalseControls whether the checkbox is required.
readonlyreadonlybooleanfalseControls whether the checkbox is readonly.
labelPositionlabel-positionCheckboxLabelPosition'end'Controls whether the label appears before or after the checkbox.
Events
NameTypeDescription
changeEventDispatches when the checkbox is checked or unchecked.
CSS Parts
NameDescription
::part(root)Styles the root element.
::part(background)Styles the checkbox background element.
::part(checkmark)Styles the checkmark element.
::part(mixedmark)Styles the indeterminate mark element.
::part(label)Styles the label element.
::part(state-layer)Styles the state layer element.
::part(focus-indicator)Styles the focus indicator element.
CSS Custom Properties
NameDescription
--forge-checkbox-backgroundThe color of the checkbox background when unchecked and not indeterminate.
--forge-checkbox-widthThe inline size of the checkbox.
--forge-checkbox-heightThe block size of the checkbox.
--forge-checkbox-unchecked-border-widthThe width of the checkbox border when unchecked and not indeterminate.
--forge-checkbox-unchecked-border-colorThe color of the checkbox border when unchecked and not indeterminate.
--forge-checkbox-shapeThe shape of the checkbox.
--forge-checkbox-elevationThe shadow of the checkbox.
--forge-checkbox-gapThe space between the checkbox and label.
--forge-checkbox-justifyHow the checkbox and label are distributed along their main axis.
--forge-checkbox-alignHow the checkbox and label are distributed along their cross axis.
--forge-checkbox-directionWhether the checkbox and label are arranged along the inline or block axis.
--forge-checkbox-checked-backgroundThe color of the checkbox background when checked or indeterminate.
--forge-checkbox-checked-border-widthThe width of the checkbox border when checked or indeterminate.
--forge-checkbox-checked-border-colorThe color of the checkbox border when checked or indeterminate.
--forge-checkbox-icon-checked-colorThe color of the checkmark mark.
--forge-checkbox-icon-indeterminate-colorThe color of the indeterminate mark.
--forge-checkbox-icon-stroke-widthThe stroke width of the checkmark and indeterminate marks.
--forge-checkbox-state-layer-widthThe inline size of the state layer.
--forge-checkbox-state-layer-heightThe block size of the state layer.
--forge-checkbox-state-layer-checked-colorThe color of the state layer when checked.
--forge-checkbox-state-layer-unchecked-colorThe color of the state layer when unchecked.
--forge-checkbox-state-layer-shapeThe shape of the state layer.
--forge-checkbox-state-layer-dense-widthThe inline size of the state layer when dense.
--forge-checkbox-state-layer-dense-heightThe block size of the state layer when dense.
--forge-checkbox-disabled-opacityThe opacity when disabled.
--forge-checkbox-animation-durationThe duration of animations.
--forge-checkbox-background-animation-timingThe timing function of the background animations.
--forge-checkbox-icon-animation-timingThe timing function of the checked and indeterminate icons animations.
Methods
NameReturnsDescription
toggle(force)voidToggles the checkbox checked or unchecked.

Keyboard interaction

Every checkbox must be reachable by Tab, and pressing Space while focused toggles it the same as a mouse click.

Visual states

Checked, unchecked, focused, and disabled each need a distinct, visible cue — not just a color change.

Loading Forge chat…