@@ -17,7 +17,7 @@ export const description = 'Displays a non-editable value with a label';
1717 component = { LabeledValue }
1818 docs = { types .exports .LabeledValueProps }
1919 links = { types .links }
20- props = { [' label' , ' size' , ' labelPosition' , ' labelAlign ' , ' contextualHelp' ]}
20+ props = { [' label' , ' size' , ' labelPosition' , ' contextualHelp' ]}
2121 initialProps = { {
2222 label: ' File name' ,
2323 value: ' Budget.pdf'
@@ -133,6 +133,72 @@ import {Link} from '@react-spectrum/s2/Link';
133133<LabeledValue label = " Website" value = { <Link href = " https://www.adobe.com/" >Adobe.com</Link >} />
134134```
135135
136+ ## Form
137+
138+ Use ` LabeledValue ` within a ` Form ` to display non-editable information alongside editable fields.
139+
140+ ``` tsx render docs={docs.exports.Form} links={docs.links} props={['size', 'labelAlign', 'necessityIndicator', 'isRequired', 'isDisabled']} type="s2"
141+ " use client" ;
142+ import {Button } from ' @react-spectrum/s2/Button' ;
143+ import {ComboBox , ComboBoxItem } from ' @react-spectrum/s2/ComboBox' ;
144+ import {Form } from ' @react-spectrum/s2/Form' ;
145+ import {LabeledValue } from ' @react-spectrum/s2/LabeledValue' ;
146+ import {NumberField } from ' @react-spectrum/s2/NumberField' ;
147+ import {style } from ' @react-spectrum/s2/style' with {type: ' macro' };
148+
149+ < Form /* PROPS */ >
150+ <div
151+ role = " group"
152+ className = { style ({display: ' flex' , alignItems: ' center' , gap: 48 })} >
153+ <ComboBox label = " Duration type" styles = { style ({width: 120 })} >
154+ <ComboBoxItem >Simple</ComboBoxItem >
155+ <ComboBoxItem >Calculated assignment</ComboBoxItem >
156+ <ComboBoxItem >Calculated work</ComboBoxItem >
157+ <ComboBoxItem >Effort driven</ComboBoxItem >
158+ </ComboBox >
159+ <NumberField
160+ label = " Duration days"
161+ placeholder = " # of days"
162+ defaultValue = { 1 }
163+ styles = { style ({width: 120 })} />
164+ </div >
165+ <div
166+ role = " group"
167+ aria-labelledby = " working hours"
168+ className = { style ({display: ' flex' , alignItems: ' center' , gap: 48 , font: ' ui' })} >
169+ <NumberField
170+ label = " Planned hours"
171+ placeholder = " –"
172+ defaultValue = { 1 }
173+ styles = { style ({width: 120 })} />
174+ { /* - begin highlight -*/ }
175+ <LabeledValue
176+ label = " Actual hours"
177+ value = { 0 }
178+ styles = { style ({width: 120 })} />
179+ { /* - end highlight -*/ }
180+ </div >
181+ <div
182+ role = " group"
183+ aria-labelledby = " working hours"
184+ className = { style ({display: ' flex' , alignItems: ' center' , gap: 48 , font: ' ui' })} >
185+ <LabeledValue
186+ label = " Project duration"
187+ value = { 1 }
188+ styles = { style ({width: 120 })} />
189+ <LabeledValue
190+ label = " Actual duration"
191+ value = { 0 }
192+ styles = { style ({width: 120 })} />
193+ </div >
194+ <Button
195+ type = " submit"
196+ variant = " primary" >
197+ Submit
198+ </Button >
199+ < / Form >
200+ ```
201+
136202
137203## API
138204
0 commit comments