Documentation
¶
Overview ¶
Package filepicker provides a file picker component for Bubble Tea applications.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type KeyMap ¶
type KeyMap struct {
GoToTop key.Binding
GoToLast key.Binding
Down key.Binding
Up key.Binding
PageUp key.Binding
PageDown key.Binding
Back key.Binding
Open key.Binding
Select key.Binding
}
KeyMap defines key bindings for each user action.
type Model ¶
type Model struct {
// Path is the path which the user has selected with the file picker.
Path string
// CurrentDirectory is the directory that the user is currently in.
CurrentDirectory string
// AllowedTypes specifies which file types the user may select.
// If empty the user may select any file.
AllowedTypes []string
KeyMap KeyMap
ShowPermissions bool
ShowSize bool
ShowHidden bool
DirAllowed bool
FileAllowed bool
FileSelected string
// Height of the picker.
//
// Deprecated: use [Model.SetHeight] instead.
Height int
AutoHeight bool
Cursor string
Styles Styles
// contains filtered or unexported fields
}
Model represents a file picker.
func New ¶
func New() Model
New returns a new filepicker model with default styling and key bindings.
func (Model) DidSelectDisabledFile ¶
DidSelectDisabledFile returns whether a user tried to select a disabled file (on this msg). This is necessary only if you would like to warn the user that they tried to select a disabled file.
func (Model) DidSelectFile ¶
DidSelectFile returns whether a user has selected a file (on this msg).
type Styles ¶
type Styles struct {
DisabledCursor lipgloss.Style
Cursor lipgloss.Style
Symlink lipgloss.Style
Directory lipgloss.Style
File lipgloss.Style
DisabledFile lipgloss.Style
Permission lipgloss.Style
Selected lipgloss.Style
DisabledSelected lipgloss.Style
FileSize lipgloss.Style
EmptyDirectory lipgloss.Style
}
Styles defines the possible customizations for styles in the file picker.
func DefaultStyles ¶
func DefaultStyles() Styles
DefaultStyles defines the default styling for the file picker.
func DefaultStylesWithRenderer ¶ added in v0.16.1
DefaultStylesWithRenderer defines the default styling for the file picker, with a given Lip Gloss renderer.