Skip to content

Commit 762df55

Browse files
authored
Merge branch 'main' into brooke/disabled-radio
2 parents fd9ec63 + b0b70b7 commit 762df55

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

.changeset/little-spoons-doubt.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@leafygreen-ui/segmented-control': minor
3+
---
4+
5+
Label prop now accepts type `React.ReactNode` instead of `string`

packages/segmented-control/src/SegmentedControl/SegmentedControl.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export const SegmentedControl = forwardRef<
7070

7171
const name = useIdAllocator({
7272
prefix: 'segmented-control',
73-
id: nameProp ?? label,
73+
id: nameProp,
7474
});
7575

7676
// If a value is given, then it's controlled
@@ -374,7 +374,7 @@ SegmentedControl.propTypes = {
374374
onChange: PropTypes.func,
375375
defaultValue: PropTypes.string,
376376
value: PropTypes.string,
377-
label: PropTypes.string,
377+
label: PropTypes.node,
378378
name: PropTypes.string,
379379
followFocus: PropTypes.bool,
380380
className: PropTypes.string,

packages/segmented-control/src/SegmentedControl/SegmentedControl.types.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import React from 'react';
2+
13
import { HTMLElementProps } from '@leafygreen-ui/lib';
24

35
export const DeprecatedSize = {
@@ -49,7 +51,7 @@ export interface SegmentedControlProps
4951
/**
5052
* A text label to the left of the segmented control. Sets the `name` prop if none is provided.
5153
*/
52-
label?: string;
54+
label?: React.ReactNode;
5355

5456
/**
5557
* Identifies the segmented control group to screen readers. Auto-generated if no `name` or `label` is provided.

0 commit comments

Comments
 (0)