@@ -3,14 +3,14 @@ import { Property } from '../../../components/Property'
33
44## TextInput
55
6- ` TextInput ` is a component that allows you to enter any text.
6+ ` TextInput ` is a component that allows you to enter any text.
77
88![ ] ( /gifs/text-input-1.gif )
99
1010### Usage Example
1111
1212``` lua
13- local signal = n .create_signal ({
13+ local signal = n .create_signal ({
1414 value = " hello world" ,
1515})
1616
@@ -20,6 +20,7 @@ n.text_input({
2020 size = 1 ,
2121 value = signal .value ,
2222 border_label = " Description" ,
23+ placeholder = " Enter a description" ,
2324 max_lines = 5 ,
2425 on_change = function (value , component )
2526 signal .value = value
@@ -38,7 +39,7 @@ n.text_input({
3839
3940### Properties
4041
41- #### autoresize
42+ #### autoresize
4243
4344<Property
4445 defaultValue = " false"
@@ -47,20 +48,40 @@ n.text_input({
4748
4849#### max_lines
4950
50- <Property
51+ <Property
5152 types = { [' number' ]}
5253/>
5354
5455#### value
5556
56- <Property
57+ <Property
5758 defaultValue = ' ""'
5859 types = { [' string' ]}
5960/>
6061
62+ #### placeholder
63+
64+ > Optional placeholder text to show when the input is empty.
65+ > Can be a string, a single virtual text chunk, or a list of virtual text chunks.
66+
67+ <Property
68+ defaultValue = ' nil'
69+ types = { [' string' , ' { [1]: string, [2]: string }[]' , ' nil' ]}
70+ />
71+
72+ A virtual text chunk is a tuple-like table where the first element
73+ is the text and the second element is the highlight group.
74+
75+ ``` lua
76+ local placeholder = {
77+ { " Hello" , " Comment" },
78+ { " World" , " String" },
79+ }
80+ ```
81+
6182#### on_change
6283
63- <Property
84+ <Property
6485 types = { [' fun(value: string, component: TextInput): nil' ]}
6586/>
6687
0 commit comments