Skip to content

Commit e029356

Browse files
authored
[input][docs] Add value property in the docs (#4130)
1 parent bb9a810 commit e029356

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

docs/reference/generated/input.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44
"props": {
55
"defaultValue": {
66
"type": "string | number | string[]",
7+
"description": "The default value of the input. Use when uncontrolled.",
8+
"detailedType": "string | number | string[] | undefined"
9+
},
10+
"value": {
11+
"type": "string | number | string[]",
12+
"description": "The value of the input. Use when controlled.",
713
"detailedType": "string | number | string[] | undefined"
814
},
915
"onValueChange": {

docs/src/app/(docs)/react/components/page.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ A native input element that automatically works with [Field](/react/components/f
626626
- API reference
627627
- Exports:
628628
- Input
629-
- Props: className, defaultValue, onValueChange, render, style
629+
- Props: className, defaultValue, onValueChange, render, style, value
630630
- Data Attributes: data-dirty, data-disabled, data-filled, data-focused, data-invalid, data-touched, data-valid
631631

632632
</details>

packages/react/src/input/Input.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,14 @@ export interface InputProps extends BaseUIComponentProps<'input', Input.State> {
2121
* Callback fired when the `value` changes. Use when controlled.
2222
*/
2323
onValueChange?: Field.Control.Props['onValueChange'] | undefined;
24+
/**
25+
* The default value of the input. Use when uncontrolled.
26+
*/
2427
defaultValue?: Field.Control.Props['defaultValue'] | undefined;
28+
/**
29+
* The value of the input. Use when controlled.
30+
*/
31+
value?: React.ComponentProps<'input'>['value'] | undefined;
2532
}
2633

2734
export interface InputState extends Field.Control.State {}

0 commit comments

Comments
 (0)