Skip to content
pixi-silk
GitHub repository
Interface

TextEditorOptions

import type { TextEditorOptions } from 'pixi-silk/ui/textedit';

Options of a TextEditor: the text style plus how it edits.

Extends#

Properties#

PropertyTypeDescriptionOverridesInherited fromDefined in
aaWidth?numberWidth of the anti-aliasing ramp in device pixels. Larger is softer. Default 1.-SilkTextOptions.aaWidthtext/SilkText.ts:94
align?TextAlignAlignment of the lines. Default left.-SilkTextOptions.aligntext/SilkText.ts:76
anchor?number | PointDataPoint of the text box at the position: 0 is the top left, 1 the bottom right. Default 0.-SilkTextOptions.anchortext/SilkText.ts:102
ariaLabel?stringName of the field for screen readers. Default the placeholder.--ui/textedit.ts:96
atlas?SdfAtlasAtlas to bake glyphs into. Default SdfAtlas.shared.-SilkTextOptions.atlastext/SilkText.ts:104
breakWords?booleanBreaks words that are wider than a line on their own. Default false.-SilkTextOptions.breakWordstext/SilkText.ts:82
caretWidth?numberCaret width in screen pixels, whatever the zoom. Default 1.5.--ui/textedit.ts:102
dilate?numberGrows (positive) or thins (negative) the glyphs, in local units. Default 0.-SilkTextOptions.dilatetext/SilkText.ts:92
element?HTMLElementThe element the scene is drawn on, usually app.canvas. Positions the hidden text field at the caret, so input method popups open next to it. Default the element of the first press.--ui/textedit.ts:94
enter?"blur" | "newline" | "commit"What Enter does: insert a newline, commit (emits submit and change, keeps focus) or blur. Default newline for multi-line editors, commit for single-line ones. Shift + Enter always inserts a newline in multi-line editors, and cmd or ctrl + Enter commits and blurs.--ui/textedit.ts:76
fill?ColorSource | GradientA colour, or a pixi-silk gradient over the text box (linear, radial and conic). Default white.-SilkTextOptions.filltext/SilkText.ts:70
fontFamily?stringCSS font family list. Default system-ui, -apple-system, Segoe UI, Roboto, sans-serif.-SilkTextOptions.fontFamilytext/SilkText.ts:62
fontSize?numberFont size in local units. Default 16.-SilkTextOptions.fontSizetext/SilkText.ts:64
fontStyle?"normal" | "italic" | "oblique"normal, italic or oblique. Default normal.-SilkTextOptions.fontStyletext/SilkText.ts:68
fontWeight?string | numberCSS font weight. Default 400.-SilkTextOptions.fontWeighttext/SilkText.ts:66
handles?booleanDraggable handles at the ends of a selection made by touch. Default true.--ui/textedit.ts:98
history?HistoryLike & { redo?: unknown; undo?: unknown; }Where edits go for undo. Default a built-in History for this editor. Pass the app’s history to put text edits in line with its other steps. When it has undo() and redo(), cmd or ctrl + Z calls them while the editor has focus.--ui/textedit.ts:84
kerning?booleanApplies the font’s kerning (measured from Canvas). Default true.-SilkTextOptions.kerningtext/SilkText.ts:86
letterSpacing?numberExtra space after each character, in local units. Default 0.-SilkTextOptions.letterSpacingtext/SilkText.ts:72
lineHeight?numberDistance between baselines. 0 uses the font’s ascent plus descent, like PixiJS Text. Default 0.-SilkTextOptions.lineHeighttext/SilkText.ts:74
maxLength?numberLongest text allowed, in UTF-16 code units like maxlength. Default no limit.--ui/textedit.ts:66
multiline?booleanSeveral lines (a text area) or one (an input). Default true.--ui/textedit.ts:57
outline?TextOutline | nullA line around the glyphs. null for none. Default null.-SilkTextOptions.outlinetext/SilkText.ts:88
placeholder?stringText shown while the editor is empty.--ui/textedit.ts:64
readOnly?booleanClickable, selectable and copyable, but not editable. Default false.--ui/textedit.ts:68
selectable?booleanFalse leaves pointer input alone: no caret, no selection. Default true.--ui/textedit.ts:70
shadow?TextShadow | nullA drop shadow or glow under the glyphs. null for none. Default null.-SilkTextOptions.shadowtext/SilkText.ts:90
tab?"insert" | "next"What Tab does: insert a tab character, or next (emits tab and blurs). Default next.--ui/textedit.ts:78
tabularNumbers?booleanGives the digits one width, like font-variant-numeric: tabular-nums, for readouts. Default false.-SilkTextOptions.tabularNumberstext/SilkText.ts:84
text?stringStarting text. Default empty.SilkTextOptions.text-ui/textedit.ts:55
theme?Partial<TextEditorTheme>Values that replace parts of TEXT_EDITOR_THEME.--ui/textedit.ts:100
ticker?Ticker | nullTicker driving the caret blink. Default Ticker.shared. null for manual TextEditor.tick.--ui/textedit.ts:104
width?numberFixed width in local units. A multi-line editor wraps at it. A single-line one clips its text and scrolls it to keep the caret in view. Default none: the box grows with the text.--ui/textedit.ts:62