Documentation
¶
Index ¶
- type 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 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 ¶ added in v0.7.1
WithDefaultValue set the default value
func WithDefaultValueStyle ¶ added in v0.8.5
WithDefaultValueStyle set the default value style
func WithDisableOutputResult ¶ added in v0.8.5
func WithDisableOutputResult() Option
WithDisableOutputResult disable output result
func WithEchoNone ¶ added in v0.7.1
func WithEchoNone() Option
WithEchoNone set echoMode use components.EchoNone. displays nothing as characters are entered
func WithEchoPassword ¶ added in v0.7.1
WithEchoPassword set echoMode use components.EchoPassword. if maskedSymbol is not empty, then set EchoCharacter use maskedSymbol[0]
func WithFocusInterval ¶ added in v0.8.5
WithFocusInterval default is theme.DefaultTheme#FocusInterval
func WithFocusIntervalStyle ¶ added in v0.8.5
WithFocusIntervalStyle default is theme.DefaultTheme#FocusIntervalStyle
func WithFocusSymbol ¶ added in v0.8.5
WithFocusSymbol default is theme.DefaultTheme#FocusSymbol
func WithFocusSymbolStyle ¶ added in v0.8.5
WithFocusSymbolStyle default is theme.DefaultTheme#FocusSymbolStyle
func WithKeyMap ¶ added in v0.7.5
func WithKeyMap(keymap components.InputKeyMap) Option
WithKeyMap replace keymap
components.InputDefaultKeyMap
func WithPromptStyle ¶
WithPromptStyle set the prompt style
func WithPure ¶ added in v0.8.6
func WithPure() Option
WithPure do not use any beautification features, any options you customize will be cleared
func WithRequiredMsg ¶ added in v0.7.1
WithRequiredMsg if there is no input, the `msg` will be prompted
components.InputDefaultRequiredMsg
func WithRequiredMsgKeepAliveTime ¶ added in v0.7.1
WithRequiredMsgKeepAliveTime set `requiredMsg` keep alive time.
components.InputDefaultRequiredMsgKeepTime
func WithUnFocusInterval ¶ added in v0.8.5
WithUnFocusInterval default is theme.DefaultTheme#UnFocusInterval
func WithUnFocusIntervalStyle ¶ added in v0.8.5
WithUnFocusIntervalStyle default is theme.DefaultTheme#UnFocusIntervalStyle
func WithUnFocusSymbol ¶ added in v0.8.5
WithUnFocusSymbol default is theme.DefaultTheme#UnFocusSymbol
func WithUnFocusSymbolStyle ¶ added in v0.8.5
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.