Skip to content

Commit 7f996d0

Browse files
authored
Merge pull request #444 from mashmatrix/allow-node-in-label
use children for label content in checkbox/radio cmp
2 parents 668a3e3 + 29ed691 commit 7f996d0

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ version: 2.1
22

33
defaults: &defaults
44
docker:
5-
- image: cimg/node:16.14.2-browsers
5+
- image: cimg/node:20.12.1-browsers
66
working_directory: ~/project
77

88
orbs:
9-
browser-tools: circleci/browser-tools@1.4.6
9+
browser-tools: circleci/browser-tools@1.4.8
1010

1111
jobs:
1212
install:

src/scripts/Checkbox.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export const Checkbox: FC<CheckboxProps> = (props) => {
3232
cols,
3333
elementRef,
3434
inputRef,
35+
children,
3536
...rprops
3637
} = props;
3738
const { grouped } = useContext(CheckboxGroupContext);
@@ -41,7 +42,7 @@ export const Checkbox: FC<CheckboxProps> = (props) => {
4142
<label className={checkClassNames}>
4243
<input ref={inputRef} type='checkbox' {...rprops} />
4344
<span className='slds-checkbox_faux' />
44-
<span className='slds-form-element__label'>{label}</span>
45+
<span className='slds-form-element__label'>{label || children}</span>
4546
</label>
4647
);
4748
return grouped ? (

src/scripts/Radio.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export const Radio: FC<RadioProps> = ({
2323
value,
2424
inputRef,
2525
onChange: onChange_,
26+
children,
2627
...props
2728
}) => {
2829
const { name: grpName, onValueChange } = useContext(RadioGroupContext);
@@ -46,7 +47,7 @@ export const Radio: FC<RadioProps> = ({
4647
{...props}
4748
/>
4849
<span className='slds-radio_faux' />
49-
<span className='slds-form-element__label'>{label}</span>
50+
<span className='slds-form-element__label'>{label || children}</span>
5051
</label>
5152
);
5253
};

0 commit comments

Comments
 (0)