Skip to content

Commit f57fc8a

Browse files
author
Sana Malik
committed
Fix docs
1 parent c01680d commit f57fc8a

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

packages/@react-spectrum/labeledvalue/docs/LabeledValue.mdx

+2
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ By default, the list is displayed as a conjunction (an "and"-based grouping of i
116116
The value can be a component and will be rendered as provided. Components cannot be editable.
117117

118118
```tsx example
119+
import {Link} from '@adobe/react-spectrum';
120+
119121
<LabeledValue label="Website" value={<Link href="https://www.adobe.com/">Adobe.com</Link>} />
120122
```
121123

Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import {DateTime, LabeledValueBaseProps} from '@react-spectrum/labeledvalue/src/LabeledValue';
22
import {RangeValue} from '@react-types/shared';
3+
import { ReactNode } from 'react';
34

45
// The doc generator is not smart enough to handle the real types for LabeledValue so this is a simpler one.
56
export interface LabeledValueProps extends LabeledValueBaseProps {
67
/** The value to display. */
7-
value: string | string[] | number | RangeValue<number> | DateTime | RangeValue<DateTime>,
8+
value: string | string[] | number | RangeValue<number> | DateTime | RangeValue<DateTime> | ReactNode,
89
/** Formatting options for the value. The available options depend on the type passed to the `value` prop. */
910
formatOptions?: Intl.NumberFormatOptions | Intl.DateTimeFormatOptions | Intl.ListFormatOptions
1011
}

packages/@react-spectrum/labeledvalue/src/LabeledValue.tsx

+7
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,19 @@ interface StringListProps<T extends string[]> {
5757
/** Formatting options for the value. */
5858
formatOptions?: Intl.ListFormatOptions
5959
}
60+
interface ReactNodeProps<T extends ReactNode> {
61+
/** The value to display. */
62+
value: T
63+
/** Formatting options for the value. */
64+
formatOptions?: never
65+
}
6066

6167
type LabeledValueProps<T> =
6268
T extends NumberValue ? NumberProps<T> :
6369
T extends DateTimeValue ? DateProps<T> :
6470
T extends string[] ? StringListProps<T> :
6571
T extends string ? StringProps<T> :
72+
T extends ReactNode ? ReactNodeProps<T> :
6673
never;
6774

6875
type SpectrumLabeledValueTypes = string[] | string | Date | CalendarDate | CalendarDateTime | ZonedDateTime | Time | number | RangeValue<number> | RangeValue<DateTime> | ReactNode;

0 commit comments

Comments
 (0)