Text input component with cursor movement and editing.
Usage: (def my-input (text-input :prompt "Name: "))
;; In update function: (text-input-update my-input msg)
;; In view function: (text-input-view my-input)
Text input component with cursor movement and editing. Usage: (def my-input (text-input :prompt "Name: ")) ;; In update function: (text-input-update my-input msg) ;; In view function: (text-input-view my-input)
(cursor-end input)Move cursor to end of input.
Move cursor to end of input.
(cursor-start input)Move cursor to start of input.
Move cursor to start of input.
(focused? input)Check if input is focused.
Check if input is focused.
(set-value input v)Set the value and move cursor to end.
Set the value and move cursor to end.
(text-input &
{:keys [prompt placeholder value echo-mode echo-char char-limit
width prompt-style text-style placeholder-style cursor-style
focused id]
:or {prompt "> "
value ""
echo-mode :normal
echo-char \*
char-limit 0
width 0
focused true
id (rand-int 1000000)}})Create a text input component.
Options: :prompt - Prompt string (default "> ") :placeholder - Placeholder text when empty :value - Initial value (default "") :echo-mode - :normal, :password, or :none (default :normal) :echo-char - Character for password mode (default *) :char-limit - Maximum characters (0 = unlimited) :width - Display width (0 = unlimited) :prompt-style - Style for prompt :text-style - Style for text :placeholder-style - Style for placeholder :cursor-style - Style for cursor :focused - Start focused (default true) :id - Unique ID
Create a text input component. Options: :prompt - Prompt string (default "> ") :placeholder - Placeholder text when empty :value - Initial value (default "") :echo-mode - :normal, :password, or :none (default :normal) :echo-char - Character for password mode (default \*) :char-limit - Maximum characters (0 = unlimited) :width - Display width (0 = unlimited) :prompt-style - Style for prompt :text-style - Style for text :placeholder-style - Style for placeholder :cursor-style - Style for cursor :focused - Start focused (default true) :id - Unique ID
(text-input-init input)Initialize the text input, returns [input cmd]. Currently just returns the input with no command.
Initialize the text input, returns [input cmd]. Currently just returns the input with no command.
(text-input-update input msg)Update text input state based on a message. Returns [new-input cmd] or [input nil] if message not handled.
Update text input state based on a message. Returns [new-input cmd] or [input nil] if message not handled.
(text-input-view input)Render the text input to a string.
Render the text input to a string.
(value input)Get the current value as a string.
Get the current value as a string.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |