Documentation
¶
Index ¶
- type Option
- func WithBackgroundStyle(style *style.Style) Option
- func WithBlinkSpeed(blinkSpeed time.Duration) Option
- func WithCharLimit(charLimit int) Option
- func WithCursorStyle(style *style.Style) Option
- func WithEchoCharacter(echoCharacter rune) Option
- func WithEchoMode(echoMode components.EchoMode) Option
- func WithPlaceholder(placeholder string) Option
- func WithPlaceholderStyle(style *style.Style) Option
- func WithPrompt(prompt string) Option
- func WithPromptStyle(style *style.Style) Option
- func WithQuitKey(quitKey key.Binding) Option
- func WithTextStyle(style *style.Style) Option
- type Text
- func (i *Text) Apply(ops ...Option) *Text
- func (i *Text) Blink() bool
- func (i *Text) Blur()
- func (i *Text) Cursor() int
- func (i *Text) CursorEnd()
- func (i *Text) CursorMode() components.CursorMode
- func (i *Text) CursorStart()
- func (i *Text) Display() error
- func (i *Text) Focus()
- func (i *Text) Focused() bool
- func (i *Text) Quit()
- func (i *Text) Reset() bool
- func (i *Text) SetCursor(pos int)
- func (i *Text) SetCursorMode(model components.CursorMode)
- func (i *Text) Value() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(i *Text)
func WithBackgroundStyle ¶
WithBackgroundStyle set the background style
func WithBlinkSpeed ¶
WithBlinkSpeed set the blink speed
func WithCharLimit ¶
WithCharLimit is the maximum amount of characters this input element will accept. If 0 or less, there's no limit.
func WithCursorStyle ¶
WithCursorStyle setthe cursor style
func WithEchoCharacter ¶
WithEchoCharacter setthe echo char shape
func WithEchoMode ¶
func WithEchoMode(echoMode components.EchoMode) Option
WithEchoMode sets the input behavior of the text input field.
func WithPlaceholder ¶
WithPlaceholder set the placeholder
func WithPlaceholderStyle ¶
WithPlaceholderStyle set the placeholder style
func WithPromptStyle ¶
WithPromptStyle set the prompt style
func WithQuitKey ¶
WithQuitKey bindQuitKey,default is "enter"
type Text ¶
type Text struct {
// contains filtered or unexported fields
}
func (*Text) Blur ¶
func (i *Text) Blur()
Blur removes the Focus state on the model. When the model is blurred it can not receive keyboard input and the cursor will be hidden.
func (*Text) CursorEnd ¶
func (i *Text) CursorEnd()
CursorEnd moves the cursor to the end of the input field.
func (*Text) CursorMode ¶
func (i *Text) CursorMode() components.CursorMode
CursorMode returns the model's cursor mode. For available cursor modes, see type CursorMode.
func (*Text) CursorStart ¶
func (i *Text) CursorStart()
CursorStart moves the cursor to the start of the input field.
func (*Text) Focus ¶
func (i *Text) Focus()
Focus sets the Focus state on the model. When the model is in Focus it can receive keyboard input and the cursor will be hidden.
func (*Text) Reset ¶
Reset sets the input to its default state with no input. Returns whether or not the cursor blink should reset.
func (*Text) SetCursor ¶
SetCursor moves the cursor to the given position. If the position is out of bounds the cursor will be moved to the start or end accordingly.
func (*Text) SetCursorMode ¶
func (i *Text) SetCursorMode(model components.CursorMode)
SetCursorMode sets the model's cursor mode. This method returns a command.
For available cursor modes, see type CursorMode.