diff --git a/docs/pages/docs/components/prompt.mdx b/docs/pages/docs/components/prompt.mdx index 6fd4247..0da9f36 100644 --- a/docs/pages/docs/components/prompt.mdx +++ b/docs/pages/docs/components/prompt.mdx @@ -11,6 +11,7 @@ import { Property } from '../../../components/Property' ```lua n.prompt({ prefix = " > ", + placeholder = "Enter a command", border_label = { text = "Command", align = "center", @@ -25,31 +26,51 @@ n.prompt({ #### value - #### prefix - +#### placeholder + +> Optional placeholder text to show when the input is empty. +> Can be a string, a single virtual text chunk, or a list of virtual text chunks. + + + +A virtual text chunk is a tuple-like table where the first element +is the text and the second element is the highlight group. + +```lua +local placeholder = { + { "Hello", "Comment" }, + { "World", "String" }, +} +``` + #### on_change - #### on_submit - #### submit_key - diff --git a/docs/pages/docs/components/text-input.mdx b/docs/pages/docs/components/text-input.mdx index 0a6c0c0..cc8111d 100644 --- a/docs/pages/docs/components/text-input.mdx +++ b/docs/pages/docs/components/text-input.mdx @@ -3,14 +3,14 @@ import { Property } from '../../../components/Property' ## TextInput -`TextInput` is a component that allows you to enter any text. +`TextInput` is a component that allows you to enter any text. ![](/gifs/text-input-1.gif) ### Usage Example ```lua -local signal = n.create_signal({ +local signal = n.create_signal({ value = "hello world", }) @@ -20,6 +20,7 @@ n.text_input({ size = 1, value = signal.value, border_label = "Description", + placeholder = "Enter a description", max_lines = 5, on_change = function(value, component) signal.value = value @@ -38,7 +39,7 @@ n.text_input({ ### Properties -#### autoresize +#### autoresize #### value - +#### placeholder + +> Optional placeholder text to show when the input is empty. +> Can be a string, a single virtual text chunk, or a list of virtual text chunks. + + + +A virtual text chunk is a tuple-like table where the first element +is the text and the second element is the highlight group. + +```lua +local placeholder = { + { "Hello", "Comment" }, + { "World", "String" }, +} +``` + #### on_change -