Skip to content
This repository was archived by the owner on Feb 27, 2024. It is now read-only.

Commit 0bfd9f1

Browse files
author
Mike England
committed
Add isRequired to CheckboxGroup Input
1 parent b461f72 commit 0bfd9f1

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

components/atoms/Inputs/CheckboxGroup/CheckboxGroup.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,16 @@ import Checkbox from '@/components/atoms/Inputs/Checkbox'
1111
* @param {string|number} props.id CheckboxGroup id.
1212
* @param {string} props.label CheckboxGroup input label.
1313
* @param {string} props.description CheckboxGroup input name.
14+
* @param {boolean} props.isRequired If input is required.
1415
* @return {Element} The CheckboxGroup component.
1516
*/
1617
export default function CheckboxGroup({
1718
checkboxes,
1819
className,
1920
description,
2021
id: groupId,
21-
label
22+
label,
23+
isRequired
2224
}) {
2325
return (
2426
<div
@@ -27,7 +29,11 @@ export default function CheckboxGroup({
2729
id={groupId}
2830
role="group"
2931
>
30-
{label && <label htmlFor={groupId}>{label}</label>}
32+
{label && (
33+
<label htmlFor={groupId} required={isRequired}>
34+
{label}
35+
</label>
36+
)}
3137
{description && <p>{description}</p>}
3238
{!!checkboxes.length > 0 &&
3339
checkboxes.map((checkbox) => {

0 commit comments

Comments
 (0)