Overview
TherenderCheckbox function renders a checkbox input with proper styling, accessibility attributes, and support for indeterminate state. It’s used by the SelectColumn for row selection.
Signature
Parameters
The checkbox renderer props.
RenderCheckboxProps
Whether the checkbox is checked.
Whether the checkbox is in an indeterminate state (partially checked).
Whether the checkbox is disabled.
Callback when the checkbox state changes. Receives the new checked state and whether shift was pressed.
The tab index for keyboard navigation.
Accessible label for the checkbox.
ID of the element that labels the checkbox.
Return Value
A styled checkbox input element with proper accessibility attributes.
Usage
You can customize the default checkbox renderer globally:Features
- Indeterminate state: Supports the indeterminate state for “select all” checkboxes
- Shift-click support: Detects shift key for range selection
- Accessibility: Includes focus styles and ARIA attributes
- Styling: Centered in cell with proper sizing (20×20px)
- Disabled state: Shows disabled cursor when checkbox is disabled
Example
Custom checkbox with additional styling:Default Styling
The checkbox includes these default styles:- Centered in the cell with
margin: auto - Fixed size: 20×20 pixels
- Focus outline: 2px solid with focus color
- Cursor: pointer when enabled
Related
- SelectColumn - Pre-configured selection column
- useRowSelection - Hook for row selection in cells
- useHeaderRowSelection - Hook for header selection
- Renderers.renderCheckbox - Custom renderer configuration