@@ -119,7 +122,18 @@ export function SelectField(props: SelectFieldProps) {
size={size}
>
{selectState.selectedItem ? (
- selectState.selectedItem.rendered
+ <>
+
+ {selectState.selectedItem.rendered}
+
+ {selectedDescription && (
+
+
+ {selectedDescription}
+
+
+ )}
+ >
) : (
{placeholder}
)}
diff --git a/easy-ui-react/src/Select/SelectOption.tsx b/easy-ui-react/src/Select/SelectOption.tsx
index 49d0d972..030fc798 100644
--- a/easy-ui-react/src/Select/SelectOption.tsx
+++ b/easy-ui-react/src/Select/SelectOption.tsx
@@ -3,7 +3,6 @@ import { useOption } from "react-aria";
import { Item, Node, SelectState } from "react-stately";
import { Text } from "../Text";
import { NoInfer } from "../types";
-
import styles from "./Select.module.scss";
export type SelectOptionProps = {
@@ -11,6 +10,10 @@ export type SelectOptionProps = {
"aria-label"?: string;
/** Rendered contents of the option or child options. */
children: ReactNode;
+ /** Secondary text shown under the main option text. */
+ description?: ReactNode;
+ /** Plain text value for accessibility and typeahead. */
+ textValue?: string;
};
/**
@@ -41,6 +44,9 @@ export function SelectOptionContent
({
ref,
);
+ const description = (item.props as SelectOptionProps | undefined)
+ ?.description;
+
return (
({
data-is-selected={isSelected}
>
-
+
{item.rendered}
+ {description && (
+
+
+ {description}
+
+
+ )}
);
diff --git a/easy-ui-react/src/Select/SelectTrigger.tsx b/easy-ui-react/src/Select/SelectTrigger.tsx
index 405dc9eb..415aaf87 100644
--- a/easy-ui-react/src/Select/SelectTrigger.tsx
+++ b/easy-ui-react/src/Select/SelectTrigger.tsx
@@ -1,4 +1,4 @@
-import React, { DOMAttributes, ReactNode } from "react";
+import React, { ReactNode, DOMAttributes } from "react";
import ExpandMoreIcon400 from "@easypost/easy-ui-icons/ExpandMore400";
import { FocusableElement } from "@react-types/shared";
import { useInternalSelectContext } from "./SelectContext";
@@ -65,9 +65,9 @@ export function SelectTrigger(props: SelectTriggerProps) {
/>
)}
-
+
{children}
-
+