File tree 3 files changed +10
-3
lines changed
packages/segmented-control/src/SegmentedControl
3 files changed +10
-3
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' @leafygreen-ui/segmented-control ' : minor
3
+ ---
4
+
5
+ Label prop now accepts type ` React.ReactNode ` instead of ` string `
Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ export const SegmentedControl = forwardRef<
70
70
71
71
const name = useIdAllocator ( {
72
72
prefix : 'segmented-control' ,
73
- id : nameProp ?? label ,
73
+ id : nameProp ,
74
74
} ) ;
75
75
76
76
// If a value is given, then it's controlled
@@ -374,7 +374,7 @@ SegmentedControl.propTypes = {
374
374
onChange : PropTypes . func ,
375
375
defaultValue : PropTypes . string ,
376
376
value : PropTypes . string ,
377
- label : PropTypes . string ,
377
+ label : PropTypes . node ,
378
378
name : PropTypes . string ,
379
379
followFocus : PropTypes . bool ,
380
380
className : PropTypes . string ,
Original file line number Diff line number Diff line change
1
+ import React from 'react' ;
2
+
1
3
import { HTMLElementProps } from '@leafygreen-ui/lib' ;
2
4
3
5
export const DeprecatedSize = {
@@ -49,7 +51,7 @@ export interface SegmentedControlProps
49
51
/**
50
52
* A text label to the left of the segmented control. Sets the `name` prop if none is provided.
51
53
*/
52
- label ?: string ;
54
+ label ?: React . ReactNode ;
53
55
54
56
/**
55
57
* Identifies the segmented control group to screen readers. Auto-generated if no `name` or `label` is provided.
You can’t perform that action at this time.
0 commit comments