From 0d512e0659ab1d6489290219efe42b75c3cb3918 Mon Sep 17 00:00:00 2001 From: Thoriq Firdaus <2067467+tfirdaus@users.noreply.github.com> Date: Sat, 14 Dec 2024 13:14:10 +0700 Subject: [PATCH] Remove element when label is not provided (#28) This Pull Request adds new logic in the `CheckboxGroup` component that handles the element for the label. If the label is not provided, it now will not render the element in the DOM. --- .../src/CheckboxGroup/CheckboxGroup.tsx | 40 ++++++++++--------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/packages/kubrick/src/CheckboxGroup/CheckboxGroup.tsx b/packages/kubrick/src/CheckboxGroup/CheckboxGroup.tsx index 938b8f7..d9e87a6 100644 --- a/packages/kubrick/src/CheckboxGroup/CheckboxGroup.tsx +++ b/packages/kubrick/src/CheckboxGroup/CheckboxGroup.tsx @@ -84,25 +84,27 @@ export const CheckboxGroup = forwardRef( aria-invalid={isInvalid} ref={ref} > - - {label} - {isRequired ? - - * - - : ''} - + {label && ( + + {label} + {isRequired ? + + * + + : ''} + + )}