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 WithDefaultValue(s string) Option
- func WithDefaultValueStyle(style *style.Style) Option
- func WithDisableOutputResult() Option
- func WithEchoNone() Option
- func WithEchoPassword(maskedSymbol ...rune) Option
- func WithFocusInterval(s string) Option
- func WithFocusIntervalStyle(s *style.Style) Option
- func WithFocusSymbol(s string) Option
- func WithFocusSymbolStyle(s *style.Style) Option
- func WithKeyMap(keymap components.InputKeyMap) Option
- func WithPrompt(prompt string) Option
- func WithPromptStyle(style *style.Style) Option
- func WithPure() Option
- func WithRequired() Option
- func WithRequiredMsg(msg string) Option
- func WithRequiredMsgKeepAliveTime(keepaliveTime time.Duration) Option
- func WithTextStyle(style *style.Style) Option
- func WithUnFocusInterval(s string) Option
- func WithUnFocusIntervalStyle(s *style.Style) Option
- func WithUnFocusSymbol(s string) Option
- func WithUnFocusSymbolStyle(s *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() (string, error)
- func (i *Text) Focus()
- func (i *Text) Focused() bool
- func (i *Text) Reset()
- 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 set the cursor style
func WithDefaultValue ¶
WithDefaultValue set the default value
func WithDefaultValueStyle ¶
WithDefaultValueStyle set the default value style
func WithDisableOutputResult ¶
func WithDisableOutputResult() Option
WithDisableOutputResult disable output result
func WithEchoNone ¶
func WithEchoNone() Option
WithEchoNone set echoMode use components.EchoNone. displays nothing as characters are entered
func WithEchoPassword ¶
WithEchoPassword set echoMode use components.EchoPassword. if maskedSymbol is not empty, then set EchoCharacter use maskedSymbol[0]
func WithFocusInterval ¶
WithFocusInterval default is theme.DefaultTheme#FocusInterval
func WithFocusIntervalStyle ¶
WithFocusIntervalStyle default is theme.DefaultTheme#FocusIntervalStyle
func WithFocusSymbol ¶
WithFocusSymbol default is theme.DefaultTheme#FocusSymbol
func WithFocusSymbolStyle ¶
WithFocusSymbolStyle default is theme.DefaultTheme#FocusSymbolStyle
func WithKeyMap ¶
func WithKeyMap(keymap components.InputKeyMap) Option
WithKeyMap replace keymap
components.InputDefaultKeyMap
func WithPromptStyle ¶
WithPromptStyle set the prompt style
func WithPure ¶
func WithPure() Option
WithPure do not use any beautification features, any options you customize will be cleared
func WithRequiredMsg ¶
WithRequiredMsg if there is no input, the `msg` will be prompted
components.InputDefaultRequiredMsg
func WithRequiredMsgKeepAliveTime ¶
WithRequiredMsgKeepAliveTime set `requiredMsg` keep alive time.
components.InputDefaultRequiredMsgKeepTime
func WithUnFocusInterval ¶
WithUnFocusInterval default is theme.DefaultTheme#UnFocusInterval
func WithUnFocusIntervalStyle ¶
WithUnFocusIntervalStyle default is theme.DefaultTheme#UnFocusIntervalStyle
func WithUnFocusSymbol ¶
WithUnFocusSymbol default is theme.DefaultTheme#UnFocusSymbol
func WithUnFocusSymbolStyle ¶
WithUnFocusSymbolStyle default is theme.DefaultTheme#UnFocusIntervalStyle
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 ¶
func (i *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.