Skip to content

Commit 37ebfee

Browse files
authored
add input types for better use (#1598)
1 parent 644df21 commit 37ebfee

File tree

1 file changed

+30
-2
lines changed

1 file changed

+30
-2
lines changed

docs/library/forms/input.md

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,35 @@ def controlled_example():
6868

6969
Behind the scenes, the input component is implemented as a debounced input to avoid sending individual state updates per character to the backend while the user is still typing. This allows a state variable to directly control the `value` prop from the backend without the user experiencing input lag.
7070

71-
### Submitting a form using input
71+
## Input Types
72+
73+
The `type` prop controls how the input is rendered (e.g. plain text, password, file picker).
74+
75+
It accepts the same values as the native HTML `<input type>` attribute, such as:
76+
77+
- `"text"` (default)
78+
- `"password"`
79+
- `"email"`
80+
- `"number"`
81+
- `"file"`
82+
- `"checkbox"`
83+
- `"radio"`
84+
- `"date"`
85+
- `"time"`
86+
- `"url"`
87+
- `"color"`
88+
89+
and several others. See the [MDN reference](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#input_types) for the full list.
90+
91+
```python demo
92+
rx.vstack(
93+
rx.input(placeholder="Username", type="text"),
94+
rx.input(placeholder="Password", type="password"),
95+
rx.input(type="date"),
96+
)
97+
```
98+
99+
## Submitting a form using input
72100

73101
The `name` prop is needed to submit with its owning form as part of a name/value pair.
74102

@@ -118,7 +146,7 @@ def form_input1():
118146

119147
To learn more about how to use forms in the [Form]({library.forms.form.path}) docs.
120148

121-
### Setting a value without using a State var
149+
## Setting a value without using a State var
122150

123151
Set the value of the specified reference element, without needing to link it up to a State var. This is an alternate way to modify the value of the `input`.
124152

0 commit comments

Comments
 (0)