Skip to content
PatternFly logo

Checkbox

A checkbox is used to select a single item or multiple items, typically to choose elements to perform an action or to reflect a binary setting.

Examples

Controlled

Uncontrolled

Disabled

Checkbox with description

Single-tenant cloud service hosted and managed by Red Hat that offers high-availability enterprise-grade clusters in a virtual private cloud on AWS or GCP.

Checkbox with body

This is where custom content goes.

Checkbox with description and body

Single-tenant cloud service hosted and managed by Red Hat that offers high-availability enterprise-grade clusters in a virtual private cloud on AWS or GCP.This is where custom content goes.

Standalone input

Required input

Props

Checkbox

*required
NameTypeDefaultDescription
idrequiredstringId of the checkbox.
aria-labelstringAria-label of the checkbox.
bodyReact.ReactNodeBody text of the checkbox
checkedboolean
classNamestring''Additional classes added to the checkbox.
componentReact.ElementType'div'Sets the input wrapper component to render. Defaults to <div>
descriptionReact.ReactNodeDescription text of the checkbox.
isCheckedboolean | nullfalseFlag to show if the checkbox is checked. If null, the checkbox will be indeterminate (partially checked).
isDisabledbooleanfalseFlag to show if the checkbox is disabled.
isRequiredbooleanfalseFlag to show if the checkbox is required.
isValidbooleantrueFlag to show if the checkbox selection is valid or invalid.
labelReact.ReactNodeLabel text of the checkbox.
onChange(checked: boolean, event: React.FormEvent<HTMLInputElement>) => void() => {}A callback for when the checkbox selection changes.
ouiaIdnumber | stringValue to overwrite the randomly generated data-ouia-component-id.
ouiaSafebooleantrueSet the value of data-ouia-safe. Only set to true when the component is in a static state, i.e. no animations are occurring. At all other times, this value must be false.

CSS variables

.pf-c-check--pf-c-check--GridGap
0.25rem 0.5rem
.pf-c-check--pf-c-check__label--disabled--Color
#6a6e73
.pf-c-check--pf-c-check__label--Color
#151515
.pf-c-check--pf-c-check__label--FontWeight
400
.pf-c-check--pf-c-check__label--FontSize
1rem
.pf-c-check--pf-c-check__label--LineHeight
1.3
.pf-c-check--pf-c-check__input--Height
1rem
.pf-c-check--pf-c-check__input--MarginTop
calc(((1rem * 1.3) - 1rem) / 2)
.pf-c-check--pf-c-check__description--FontSize
0.875rem
.pf-c-check--pf-c-check__description--Color
#6a6e73
.pf-c-check--pf-c-check__body--MarginTop
0.5rem
.pf-c-check--pf-c-check__label-required--MarginLeft
0.25rem
.pf-c-check--pf-c-check__label-required--FontSize
0.875rem
.pf-c-check--pf-c-check__label-required--Color
#c9190b
.pf-c-check.pf-m-standalone--pf-c-check--GridGap
0
.pf-c-check.pf-m-standalone--pf-c-check__input--Height
auto
.pf-c-check.pf-m-standalone--pf-c-check__input--MarginTop
0
.pf-c-check__label:disabled--pf-c-check__label--Color
#6a6e73

View source on GitHub