| TextArea | R Documentation |
A multi-line text editor. See text_area().
Widget -> TextArea
focusableText areas can be focused.
placeholderText shown while the area is empty.
line_numbersShow a line number gutter?
wrapWrap long lines (TRUE) or scroll horizontally?
read_onlyBlock editing (cursor, selection, copy and search still work)?
languageOptional language name passed to the configured highlighter.
tab_sizeSpaces inserted by Tab (and used for tabs in loaded text).
tab_behavior"focus": Tab moves focus (default, safe in
forms); "indent": Tab inserts spaces and Shift+Tab removes them.
auto_indentCopy the indentation of the current line on Enter?
highlighterOptional function (lines, state) returning a list
of per-line data frames with 1-based inclusive start, end, token.
validateNULL or function(value) returning NULL (valid)
or an error message.
valueThe text. Assigning replaces it (see set_text()).
textThe text (read-only alias of value).
linesThe lines as a character vector.
n_linesNumber of lines.
cursor_row, cursor_columnCursor position, 1-based (column 1 is before the first character).
selectionThe selected text ("" if none).
can_undo, can_redoIs there something to undo / redo?
history_sizeCharacters held by the undo history.
match_countNumber of matches of the current search.
find_openIs the find bar open?
validDoes the value pass validate?
errorThe validation message, or NULL.
Widget$add_class()Widget$ancestors()Widget$animate()Widget$arrange_children()Widget$bind()Widget$bind_reactive()Widget$bindings()Widget$blur()Widget$capture_mouse()Widget$child_clip()Widget$clear()Widget$computed_style()Widget$focus()Widget$format()Widget$get_state()Widget$has_class()Widget$invalidate()Widget$invalidate_paint()Widget$is_displayed()Widget$is_enabled()Widget$layout_descend()Widget$layout_differs()Widget$matches()Widget$mount()Widget$on()Widget$post_message()Widget$print()Widget$query()Widget$query_one()Widget$refresh()Widget$release_mouse()Widget$remove()Widget$remove_children()Widget$remove_class()Widget$render()Widget$render_lines()Widget$run_action()Widget$run_process()Widget$run_worker()Widget$set()Widget$set_interval()Widget$set_state()Widget$set_timeout()Widget$toggle_class()Widget$walk()TextArea$new()Create a text area.
TextArea$new( value = "", placeholder = "", id = NULL, classes = NULL, style = NULL, disabled = FALSE, line_numbers = FALSE, wrap = TRUE, read_only = FALSE, language = NULL, tab_size = 4L, tab_behavior = "focus", auto_indent = FALSE, validate = NULL, max_history = 200L, highlighter = NULL )
valueInitial text.
placeholderPlaceholder text.
id, classes, style, disabledSee Widget.
line_numbers, wrap, read_only, language, tab_size, tab_behavior, auto_indentSee the fields.
validateValidation function.
max_historyMaximum number of undo steps.
highlighterOptional function (lines, state) returning a list
of per-line data frames with 1-based inclusive start, end, token.
TextArea$default_style()The built-in style.
TextArea$default_style()
TextArea$pseudo_states()Active states: focus, hover, disabled and invalid.
TextArea$pseudo_states()
TextArea$default_bindings()Editing key bindings.
TextArea$default_bindings()
TextArea$on_key()Printable keys replace the selection or are inserted at the cursor; Ctrl+C / Ctrl+X copy / cut a selection. While the find bar is open, keys edit the search text.
TextArea$on_key(event)
eventA KeyEvent.
TextArea$on_paste()Pasted text is inserted as one undo step; line breaks are kept.
TextArea$on_paste(event)
eventA PasteEvent.
TextArea$on_mouse_down()Click to place the cursor, shift+click and drag to select.
TextArea$on_mouse_down(event)
eventA MouseEvent.
TextArea$on_mouse_move()Dragging with the left button extends the selection.
TextArea$on_mouse_move(event)
eventA MouseEvent.
TextArea$on_mouse_up()Ends a drag selection.
TextArea$on_mouse_up(event)
eventA MouseEvent.
TextArea$on_mouse_scroll()The mouse wheel scrolls three rows.
TextArea$on_mouse_scroll(event)
eventA MouseEvent.
TextArea$set_text()Replace the whole text. Clears the undo history and moves the cursor to the start.
TextArea$set_text(text)
textA string (or character vector of lines).
TextArea$insert()Insert text at the cursor, replacing the selection.
TextArea$insert(text, kind = NULL)
textA string; line breaks are kept.
kindInternal: "type" merges into undo groups, "paste"
does not.
TextArea$select_range()Select a range (1-based rows and columns; column 1 is before the first character).
TextArea$select_range(start_row, start_column, end_row, end_column)
start_row, start_column, end_row, end_columnThe range.
TextArea$goto_line()Move the cursor to a line.
TextArea$goto_line(row, column = 1L)
rowLine number (1-based).
columnColumn (1-based).
TextArea$cursor_position()Cursor position. Columns count grapheme clusters and terminal display cells, both 1-based.
TextArea$cursor_position()
TextArea$copy()Copy the selection to the app clipboard (and the system
clipboard via OSC 52 when system = TRUE and supported).
TextArea$copy(system = TRUE)
systemAlso write to the system clipboard?
TextArea$cut()Copy the selection and delete it.
TextArea$cut(system = TRUE)
systemAlso write to the system clipboard?
TextArea$undo()Undo the last edit group.
TextArea$undo()
TextArea$redo()Redo the last undone edit.
TextArea$redo()
TextArea$find()Search for text and select the first match at or after the cursor.
TextArea$find(query, case_sensitive = FALSE, regex = FALSE)
queryText or regular expression (PCRE).
case_sensitiveMatch case?
regexIs query a regular expression? Invalid expressions
raise an error.
TRUE if there is a match (invisibly).
TextArea$find_next()Select the next match (wrapping around).
TextArea$find_next()
TextArea$find_previous()Select the previous match (wrapping around).
TextArea$find_previous()
TextArea$replace()Replace the current search match, or find query and
replace its next match.
TextArea$replace( replacement, query = NULL, case_sensitive = FALSE, regex = FALSE )
replacementReplacement text.
queryOptional search text; defaults to the active search.
case_sensitive, regexSearch options used when query is given.
TextArea$replace_all()Replace all matches in one document edit. If the edit is larger than the bounded undo budget, it is applied without retaining an undo record.
TextArea$replace_all(query, replacement, case_sensitive = FALSE, regex = FALSE)
querySearch text or regular expression.
replacementReplacement text.
case_sensitiveMatch case?
regexInterpret query as a regular expression?
TextArea$clear_find()Remove the search highlights and close the find bar.
TextArea$clear_find()
TextArea$action_cursor_left()Move one character left.
TextArea$action_cursor_left()
TextArea$action_cursor_right()Move one character right.
TextArea$action_cursor_right()
TextArea$action_cursor_up()Move one row up.
TextArea$action_cursor_up()
TextArea$action_cursor_down()Move one row down.
TextArea$action_cursor_down()
TextArea$action_line_start()Move to the start of the line.
TextArea$action_line_start()
TextArea$action_line_end()Move to the end of the line.
TextArea$action_line_end()
TextArea$action_document_start()Move to the start of the text.
TextArea$action_document_start()
TextArea$action_document_end()Move to the end of the text.
TextArea$action_document_end()
TextArea$action_word_left()Move to the previous word.
TextArea$action_word_left()
TextArea$action_word_right()Move to the next word.
TextArea$action_word_right()
TextArea$action_page_up()Move one page up.
TextArea$action_page_up()
TextArea$action_page_down()Move one page down.
TextArea$action_page_down()
TextArea$action_select_left()Extend the selection left.
TextArea$action_select_left()
TextArea$action_select_right()Extend the selection right.
TextArea$action_select_right()
TextArea$action_select_up()Extend the selection up.
TextArea$action_select_up()
TextArea$action_select_down()Extend the selection down.
TextArea$action_select_down()
TextArea$action_select_line_start()Select to the start of the line.
TextArea$action_select_line_start()
TextArea$action_select_line_end()Select to the end of the line.
TextArea$action_select_line_end()
TextArea$action_select_document_start()Select to the start of the text.
TextArea$action_select_document_start()
TextArea$action_select_document_end()Select to the end of the text.
TextArea$action_select_document_end()
TextArea$action_select_word_left()Select to the previous word.
TextArea$action_select_word_left()
TextArea$action_select_word_right()Select to the next word.
TextArea$action_select_word_right()
TextArea$action_select_page_up()Extend the selection one page up.
TextArea$action_select_page_up()
TextArea$action_select_page_down()Extend the selection one page down.
TextArea$action_select_page_down()
TextArea$action_select_all()Select everything.
TextArea$action_select_all()
TextArea$action_newline()Insert a line break (keeping the indentation when
auto_indent is on).
TextArea$action_newline()
TextArea$action_delete_left()Delete the selection or the character before the cursor.
TextArea$action_delete_left()
TextArea$action_delete_right()Delete the selection or the character at the cursor.
TextArea$action_delete_right()
TextArea$action_delete_word_left()Delete the word before the cursor.
TextArea$action_delete_word_left()
TextArea$action_delete_word_right()Delete the word after the cursor.
TextArea$action_delete_word_right()
TextArea$action_delete_to_line_start()Delete from the start of the line to the cursor.
TextArea$action_delete_to_line_start()
TextArea$action_delete_to_line_end()Delete from the cursor to the end of the line (or the line break when the cursor is at the end).
TextArea$action_delete_to_line_end()
TextArea$action_paste()Insert the app clipboard.
TextArea$action_paste()
TextArea$action_indent()Insert spaces up to the next tab stop (or indent the selected lines).
TextArea$action_indent()
TextArea$action_dedent()Remove up to one tab stop of leading spaces.
TextArea$action_dedent()
TextArea$action_undo()Undo.
TextArea$action_undo()
TextArea$action_redo()Redo.
TextArea$action_redo()
TextArea$action_open_find()Open the find bar (Ctrl+F).
TextArea$action_open_find()
TextArea$action_find_next()Select the next match (F3).
TextArea$action_find_next()
TextArea$action_find_previous()Select the previous match (Shift+F3).
TextArea$action_find_previous()
TextArea$action_open_replace()Open the find and replace bar (Ctrl+H).
TextArea$action_open_replace()
TextArea$action_open_goto()Open the go-to-line bar (Ctrl+G).
TextArea$action_open_goto()
TextArea$content_width()Natural width: the longest line (at most 120 columns).
TextArea$content_width()
TextArea$content_height()Natural height: the number of lines (at most 1000).
TextArea$content_height(width)
widthContent width.
TextArea$paint()Draw the visible part of the text.
TextArea$paint(buffer, area, st)
bufferA ScreenBuffer.
areaVisible part of the region.
stComputed style.
TextArea$clone()The objects of this class are cloneable with this method.
TextArea$clone(deep = FALSE)
deepWhether to make a deep clone.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.