JSFiddle - React, Tailwind, and code Playground
HTML
<table>
<thead>
<tr>
<th>
<input type="checkbox" class="groupHeading" data-group="GroupA" />
Group A
</th>
<th>
<input type="checkbox" class="GroupA columnHeading" data-group="GroupA" data-column="Column1" />
</th>
<th>
<input type="checkbox" class="GroupA columnHeading" data-group="GroupA" data-column="Column2" />
</th>
<th>
<input type="checkbox" class="GroupA columnHeading" data-group="GroupA" data-column="Column3" />
</th>
</tr>
</thead>
<tbody>
<tr>
<th>
Item 1 Label
</th>
<td>
<input type="checkbox" class="GroupA Column1" />
</td>
<td>
<input type="checkbox" class="GroupA Column2" />
</td>
<td>
<input type="checkbox" class="GroupA Column3" />
</td>
</tr>
<tr>
<th>
Item 2 Label
</th>
<td>
<input type="checkbox" class="GroupA Column1" />
</td>
<td>
<input type="checkbox" class="GroupA Column2" />
</td>
<td>
<input type="checkbox" class="GroupA Column3" />
</td>
</tr>
<tr>
<th>
Item 3 Label
</th>
<td>
<input type="checkbox" class="GroupA Column1" />
</td>
<td>
<input type="checkbox" class="GroupA Column2" />
</td>
<td>
<input type="checkbox" class="GroupA Column3" />
</td>
</tr>
</tbody>
</table>
CSS
table {
border: solid 1px #000;
width: 100%;
}
table th, table td {
border: solid 1px #000;
}
JavaScript
$('.groupHeading').change(function () {
$('.'+$(this).data('group')).attr('checked', $(this).is(':checked'));
});
$('.columnHeading').change(function () {
$('.'+$(this).data('group')+'.'+$(this).data('column')).attr('checked', $(this).is(':checked'));
});