diff --git a/packages/@react-spectrum/s2/src/Field.tsx b/packages/@react-spectrum/s2/src/Field.tsx index 9cb60d5a009..805649d1d13 100644 --- a/packages/@react-spectrum/s2/src/Field.tsx +++ b/packages/@react-spectrum/s2/src/Field.tsx @@ -63,6 +63,10 @@ function FieldLabel(props: FieldLabelProps, ref: DOMRef) { labelProps.id = fallbackLabelPropsId; } + if (!props.children) { + return null; + } + return (
) { }, styles)}> {({percentage, valueText}) => ( <> - {label} - {valueText} + {label && {label}} + {label && {valueText}}
diff --git a/packages/@react-spectrum/s2/src/ProgressBar.tsx b/packages/@react-spectrum/s2/src/ProgressBar.tsx index 854841bdc6a..9c9b4949c27 100644 --- a/packages/@react-spectrum/s2/src/ProgressBar.tsx +++ b/packages/@react-spectrum/s2/src/ProgressBar.tsx @@ -127,8 +127,8 @@ function ProgressBar(props: ProgressBarProps, ref: DOMRef) { className={UNSAFE_className + wrapper({...props, size}, props.styles)}> {({percentage, valueText}) => ( <> - {label} - {valueText} + {label && {label}} + {label && {valueText}}
= { component: Form, @@ -54,3 +87,128 @@ export const Example = (args: any) => ( ); + +export const MixedForm = (args: any) => ( +
+ + + + + Soccer + Baseball + Basketball + + + Cat + Dog + Plant + + + +); + +MixedForm.parameters = { + docs: { + disable: true + } +}; + + +export const CustomLabelsExample = (args: any) => { + const [isSortAscending, setIsSortAscending] = useState(true); + return ( +
+
+ Sort order + setIsSortAscending(!isSortAscending)}> + { + isSortAscending ? : + } + + + Name + Created + +
+
+ Filter terms + + keyword 1 + keyword 2 + +
+ +
+ Color settings + + Enable color + + + +
+ +
+ Search + + Enable search + + + + search term 1 + search term 2 + + +
+
+ Search parameters + + Text + Images + Video + + + Summary + Date + Author + +
+ +
+ 28% complete + + 44% confidence + +
+ +
+
Sliders (with and without label)
+ + Help + Help content + + } /> + + Help + Help content + + } /> +
+ + + ); +}; + +CustomLabelsExample.parameters = { + docs: { + disable: true + } +};