Documentation
¶
Overview ¶
Package widgets provides reusable widgets for terminal UIs.
Index ¶
- Constants
- func DrawGauge(buf *runtime.Buffer, x, y, width int, ratio float64, style GaugeStyle)
- func DrawGaugeString(width int, ratio float64, style GaugeStyle) string
- func FlexExpanded(w runtime.Widget) runtime.FlexChild
- func FlexFixed(w runtime.Widget) runtime.FlexChild
- func FlexFixedSpace(size int) runtime.FlexChild
- func FlexFlexible(w runtime.Widget, grow float64) runtime.FlexChild
- func FlexSized(w runtime.Widget, basis int) runtime.FlexChild
- func FlexSpace() runtime.FlexChild
- func HBox(children ...runtime.FlexChild) *runtime.Flex
- func MustRegisterWidgetPlugin(plugin WidgetPlugin)
- func RegisterWidgetPlugin(plugin WidgetPlugin) error
- func VBox(children ...runtime.FlexChild) *runtime.Flex
- type Accordion
- func (a *Accordion) AddSection(section *AccordionSection)
- func (a *Accordion) Bind(services runtime.Services)
- func (a *Accordion) ChildWidgets() []runtime.Widget
- func (a *Accordion) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (a *Accordion) Layout(bounds runtime.Rect)
- func (a *Accordion) Measure(constraints runtime.Constraints) runtime.Size
- func (a *Accordion) PathSegment(child runtime.Widget) string
- func (a *Accordion) Render(ctx runtime.RenderContext)
- func (a *Accordion) SetAllowMultiple(allow bool)
- func (a *Accordion) SetLabel(label string)
- func (a *Accordion) SetSections(sections ...*AccordionSection)
- func (a *Accordion) SetSelected(index int)
- func (a *Accordion) SetStyles(base, header, selected, disabled backend.Style)
- func (a *Accordion) StyleType() string
- func (a *Accordion) ToggleSection(index int)
- func (a *Accordion) Unbind()
- type AccordionOption
- type AccordionSection
- func (s *AccordionSection) Content() runtime.Widget
- func (s *AccordionSection) Disabled() bool
- func (s *AccordionSection) Expanded() bool
- func (s *AccordionSection) SetContent(content runtime.Widget)
- func (s *AccordionSection) SetDisabled(disabled bool)
- func (s *AccordionSection) SetExpanded(expanded bool)
- func (s *AccordionSection) SetTitle(title string)
- func (s *AccordionSection) Title() string
- type AccordionSectionOption
- type Alert
- func (a *Alert) Bind(services runtime.Services)
- func (a *Alert) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (a *Alert) Measure(constraints runtime.Constraints) runtime.Size
- func (a *Alert) Render(ctx runtime.RenderContext)
- func (a *Alert) SetStyle(style backend.Style)
- func (a *Alert) StyleClasses() []string
- func (a *Alert) StyleType() string
- func (a *Alert) Unbind()
- type AlertVariant
- type Alignment
- type AnimatedGauge
- type AnimatedWidget
- func (w *AnimatedWidget) Animate(property string, endValue animation.Animatable, cfg animation.TweenConfig)
- func (w *AnimatedWidget) FadeIn(duration time.Duration)
- func (w *AnimatedWidget) FadeOut(duration time.Duration, onComplete func())
- func (w *AnimatedWidget) SlideIn(from SlideDirection, distance int, duration time.Duration)
- type AspectRatio
- func (a *AspectRatio) Bind(services runtime.Services)
- func (a *AspectRatio) ChildWidgets() []runtime.Widget
- func (a *AspectRatio) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (a *AspectRatio) Layout(bounds runtime.Rect)
- func (a *AspectRatio) Measure(constraints runtime.Constraints) runtime.Size
- func (a *AspectRatio) Render(ctx runtime.RenderContext)
- func (a *AspectRatio) SetLabel(label string)
- func (a *AspectRatio) SetRatio(ratio float64)
- func (a *AspectRatio) Unbind()
- type AsyncImage
- type AsyncImageOption
- func WithAsyncImageBlitter(blitter graphics.Blitter) AsyncImageOption
- func WithAsyncImageCenter(enabled bool) AsyncImageOption
- func WithAsyncImagePlaceholder(widget runtime.Widget) AsyncImageOption
- func WithAsyncImageScaleMode(mode graphics.ScaleMode) AsyncImageOption
- func WithAsyncImageScaleToFit(enabled bool) AsyncImageOption
- type AutoComplete
- func (a *AutoComplete) Bind(services runtime.Services)
- func (a *AutoComplete) Blur()
- func (a *AutoComplete) ChildWidgets() []runtime.Widget
- func (a *AutoComplete) Focus()
- func (a *AutoComplete) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (a *AutoComplete) Input() *Input
- func (a *AutoComplete) Layout(bounds runtime.Rect)
- func (a *AutoComplete) Measure(constraints runtime.Constraints) runtime.Size
- func (a *AutoComplete) Query() string
- func (a *AutoComplete) Render(ctx runtime.RenderContext)
- func (a *AutoComplete) SetLabel(label string)
- func (a *AutoComplete) SetMaxSuggestions(limit int)
- func (a *AutoComplete) SetOnSelect(fn func(value string))
- func (a *AutoComplete) SetOptions(options []string)
- func (a *AutoComplete) SetProvider(fn func(query string) []string)
- func (a *AutoComplete) SetQuery(query string)
- func (a *AutoComplete) StyleType() string
- func (a *AutoComplete) Unbind()
- type Avatar
- func (a *Avatar) Bind(services runtime.Services)
- func (a *Avatar) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (a *Avatar) Initials() string
- func (a *Avatar) Layout(bounds runtime.Rect)
- func (a *Avatar) Measure(constraints runtime.Constraints) runtime.Size
- func (a *Avatar) Name() string
- func (a *Avatar) Render(ctx runtime.RenderContext)
- func (a *Avatar) SetStyle(style backend.Style)
- func (a *Avatar) Size() AvatarSize
- func (a *Avatar) StyleType() string
- func (a *Avatar) Unbind()
- type AvatarOption
- type AvatarSize
- type Axis
- type Badge
- func (b *Badge) Bind(services runtime.Services)
- func (b *Badge) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (b *Badge) Layout(bounds runtime.Rect)
- func (b *Badge) Measure(constraints runtime.Constraints) runtime.Size
- func (b *Badge) Render(ctx runtime.RenderContext)
- func (b *Badge) SetStyle(style backend.Style)
- func (b *Badge) SetText(text string)
- func (b *Badge) StyleType() string
- func (b *Badge) Text() string
- func (b *Badge) Unbind()
- type BarChart
- func (b *BarChart) Bind(services runtime.Services)
- func (b *BarChart) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (b *BarChart) Measure(constraints runtime.Constraints) runtime.Size
- func (b *BarChart) Render(ctx runtime.RenderContext)
- func (b *BarChart) StyleType() string
- func (b *BarChart) Unbind()
- type BarData
- type Base
- func (b *Base) AddClass(class string)
- func (b *Base) AddClasses(classes ...string)
- func (b *Base) ApplyStyle(s style.Style)
- func (b *Base) Bind(services runtime.Services)
- func (b *Base) Blur()
- func (b *Base) Bounds() runtime.Rect
- func (b *Base) CanFocus() bool
- func (b *Base) ClearInvalidation()
- func (b *Base) ContentBounds() runtime.Rect
- func (b *Base) Focus()
- func (b *Base) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (b *Base) ID() string
- func (b *Base) Invalidate()
- func (b *Base) IsActive() bool
- func (b *Base) IsFocused() bool
- func (b *Base) IsHovered() bool
- func (b *Base) Key() string
- func (b *Base) Layout(bounds runtime.Rect)
- func (b *Base) LayoutStyle() style.Style
- func (b *Base) NeedsRender() bool
- func (b *Base) OnMount(fn func())
- func (b *Base) OnMountHook()
- func (b *Base) OnUnmount(fn func())
- func (b *Base) OnUnmountHook()
- func (b *Base) SetActive(active bool)
- func (b *Base) SetClasses(classes ...string)
- func (b *Base) SetHovered(hovered bool)
- func (b *Base) SetID(id string)
- func (b *Base) SetKey(key string)
- func (b *Base) StyleClasses() []string
- func (b *Base) StyleID() string
- func (b *Base) StyleState() style.WidgetState
- func (b *Base) Unbind()
- type Box
- func (b *Box) Bind(services runtime.Services)
- func (b *Box) ChildWidgets() []runtime.Widget
- func (b *Box) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (b *Box) Layout(bounds runtime.Rect)
- func (b *Box) Measure(constraints runtime.Constraints) runtime.Size
- func (b *Box) Render(ctx runtime.RenderContext)
- func (b *Box) SetStyle(style backend.Style)
- func (b *Box) StyleType() string
- func (b *Box) Unbind()
- func (b *Box) WithStyle(style backend.Style) *Boxdeprecated
- type BoxOption
- type Breadcrumb
- func (b *Breadcrumb) Bind(services runtime.Services)
- func (b *Breadcrumb) CollapseKeep() int
- func (b *Breadcrumb) CollapseThreshold() int
- func (b *Breadcrumb) Collapsible() bool
- func (b *Breadcrumb) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (b *Breadcrumb) Measure(constraints runtime.Constraints) runtime.Size
- func (b *Breadcrumb) OnNavigate(fn func(index int))deprecated
- func (b *Breadcrumb) Render(ctx runtime.RenderContext)
- func (b *Breadcrumb) Selected() int
- func (b *Breadcrumb) SetCollapseKeep(n int)
- func (b *Breadcrumb) SetCollapseThreshold(n int)
- func (b *Breadcrumb) SetCollapsible(enabled bool)
- func (b *Breadcrumb) SetOnNavigate(fn func(index int))
- func (b *Breadcrumb) SetSeparator(sep string)
- func (b *Breadcrumb) StyleType() string
- func (b *Breadcrumb) Unbind()
- type BreadcrumbItem
- type Button
- func (b *Button) Bind(services runtime.Services)
- func (b *Button) Class(class string) *Buttondeprecated
- func (b *Button) Classes(classes ...string) *Buttondeprecated
- func (b *Button) Danger() *Buttondeprecated
- func (b *Button) Disabled(disabled *state.Signal[bool]) *Buttondeprecated
- func (b *Button) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (b *Button) Loading(loading *state.Signal[bool]) *Buttondeprecated
- func (b *Button) Measure(constraints runtime.Constraints) runtime.Size
- func (b *Button) OnClick(fn func()) *Buttondeprecated
- func (b *Button) Primary() *Buttondeprecated
- func (b *Button) Render(ctx runtime.RenderContext)
- func (b *Button) Secondary() *Buttondeprecated
- func (b *Button) SetDisabledStyle(style backend.Style)
- func (b *Button) SetFocusStyle(style backend.Style)
- func (b *Button) SetLabel(label string)
- func (b *Button) SetOnClick(fn func())
- func (b *Button) SetStyle(style backend.Style)
- func (b *Button) SetVariant(variant Variant)
- func (b *Button) StyleClasses() []string
- func (b *Button) StyleType() string
- func (b *Button) Unbind()
- type ButtonOption
- type Calendar
- func (c *Calendar) Bind(services runtime.Services)
- func (c *Calendar) DisplayedMonth() time.Time
- func (c *Calendar) DisplayedMonthSignal() *state.Signal[time.Time]
- func (c *Calendar) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (c *Calendar) Measure(constraints runtime.Constraints) runtime.Size
- func (c *Calendar) OnRangeSelect(fn func(start, end time.Time))deprecated
- func (c *Calendar) OnSelect(fn func(time.Time))deprecated
- func (c *Calendar) RangeEnd() *time.Time
- func (c *Calendar) RangeEndSignal() *state.Signal[*time.Time]
- func (c *Calendar) RangeStart() *time.Time
- func (c *Calendar) RangeStartSignal() *state.Signal[*time.Time]
- func (c *Calendar) Render(ctx runtime.RenderContext)
- func (c *Calendar) SelectedDate() time.Time
- func (c *Calendar) SelectedDateSignal() *state.Signal[time.Time]
- func (c *Calendar) SetDayRenderer(fn DayRenderFunc)
- func (c *Calendar) SetDisplayedMonth(date time.Time)
- func (c *Calendar) SetHighlightDates(dates []time.Time)
- func (c *Calendar) SetMaxDate(date *time.Time)
- func (c *Calendar) SetMinDate(date *time.Time)
- func (c *Calendar) SetOnRangeSelect(fn func(start, end time.Time))
- func (c *Calendar) SetOnSelect(fn func(time.Time))
- func (c *Calendar) SetRange(start, end *time.Time)
- func (c *Calendar) SetSelectedDate(date time.Time)
- func (c *Calendar) SetSelectionMode(mode CalendarSelectionMode)
- func (c *Calendar) SetShowWeekNumbers(show bool)
- func (c *Calendar) SetStyles(...)
- func (c *Calendar) SetWeekStart(start time.Weekday)
- func (c *Calendar) StyleType() string
- func (c *Calendar) Unbind()
- type CalendarDayState
- type CalendarOption
- func WithDayRenderer(fn DayRenderFunc) CalendarOption
- func WithDisplayedMonthSignal(sig *state.Signal[time.Time]) CalendarOption
- func WithHighlightDatesSignal(sig *state.Signal[[]time.Time]) CalendarOption
- func WithMaxDateSignal(sig *state.Signal[*time.Time]) CalendarOption
- func WithMinDateSignal(sig *state.Signal[*time.Time]) CalendarOption
- func WithNowFunc(fn func() time.Time) CalendarOption
- func WithSelectedDateSignal(sig *state.Signal[time.Time]) CalendarOption
- func WithSelectionMode(mode CalendarSelectionMode) CalendarOption
- func WithShowWeekNumbers(show bool) CalendarOption
- func WithWeekStart(start time.Weekday) CalendarOption
- type CalendarSelectionMode
- type CanvasOption
- type CanvasWidget
- func (w *CanvasWidget) Layout(bounds runtime.Rect)
- func (w *CanvasWidget) Measure(constraints runtime.Constraints) runtime.Size
- func (w *CanvasWidget) Render(ctx runtime.RenderContext)
- func (w *CanvasWidget) SetBlitter(blitter graphics.Blitter)
- func (w *CanvasWidget) WithBlitter(blitter graphics.Blitter) *CanvasWidgetdeprecated
- type Card
- func (c *Card) Bind(services runtime.Services)
- func (c *Card) ChildWidgets() []runtime.Widget
- func (c *Card) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (c *Card) Layout(bounds runtime.Rect)
- func (c *Card) Measure(constraints runtime.Constraints) runtime.Size
- func (c *Card) Render(ctx runtime.RenderContext)
- func (c *Card) SetBody(body runtime.Widget)
- func (c *Card) SetBorder(border bool)
- func (c *Card) SetFooter(footer runtime.Widget)
- func (c *Card) SetHeader(header runtime.Widget)
- func (c *Card) SetStyle(style backend.Style)
- func (c *Card) SetTitle(title string)
- func (c *Card) StyleType() string
- func (c *Card) Title() string
- func (c *Card) Unbind()
- type ChartSeries
- type Checkbox
- func (c *Checkbox) Bind(services runtime.Services)
- func (c *Checkbox) Checked() *bool
- func (c *Checkbox) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (c *Checkbox) Measure(constraints runtime.Constraints) runtime.Size
- func (c *Checkbox) Render(ctx runtime.RenderContext)
- func (c *Checkbox) SetChecked(value *bool)
- func (c *Checkbox) SetFocusStyle(style backend.Style)
- func (c *Checkbox) SetLabel(label string)
- func (c *Checkbox) SetOnChange(fn func(value *bool))
- func (c *Checkbox) SetStyle(style backend.Style)
- func (c *Checkbox) StyleType() string
- func (c *Checkbox) Unbind()
- type Chip
- func (c *Chip) Bind(services runtime.Services)
- func (c *Chip) CanFocus() bool
- func (c *Chip) Dismissible() bool
- func (c *Chip) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (c *Chip) Label() string
- func (c *Chip) Measure(constraints runtime.Constraints) runtime.Size
- func (c *Chip) Render(ctx runtime.RenderContext)
- func (c *Chip) RenderHTML(ctx runtime.HTMLContext) runtime.HTML
- func (c *Chip) SetLabel(label string)
- func (c *Chip) SetStyle(style backend.Style)
- func (c *Chip) StyleType() string
- func (c *Chip) Unbind()
- func (c *Chip) Variant() ChipVariant
- type ChipOption
- type ChipVariant
- type ColorPicker
- func (cp *ColorPicker) Bind(services runtime.Services)
- func (cp *ColorPicker) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (cp *ColorPicker) Measure(constraints runtime.Constraints) runtime.Size
- func (cp *ColorPicker) Render(ctx runtime.RenderContext)
- func (cp *ColorPicker) Selected() backend.Color
- func (cp *ColorPicker) SelectedIndex() int
- func (cp *ColorPicker) SetSelected(index int)
- func (cp *ColorPicker) SetStyle(style backend.Style)
- func (cp *ColorPicker) StyleType() string
- func (cp *ColorPicker) Unbind()
- type ColorPickerOption
- type ColorScale
- type ColumnPin
- type Combobox
- func (c *Combobox) Bind(services runtime.Services)
- func (c *Combobox) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (c *Combobox) Measure(constraints runtime.Constraints) runtime.Size
- func (c *Combobox) Options() []string
- func (c *Combobox) Render(ctx runtime.RenderContext)
- func (c *Combobox) SetFocusStyle(style backend.Style)
- func (c *Combobox) SetOnChange(fn func(string))
- func (c *Combobox) SetOptions(opts []string)
- func (c *Combobox) SetStyle(style backend.Style)
- func (c *Combobox) SetText(s string)
- func (c *Combobox) StyleType() string
- func (c *Combobox) Text() string
- func (c *Combobox) Unbind()
- type CommandPalette
- func (cp *CommandPalette) AddCommand(cmd PaletteCommand)
- func (cp *CommandPalette) Bind(services runtime.Services)
- func (cp *CommandPalette) FilteredCount() int
- func (cp *CommandPalette) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (cp *CommandPalette) Hide()
- func (cp *CommandPalette) Measure(constraints runtime.Constraints) runtime.Size
- func (cp *CommandPalette) Open() bool
- func (cp *CommandPalette) Query() string
- func (cp *CommandPalette) Render(ctx runtime.RenderContext)
- func (cp *CommandPalette) SelectedIndex() int
- func (cp *CommandPalette) SetCommands(cmds []PaletteCommand)
- func (cp *CommandPalette) SetMaxResults(n int)
- func (cp *CommandPalette) SetOnExecute(fn func(cmd PaletteCommand))
- func (cp *CommandPalette) SetOpen(open bool)
- func (cp *CommandPalette) SetStyle(style backend.Style)
- func (cp *CommandPalette) Show()
- func (cp *CommandPalette) StyleType() string
- func (cp *CommandPalette) Toggle()
- func (cp *CommandPalette) Unbind()
- type CommandPaletteOption
- type Component
- type DataGrid
- func (dg *DataGrid) AddRow(row []string)
- func (dg *DataGrid) Bind(services runtime.Services)
- func (dg *DataGrid) CancelEdit()
- func (dg *DataGrid) Cell(row, col int) string
- func (dg *DataGrid) ColumnCount() int
- func (dg *DataGrid) ColumnWidth(col int) int
- func (dg *DataGrid) Columns() []DataGridColumn
- func (dg *DataGrid) CommitEdit()
- func (dg *DataGrid) Editing() bool
- func (dg *DataGrid) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (dg *DataGrid) Measure(constraints runtime.Constraints) runtime.Size
- func (dg *DataGrid) PageBy(pages int)
- func (dg *DataGrid) RemoveRow(index int)
- func (dg *DataGrid) Render(ctx runtime.RenderContext)
- func (dg *DataGrid) RowCount() int
- func (dg *DataGrid) ScrollBy(dx, dy int)
- func (dg *DataGrid) ScrollTo(x, y int)
- func (dg *DataGrid) ScrollToEnd()
- func (dg *DataGrid) ScrollToStart()
- func (dg *DataGrid) SelectedCell() (row, col int)
- func (dg *DataGrid) SetCell(row, col int, value string)
- func (dg *DataGrid) SetColumnPin(col int, pin ColumnPin)
- func (dg *DataGrid) SetColumnWidth(col, width int)
- func (dg *DataGrid) SetHeaderStyle(s backend.Style)
- func (dg *DataGrid) SetLabel(label string)
- func (dg *DataGrid) SetOnCellEdit(fn func(row, col int, oldValue, newValue string))
- func (dg *DataGrid) SetOverscan(count int)
- func (dg *DataGrid) SetRows(rows [][]string)
- func (dg *DataGrid) SetSelectedCell(row, col int)
- func (dg *DataGrid) SetSelectedStyle(s backend.Style)
- func (dg *DataGrid) SetStyle(s backend.Style)
- func (dg *DataGrid) SetVirtualScroll(enabled bool)
- func (dg *DataGrid) Sort(col int, dir SortDirection)
- func (dg *DataGrid) SortState() (col int, dir SortDirection)
- func (dg *DataGrid) StartEdit()
- func (dg *DataGrid) StyleType() string
- func (dg *DataGrid) Unbind()
- func (dg *DataGrid) VirtualScroll() bool
- func (dg *DataGrid) VisibleRange() (start, end int)
- type DataGridColumn
- type DatePicker
- func (d *DatePicker) Bind(services runtime.Services)
- func (d *DatePicker) Calendar() *Calendar
- func (d *DatePicker) ChildWidgets() []runtime.Widget
- func (d *DatePicker) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (d *DatePicker) Input() *Input
- func (d *DatePicker) Layout(bounds runtime.Rect)
- func (d *DatePicker) Measure(constraints runtime.Constraints) runtime.Size
- func (d *DatePicker) PathSegment(child runtime.Widget) string
- func (d *DatePicker) Render(ctx runtime.RenderContext)
- func (d *DatePicker) SelectedDate() time.Time
- func (d *DatePicker) SetFormat(format string)
- func (d *DatePicker) SetHighlightDates(dates []time.Time)
- func (d *DatePicker) SetLabel(label string)
- func (d *DatePicker) SetMaxDate(date *time.Time)
- func (d *DatePicker) SetMinDate(date *time.Time)
- func (d *DatePicker) SetSelectedDate(date time.Time)
- func (d *DatePicker) SetSelectionMode(mode CalendarSelectionMode)
- func (d *DatePicker) SetShowWeekNumbers(show bool)
- func (d *DatePicker) SetWeekStart(start time.Weekday)
- func (d *DatePicker) StyleType() string
- func (d *DatePicker) Unbind()
- type DateRangePicker
- func (d *DateRangePicker) Bind(services runtime.Services)
- func (d *DateRangePicker) Calendar() *Calendar
- func (d *DateRangePicker) ChildWidgets() []runtime.Widget
- func (d *DateRangePicker) EndInput() *Input
- func (d *DateRangePicker) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (d *DateRangePicker) Layout(bounds runtime.Rect)
- func (d *DateRangePicker) Measure(constraints runtime.Constraints) runtime.Size
- func (d *DateRangePicker) OnRangeSelect(fn func(start, end time.Time))deprecated
- func (d *DateRangePicker) Render(ctx runtime.RenderContext)
- func (d *DateRangePicker) SelectedRange() (time.Time, time.Time, bool)
- func (d *DateRangePicker) SetFormat(format string)
- func (d *DateRangePicker) SetLabel(label string)
- func (d *DateRangePicker) SetOnRangeSelect(fn func(start, end time.Time))
- func (d *DateRangePicker) SetRange(start, end *time.Time)
- func (d *DateRangePicker) StartInput() *Input
- func (d *DateRangePicker) StyleType() string
- func (d *DateRangePicker) Unbind()
- type DayRenderFunc
- type DebugOverlay
- type DebugOverlayOption
- type Dialog
- func (d *Dialog) Apply(opts ...DialogOption) *Dialog
- func (d *Dialog) Bind(services runtime.Services)
- func (d *Dialog) CenteredBounds(parent runtime.Rect) runtime.Rect
- func (d *Dialog) ChildWidgets() []runtime.Widget
- func (d *Dialog) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (d *Dialog) IsPaused() bool
- func (d *Dialog) Layout(bounds runtime.Rect)
- func (d *Dialog) Measure(constraints runtime.Constraints) runtime.Size
- func (d *Dialog) OnDismiss(fn func()) *Dialogdeprecated
- func (d *Dialog) PathSegment(child runtime.Widget) string
- func (d *Dialog) PauseTimer()
- func (d *Dialog) Render(ctx runtime.RenderContext)
- func (d *Dialog) ResumeTimer()
- func (d *Dialog) SetAutoDismiss(duration time.Duration)
- func (d *Dialog) SetButtons(buttons ...DialogButton)
- func (d *Dialog) SetContent(content runtime.Widget)
- func (d *Dialog) SetDismissable(dismissable bool)
- func (d *Dialog) SetOnDismiss(fn func())
- func (d *Dialog) SetStyle(style backend.Style)
- func (d *Dialog) ShouldDismiss(now time.Time) bool
- func (d *Dialog) StyleType() string
- func (d *Dialog) TimerProgress(now time.Time) float64
- func (d *Dialog) Unbind()
- func (d *Dialog) WithAutoDismiss(duration time.Duration) *Dialogdeprecated
- func (d *Dialog) WithContent(content runtime.Widget) *Dialogdeprecated
- func (d *Dialog) WithDismissable(dismissable bool) *Dialogdeprecated
- type DialogButton
- type DialogOption
- func WithDialogAutoDismiss(duration time.Duration) DialogOption
- func WithDialogButtons(buttons ...DialogButton) DialogOption
- func WithDialogContent(content runtime.Widget) DialogOption
- func WithDialogDismissable(dismissable bool) DialogOption
- func WithDialogOnDismiss(fn func()) DialogOption
- func WithDialogStyle(style backend.Style) DialogOption
- type DirectoryEntry
- type DirectoryTree
- func (d *DirectoryTree) Bind(services runtime.Services)
- func (d *DirectoryTree) CollapseSelected()
- func (d *DirectoryTree) ExpandSelected()
- func (d *DirectoryTree) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (d *DirectoryTree) Layout(bounds runtime.Rect)
- func (d *DirectoryTree) LazyLoad() bool
- func (d *DirectoryTree) Measure(constraints runtime.Constraints) runtime.Size
- func (d *DirectoryTree) PageBy(pages int)
- func (d *DirectoryTree) Refresh()
- func (d *DirectoryTree) Render(ctx runtime.RenderContext)
- func (d *DirectoryTree) Root() string
- func (d *DirectoryTree) ScrollBy(dx, dy int)
- func (d *DirectoryTree) ScrollTo(x, y int)
- func (d *DirectoryTree) ScrollToEnd()
- func (d *DirectoryTree) ScrollToStart()
- func (d *DirectoryTree) SelectedEntry() *DirectoryEntry
- func (d *DirectoryTree) SelectedPath() string
- func (d *DirectoryTree) SetFilter(filter func(os.DirEntry) bool)
- func (d *DirectoryTree) SetLabel(label string)
- func (d *DirectoryTree) SetLazyLoad(lazy bool)
- func (d *DirectoryTree) SetOnSelect(fn func(path string))
- func (d *DirectoryTree) SetRoot(root string)
- func (d *DirectoryTree) SetSelectedStyle(style backend.Style)
- func (d *DirectoryTree) SetShowHidden(show bool)
- func (d *DirectoryTree) SetStyle(style backend.Style)
- func (d *DirectoryTree) ShowHidden() bool
- func (d *DirectoryTree) StyleType() string
- func (d *DirectoryTree) ToggleSelected()
- func (d *DirectoryTree) Unbind()
- type DirectoryTreeOption
- func WithDirectoryFilter(filter func(os.DirEntry) bool) DirectoryTreeOption
- func WithDirectoryIcons(dir, file, expanded, collapsed string) DirectoryTreeOption
- func WithDirectorySelectedStyle(s backend.Style) DirectoryTreeOption
- func WithDirectoryStyle(s backend.Style) DirectoryTreeOption
- func WithLazyLoad(lazy bool) DirectoryTreeOption
- func WithOnSelect(fn func(path string)) DirectoryTreeOption
- func WithShowHidden(show bool) DirectoryTreeOption
- type Disclosure
- func (d *Disclosure) Bind(services runtime.Services)
- func (d *Disclosure) ChildWidgets() []runtime.Widget
- func (d *Disclosure) Expanded() bool
- func (d *Disclosure) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (d *Disclosure) Layout(bounds runtime.Rect)
- func (d *Disclosure) Measure(constraints runtime.Constraints) runtime.Size
- func (d *Disclosure) Render(ctx runtime.RenderContext)
- func (d *Disclosure) SetExpanded(expanded bool)
- func (d *Disclosure) SetFocusStyle(style backend.Style)
- func (d *Disclosure) SetOnChange(fn func(expanded bool))
- func (d *Disclosure) SetStyle(style backend.Style)
- func (d *Disclosure) StyleType() string
- func (d *Disclosure) Toggle()
- func (d *Disclosure) Unbind()
- type Drawer
- func (d *Drawer) Bind(services runtime.Services)
- func (d *Drawer) ChildWidgets() []runtime.Widget
- func (d *Drawer) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (d *Drawer) IsOpen() bool
- func (d *Drawer) Layout(bounds runtime.Rect)
- func (d *Drawer) Measure(constraints runtime.Constraints) runtime.Size
- func (d *Drawer) Render(ctx runtime.RenderContext)
- func (d *Drawer) SetOpen(value bool)
- func (d *Drawer) SetStyle(style backend.Style)
- func (d *Drawer) StyleType() string
- func (d *Drawer) Unbind()
- type DrawerOption
- type DrawerSide
- type EnhancedPalette
- type FilePicker
- func (fp *FilePicker) Bind(services runtime.Services)
- func (fp *FilePicker) CurrentDir() string
- func (fp *FilePicker) EntryCount() int
- func (fp *FilePicker) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (fp *FilePicker) Measure(constraints runtime.Constraints) runtime.Size
- func (fp *FilePicker) Render(ctx runtime.RenderContext)
- func (fp *FilePicker) SelectedIndex() int
- func (fp *FilePicker) SetStyle(style backend.Style)
- func (fp *FilePicker) StyleType() string
- func (fp *FilePicker) Unbind()
- type FilePickerOption
- type FixedSpacer
- type Flex
- type FlexChild
- type FlexDirection
- type FocusTrap
- func (f *FocusTrap) Active() bool
- func (f *FocusTrap) Bind(services runtime.Services)
- func (f *FocusTrap) Child() runtime.Widget
- func (f *FocusTrap) ChildWidgets() []runtime.Widget
- func (f *FocusTrap) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (f *FocusTrap) Layout(bounds runtime.Rect)
- func (f *FocusTrap) Measure(constraints runtime.Constraints) runtime.Size
- func (f *FocusTrap) PathSegment(child runtime.Widget) string
- func (f *FocusTrap) Render(ctx runtime.RenderContext)
- func (f *FocusTrap) Scope() *runtime.FocusScope
- func (f *FocusTrap) SetActive(active bool)
- func (f *FocusTrap) SetChild(child runtime.Widget)
- func (f *FocusTrap) SetLabel(label string)
- func (f *FocusTrap) StyleType() string
- func (f *FocusTrap) Unbind()
- type FocusableBase
- type Form
- func (f *Form) Bind(services runtime.Services)
- func (f *Form) ChildWidgets() []runtime.Widget
- func (f *Form) Errors() map[int]string
- func (f *Form) FieldCount() int
- func (f *Form) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (f *Form) Layout(bounds runtime.Rect)
- func (f *Form) Measure(constraints runtime.Constraints) runtime.Size
- func (f *Form) PathSegment(child runtime.Widget) string
- func (f *Form) Render(ctx runtime.RenderContext)
- func (f *Form) SetCancelLabel(label string)
- func (f *Form) SetLabel(label string)
- func (f *Form) SetOnCancel(fn func())
- func (f *Form) SetOnSubmit(fn func(map[string]string))
- func (f *Form) SetSubmitLabel(label string)
- func (f *Form) StyleType() string
- func (f *Form) Unbind()
- func (f *Form) Validate() bool
- type FormFieldDef
- type GPUCanvasOption
- type GPUCanvasWidget
- func (w *GPUCanvasWidget) Layout(bounds runtime.Rect)
- func (w *GPUCanvasWidget) Measure(constraints runtime.Constraints) runtime.Size
- func (w *GPUCanvasWidget) Render(ctx runtime.RenderContext)
- func (w *GPUCanvasWidget) SetBackend(backend gpu.Backend)
- func (w *GPUCanvasWidget) SetDriver(driver gpu.Driver)
- func (w *GPUCanvasWidget) SetEncoder(encoder graphics.TerminalEncoder)
- func (w *GPUCanvasWidget) Unbind()
- func (w *GPUCanvasWidget) WithBackend(backend gpu.Backend) *GPUCanvasWidgetdeprecated
- func (w *GPUCanvasWidget) WithDriver(driver gpu.Driver) *GPUCanvasWidgetdeprecated
- func (w *GPUCanvasWidget) WithEncoder(encoder graphics.TerminalEncoder) *GPUCanvasWidgetdeprecated
- type GaugeColors
- type GaugeSpan
- type GaugeStyle
- type GaugeThreshold
- type Grid
- func (g *Grid) Add(child runtime.Widget, row, col, rowSpan, colSpan int)
- func (g *Grid) Bind(services runtime.Services)
- func (g *Grid) ChildWidgets() []runtime.Widget
- func (g *Grid) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (g *Grid) Layout(bounds runtime.Rect)
- func (g *Grid) Measure(constraints runtime.Constraints) runtime.Size
- func (g *Grid) PathSegment(child runtime.Widget) string
- func (g *Grid) Render(ctx runtime.RenderContext)
- func (g *Grid) SetLabel(label string)
- func (g *Grid) Unbind()
- type GridBuilder
- type GridChild
- type HTMLItemRenderer
- type HeatMap
- func (hm *HeatMap) Bind(services runtime.Services)
- func (hm *HeatMap) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (hm *HeatMap) Measure(constraints runtime.Constraints) runtime.Size
- func (hm *HeatMap) Render(ctx runtime.RenderContext)
- func (hm *HeatMap) SetLabel(label string)
- func (hm *HeatMap) StyleType() string
- func (hm *HeatMap) Unbind()
- type Image
- func (w *Image) Bind(services runtime.Services)
- func (w *Image) Fit() ImageFit
- func (w *Image) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (w *Image) Label() string
- func (w *Image) Layout(bounds runtime.Rect)
- func (w *Image) Measure(constraints runtime.Constraints) runtime.Size
- func (w *Image) Protocol() ImageProtocol
- func (w *Image) Render(ctx runtime.RenderContext)
- func (w *Image) SetFit(fit ImageFit)
- func (w *Image) SetImage(img image.Image)
- func (w *Image) SetLabel(label string)
- func (w *Image) SetProtocol(proto ImageProtocol)
- func (w *Image) StyleType() string
- func (w *Image) Unbind()
- type ImageFit
- type ImageProtocol
- type Input
- func (i *Input) Bind(services runtime.Services)
- func (i *Input) CanRedo() bool
- func (i *Input) CanUndo() bool
- func (i *Input) Clear()
- func (i *Input) ClearHistory()
- func (i *Input) ClipboardCopy() (string, bool)
- func (i *Input) ClipboardCut() (string, bool)
- func (i *Input) ClipboardPaste(text string) bool
- func (i *Input) CursorOffset() int
- func (i *Input) CursorPos() int
- func (i *Input) CursorPosition() (x, y int)
- func (i *Input) CursorWordLeft()
- func (i *Input) CursorWordRight()
- func (i *Input) Errors() []string
- func (i *Input) GetSelectedText() string
- func (i *Input) GetSelection() Selection
- func (i *Input) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (i *Input) HasSelection() bool
- func (i *Input) Measure(constraints runtime.Constraints) runtime.Size
- func (i *Input) OnChange(fn func(text string))deprecated
- func (i *Input) OnSubmit(fn func(text string))deprecated
- func (i *Input) Redo() bool
- func (i *Input) Render(ctx runtime.RenderContext)
- func (i *Input) SelectAll()
- func (i *Input) SelectLine()
- func (i *Input) SelectNone()
- func (i *Input) SelectWord()
- func (i *Input) SetCursorOffset(offset int)
- func (i *Input) SetCursorPosition(x, y int)
- func (i *Input) SetFocusStyle(style backend.Style)
- func (i *Input) SetHistoryEnabled(enabled bool)
- func (i *Input) SetHistoryOptions(opts ...state.HistoryOption)
- func (i *Input) SetLabel(label string)
- func (i *Input) SetOnChange(fn func(text string))
- func (i *Input) SetOnSubmit(fn func(text string))
- func (i *Input) SetPlaceholder(text string)
- func (i *Input) SetSelection(sel Selection)
- func (i *Input) SetStyle(style backend.Style)
- func (i *Input) SetText(text string)
- func (i *Input) SetValidators(validators ...forms.Validator)
- func (i *Input) StyleType() string
- func (i *Input) Text() string
- func (i *Input) Unbind()
- func (i *Input) Undo() bool
- func (i *Input) Valid() bool
- func (i *Input) Validate() []forms.ValidationError
- type Inspector
- func (ins *Inspector) Bind(services runtime.Services)
- func (ins *Inspector) Entries() int
- func (ins *Inspector) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (ins *Inspector) Layout(bounds runtime.Rect)
- func (ins *Inspector) Measure(constraints runtime.Constraints) runtime.Size
- func (ins *Inspector) Refresh()
- func (ins *Inspector) Render(ctx runtime.RenderContext)
- func (ins *Inspector) Selected() int
- func (ins *Inspector) SelectedEntry() inspectorEntry
- func (ins *Inspector) SetRoot(w runtime.Widget)
- func (ins *Inspector) Toggle()
- func (ins *Inspector) Unbind()
- func (ins *Inspector) Visible() bool
- type InspectorOption
- type Label
- func (l *Label) Bind(services runtime.Services)
- func (l *Label) Direction() i18n.Direction
- func (l *Label) Measure(constraints runtime.Constraints) runtime.Size
- func (l *Label) Render(ctx runtime.RenderContext)
- func (l *Label) RenderHTML(ctx runtime.HTMLContext) runtime.HTML
- func (l *Label) SetA11yLabel(label string)
- func (l *Label) SetAlignment(align Alignment)
- func (l *Label) SetDirection(dir i18n.Direction)
- func (l *Label) SetStyle(style backend.Style)
- func (l *Label) SetText(text string)
- func (l *Label) StyleType() string
- func (l *Label) Unbind()
- func (l *Label) WithAlignment(align Alignment) *Labeldeprecated
- func (l *Label) WithStyle(style backend.Style) *Labeldeprecated
- type LabelOption
- type LazyLoadable
- type LineChart
- func (c *LineChart) AddSeries(series ChartSeries)
- func (c *LineChart) AutoYAxis()
- func (c *LineChart) Bind(services runtime.Services)
- func (c *LineChart) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (c *LineChart) Layout(bounds runtime.Rect)
- func (c *LineChart) Measure(constraints runtime.Constraints) runtime.Size
- func (c *LineChart) Render(ctx runtime.RenderContext)
- func (c *LineChart) SetSeries(series []ChartSeries)
- func (c *LineChart) SetYAxis(minValue, maxValue float64)
- func (c *LineChart) StyleType() string
- func (c *LineChart) Unbind()
- type Link
- func (l *Link) Bind(services runtime.Services)
- func (l *Link) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (l *Link) Measure(constraints runtime.Constraints) runtime.Size
- func (l *Link) Render(ctx runtime.RenderContext)
- func (l *Link) RenderHTML(ctx runtime.HTMLContext) runtime.HTML
- func (l *Link) SetFocusStyle(s backend.Style)
- func (l *Link) SetLabel(label string)
- func (l *Link) SetOnActivate(fn func(url string))
- func (l *Link) SetStyle(s backend.Style)
- func (l *Link) SetURL(url string)
- func (l *Link) URL() string
- func (l *Link) Unbind()
- type List
- func (l *List[T]) Bind(services runtime.Services)
- func (l *List[T]) CanDrop(data runtime.DragData) bool
- func (l *List[T]) DragOrigin() int
- func (l *List[T]) DropIndex() int
- func (l *List[T]) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (l *List[T]) IsDraggable() bool
- func (l *List[T]) IsDragging() bool
- func (l *List[T]) Measure(constraints runtime.Constraints) runtime.Size
- func (l *List[T]) OnDrop(data runtime.DragData) bool
- func (l *List[T]) OnSelect(fn func(index int, item T))deprecated
- func (l *List[T]) PageBy(pages int)
- func (l *List[T]) Render(ctx runtime.RenderContext)
- func (l *List[T]) RenderHTML(ctx runtime.HTMLContext) runtime.HTML
- func (l *List[T]) ScrollBy(dx, dy int)
- func (l *List[T]) ScrollTo(x, y int)
- func (l *List[T]) ScrollToEnd()
- func (l *List[T]) ScrollToStart()
- func (l *List[T]) SelectedIndex() int
- func (l *List[T]) SelectedItem() (T, bool)
- func (l *List[T]) SetDragStyle(style backend.Style)
- func (l *List[T]) SetDraggable(enabled bool)
- func (l *List[T]) SetHTMLItemRenderer(r HTMLItemRenderer[T])
- func (l *List[T]) SetLabel(label string)
- func (l *List[T]) SetOnDrop(fn ListOnDrop[T])
- func (l *List[T]) SetOnSelect(fn func(index int, item T))
- func (l *List[T]) SetSelected(index int)
- func (l *List[T]) SetSelectedStyle(style backend.Style)
- func (l *List[T]) SetStyle(style backend.Style)
- func (l *List[T]) StyleType() string
- func (l *List[T]) Unbind()
- type ListAdapter
- type ListOnDrop
- type Log
- func (l *Log) AddEntry(entry LogEntry)
- func (l *Log) AutoScroll() bool
- func (l *Log) Bind(services runtime.Services)
- func (l *Log) Clear()
- func (l *Log) ClipboardCopy() (string, bool)
- func (l *Log) Debug(message string, fields ...map[string]any)
- func (l *Log) Entries() []LogEntry
- func (l *Log) EntryCount() int
- func (l *Log) Error(message string, fields ...map[string]any)
- func (l *Log) FilteredEntries() []LogEntry
- func (l *Log) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (l *Log) Info(message string, fields ...map[string]any)
- func (l *Log) Layout(bounds runtime.Rect)
- func (l *Log) Log(level LogLevel, message string, fields ...map[string]any)
- func (l *Log) Measure(constraints runtime.Constraints) runtime.Size
- func (l *Log) MinLevel() LogLevel
- func (l *Log) PageBy(pages int)
- func (l *Log) Render(ctx runtime.RenderContext)
- func (l *Log) ScrollBy(dx, dy int)
- func (l *Log) ScrollTo(x, y int)
- func (l *Log) ScrollToEnd()
- func (l *Log) ScrollToStart()
- func (l *Log) SetAutoScroll(auto bool)
- func (l *Log) SetFilter(filter func(LogEntry) bool)
- func (l *Log) SetLabel(label string)
- func (l *Log) SetLevelStyle(level LogLevel, style backend.Style)
- func (l *Log) SetMinLevel(level LogLevel)
- func (l *Log) SetShowTime(show bool)
- func (l *Log) SetStyle(style backend.Style)
- func (l *Log) ShowTime() bool
- func (l *Log) StyleType() string
- func (l *Log) Unbind()
- func (l *Log) Warn(message string, fields ...map[string]any)
- func (l *Log) Write(p []byte) (n int, err error)
- type LogEntry
- type LogLevel
- type LogOption
- func WithAutoScroll(auto bool) LogOption
- func WithLevelColors(colors map[LogLevel]backend.Style) LogOption
- func WithLogFilter(filter func(LogEntry) bool) LogOption
- func WithLogStyle(s backend.Style) LogOption
- func WithMaxLines(max int) LogOption
- func WithMinLevel(level LogLevel) LogOption
- func WithShowTime(show bool) LogOption
- type MarkdownViewer
- func (m *MarkdownViewer) Content() string
- func (m *MarkdownViewer) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (m *MarkdownViewer) Layout(bounds runtime.Rect)
- func (m *MarkdownViewer) Measure(constraints runtime.Constraints) runtime.Size
- func (m *MarkdownViewer) PageBy(pages int)
- func (m *MarkdownViewer) Render(ctx runtime.RenderContext)
- func (m *MarkdownViewer) RenderHTML(ctx runtime.HTMLContext) runtime.HTML
- func (m *MarkdownViewer) ScrollBy(dx, dy int)
- func (m *MarkdownViewer) ScrollTo(x, y int)
- func (m *MarkdownViewer) ScrollToEnd()
- func (m *MarkdownViewer) ScrollToStart()
- func (m *MarkdownViewer) SetContent(content string)
- func (m *MarkdownViewer) StyleType() string
- type MarkdownViewerOption
- type MaskedInput
- func (m *MaskedInput) Bind(services runtime.Services)
- func (m *MaskedInput) Blur()
- func (m *MaskedInput) ClipboardCopy() (string, bool)
- func (m *MaskedInput) ClipboardCut() (string, bool)
- func (m *MaskedInput) ClipboardPaste(text string) bool
- func (m *MaskedInput) CursorPos() int
- func (m *MaskedInput) Errors() []string
- func (m *MaskedInput) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (m *MaskedInput) Layout(bounds runtime.Rect)
- func (m *MaskedInput) Mask() string
- func (m *MaskedInput) MaskedValue() string
- func (m *MaskedInput) Measure(constraints runtime.Constraints) runtime.Size
- func (m *MaskedInput) Placeholder() rune
- func (m *MaskedInput) Render(ctx runtime.RenderContext)
- func (m *MaskedInput) SetFocusStyle(style backend.Style)
- func (m *MaskedInput) SetLabel(label string)
- func (m *MaskedInput) SetMask(mask string)
- func (m *MaskedInput) SetOnChange(fn func(value string))
- func (m *MaskedInput) SetOnSubmit(fn func(value string))
- func (m *MaskedInput) SetPlaceholder(r rune)
- func (m *MaskedInput) SetStyle(style backend.Style)
- func (m *MaskedInput) SetValidators(validators ...forms.Validator)
- func (m *MaskedInput) SetValue(value string)
- func (m *MaskedInput) StyleType() string
- func (m *MaskedInput) Unbind()
- func (m *MaskedInput) Valid() bool
- func (m *MaskedInput) Validate() []forms.ValidationError
- func (m *MaskedInput) Value() string
- type MaskedInputOption
- type Menu
- func (m *Menu) Bind(services runtime.Services)
- func (m *Menu) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (m *Menu) Measure(constraints runtime.Constraints) runtime.Size
- func (m *Menu) PageBy(pages int)
- func (m *Menu) Render(ctx runtime.RenderContext)
- func (m *Menu) ScrollBy(dx, dy int)
- func (m *Menu) ScrollTo(x, y int)
- func (m *Menu) ScrollToEnd()
- func (m *Menu) ScrollToStart()
- func (m *Menu) SetItems(items ...*MenuItem)
- func (m *Menu) SetLabel(label string)
- func (m *Menu) SetSelectedStyle(style backend.Style)
- func (m *Menu) SetStyle(style backend.Style)
- func (m *Menu) StyleType() string
- func (m *Menu) Unbind()
- type MenuItem
- type MultiSelect
- func (m *MultiSelect) Bind(services runtime.Services)
- func (m *MultiSelect) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (m *MultiSelect) Measure(constraints runtime.Constraints) runtime.Size
- func (m *MultiSelect) Render(ctx runtime.RenderContext)
- func (m *MultiSelect) SelectedOptions() []MultiSelectOption
- func (m *MultiSelect) SetLabel(label string)
- func (m *MultiSelect) SetOnChange(fn func(selected []MultiSelectOption))
- func (m *MultiSelect) SetOptions(options []MultiSelectOption)
- func (m *MultiSelect) StyleType() string
- func (m *MultiSelect) Unbind()
- type MultiSelectOption
- type MultilineInput
- func (m *MultilineInput) Bind(services runtime.Services)
- func (m *MultilineInput) Clear()
- func (m *MultilineInput) ClipboardCopy() (string, bool)
- func (m *MultilineInput) ClipboardCut() (string, bool)
- func (m *MultilineInput) ClipboardPaste(text string) bool
- func (m *MultilineInput) CursorOffset() int
- func (m *MultilineInput) CursorPosition() (x, y int)
- func (m *MultilineInput) CursorWordLeft()
- func (m *MultilineInput) CursorWordRight()
- func (m *MultilineInput) Errors() []string
- func (m *MultilineInput) GetSelectedText() string
- func (m *MultilineInput) GetSelection() Selection
- func (m *MultilineInput) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (m *MultilineInput) HasSelection() bool
- func (m *MultilineInput) Measure(constraints runtime.Constraints) runtime.Size
- func (m *MultilineInput) OnChange(fn func(text string))deprecated
- func (m *MultilineInput) OnSubmit(fn func(text string))deprecated
- func (m *MultilineInput) Render(ctx runtime.RenderContext)
- func (m *MultilineInput) SelectAll()
- func (m *MultilineInput) SelectLine()
- func (m *MultilineInput) SelectNone()
- func (m *MultilineInput) SelectWord()
- func (m *MultilineInput) SetCursorOffset(offset int)
- func (m *MultilineInput) SetCursorPosition(x, y int)
- func (m *MultilineInput) SetFocusStyle(style backend.Style)
- func (m *MultilineInput) SetLabel(label string)
- func (m *MultilineInput) SetOnChange(fn func(text string))
- func (m *MultilineInput) SetOnSubmit(fn func(text string))
- func (m *MultilineInput) SetSelection(sel Selection)
- func (m *MultilineInput) SetStyle(style backend.Style)
- func (m *MultilineInput) SetText(text string)
- func (m *MultilineInput) SetValidators(validators ...forms.Validator)
- func (m *MultilineInput) StyleType() string
- func (m *MultilineInput) Text() string
- func (m *MultilineInput) Unbind()
- func (m *MultilineInput) Valid() bool
- func (m *MultilineInput) Validate() []forms.ValidationError
- type MutableListAdapter
- type MutableSliceAdapter
- type Notification
- type NotificationAction
- type NotificationCenter
- func (nc *NotificationCenter) Add(n Notification)
- func (nc *NotificationCenter) AddSimple(level NotificationLevel, title, body string)
- func (nc *NotificationCenter) Bind(services runtime.Services)
- func (nc *NotificationCenter) Dismiss(id string)
- func (nc *NotificationCenter) DismissAll()
- func (nc *NotificationCenter) Expanded() bool
- func (nc *NotificationCenter) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (nc *NotificationCenter) MarkAllRead()
- func (nc *NotificationCenter) MarkRead(id string)
- func (nc *NotificationCenter) Measure(constraints runtime.Constraints) runtime.Size
- func (nc *NotificationCenter) Notifications() []Notification
- func (nc *NotificationCenter) Render(ctx runtime.RenderContext)
- func (nc *NotificationCenter) Selected() int
- func (nc *NotificationCenter) SetExpanded(expanded bool)
- func (nc *NotificationCenter) SetHeaderStyle(style backend.Style)
- func (nc *NotificationCenter) SetLabel(label string)
- func (nc *NotificationCenter) SetMaxItems(max int)
- func (nc *NotificationCenter) SetOnDismiss(fn func(id string))
- func (nc *NotificationCenter) SetSelectedStyle(style backend.Style)
- func (nc *NotificationCenter) SetStyle(style backend.Style)
- func (nc *NotificationCenter) StyleType() string
- func (nc *NotificationCenter) Unbind()
- func (nc *NotificationCenter) UnreadCount() int
- type NotificationLevel
- type NumberInput
- func (n *NumberInput) Bind(services runtime.Services)
- func (n *NumberInput) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (n *NumberInput) Max() float64
- func (n *NumberInput) Measure(constraints runtime.Constraints) runtime.Size
- func (n *NumberInput) Min() float64
- func (n *NumberInput) Render(ctx runtime.RenderContext)
- func (n *NumberInput) SetStyle(style backend.Style)
- func (n *NumberInput) SetValue(v float64)
- func (n *NumberInput) Step() float64
- func (n *NumberInput) StyleType() string
- func (n *NumberInput) Unbind()
- func (n *NumberInput) Value() float64
- type NumberInputOption
- type Option
- type Orientation
- type Pagination
- func (p *Pagination) Bind(services runtime.Services)
- func (p *Pagination) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (p *Pagination) Measure(constraints runtime.Constraints) runtime.Size
- func (p *Pagination) Page() int
- func (p *Pagination) Render(ctx runtime.RenderContext)
- func (p *Pagination) SetOnChange(fn func(page int))
- func (p *Pagination) SetPage(page int)
- func (p *Pagination) SetStyle(style backend.Style)
- func (p *Pagination) StyleType() string
- func (p *Pagination) TotalPages() int
- func (p *Pagination) Unbind()
- type PaletteCommand
- type PaletteItem
- type PaletteWidget
- func (p *PaletteWidget) Bind(services runtime.Services)
- func (p *PaletteWidget) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (p *PaletteWidget) Layout(bounds runtime.Rect)
- func (p *PaletteWidget) Measure(constraints runtime.Constraints) runtime.Size
- func (p *PaletteWidget) Query() string
- func (p *PaletteWidget) Render(ctx runtime.RenderContext)
- func (p *PaletteWidget) SelectedItem() *PaletteItem
- func (p *PaletteWidget) SetFilterFn(fn func(item PaletteItem, query string) bool)
- func (p *PaletteWidget) SetItems(items []PaletteItem)
- func (p *PaletteWidget) SetMaxVisible(max int)
- func (p *PaletteWidget) SetOnSelect(fn func(item PaletteItem))
- func (p *PaletteWidget) SetPlaceholder(placeholder string)
- func (p *PaletteWidget) SetScoreFn(fn func(item PaletteItem, query string) int)
- func (p *PaletteWidget) SetStyles(bg, border, title, query, item, selected, category backend.Style)
- func (p *PaletteWidget) StyleType() string
- func (p *PaletteWidget) Unbind()
- type Panel
- func (p *Panel) Bind(services runtime.Services)
- func (p *Panel) ChildWidgets() []runtime.Widget
- func (p *Panel) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (p *Panel) Layout(bounds runtime.Rect)
- func (p *Panel) Measure(constraints runtime.Constraints) runtime.Size
- func (p *Panel) Render(ctx runtime.RenderContext)
- func (p *Panel) SetBorder(enabled bool)
- func (p *Panel) SetBorderStyle(style backend.Style)
- func (p *Panel) SetStyle(style backend.Style)
- func (p *Panel) SetTitle(title string)
- func (p *Panel) StyleType() string
- func (p *Panel) Unbind()
- func (p *Panel) WithBorder(style backend.Style) *Paneldeprecated
- func (p *Panel) WithStyle(style backend.Style) *Paneldeprecated
- func (p *Panel) WithTitle(title string) *Paneldeprecated
- type PanelOption
- type PerformanceDashboard
- func (d *PerformanceDashboard) Bind(services runtime.Services)
- func (d *PerformanceDashboard) Measure(constraints runtime.Constraints) runtime.Size
- func (d *PerformanceDashboard) Render(ctx runtime.RenderContext)
- func (d *PerformanceDashboard) SetRefreshInterval(interval time.Duration)
- func (d *PerformanceDashboard) SetSampler(sampler *runtime.RenderSampler)
- func (d *PerformanceDashboard) StyleType() string
- func (d *PerformanceDashboard) Unbind()
- type PerformanceDashboardOption
- func WithPerformanceHeaderStyle(style backend.Style) PerformanceDashboardOption
- func WithPerformanceLabel(label string) PerformanceDashboardOption
- func WithPerformanceMutedStyle(style backend.Style) PerformanceDashboardOption
- func WithPerformanceRefresh(interval time.Duration) PerformanceDashboardOption
- func WithPerformanceStyle(style backend.Style) PerformanceDashboardOption
- type Popover
- func (p *Popover) Bind(services runtime.Services)
- func (p *Popover) ChildWidgets() []runtime.Widget
- func (p *Popover) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (p *Popover) HitSelf() bool
- func (p *Popover) Layout(bounds runtime.Rect)
- func (p *Popover) Measure(constraints runtime.Constraints) runtime.Size
- func (p *Popover) Mount()
- func (p *Popover) Render(ctx runtime.RenderContext)
- func (p *Popover) Unbind()
- func (p *Popover) Unmount()
- type PopoverOption
- func WithPopoverDismissOnEscape(enabled bool) PopoverOption
- func WithPopoverDismissOnMoveOutside(enabled bool) PopoverOption
- func WithPopoverDismissOnOutside(enabled bool) PopoverOption
- func WithPopoverGap(gap int) PopoverOption
- func WithPopoverMatchAnchorWidth(enabled bool) PopoverOption
- func WithPopoverOnClose(fn func()) PopoverOption
- func WithPopoverPlacement(placement PopoverPlacement) PopoverOption
- type PopoverPlacement
- type Progress
- func (p *Progress) Bind(services runtime.Services)
- func (p *Progress) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (p *Progress) Measure(constraints runtime.Constraints) runtime.Size
- func (p *Progress) Render(ctx runtime.RenderContext)
- func (p *Progress) StyleType() string
- func (p *Progress) Unbind()
- type Radio
- func (r *Radio) Bind(services runtime.Services)
- func (r *Radio) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (r *Radio) Measure(constraints runtime.Constraints) runtime.Size
- func (r *Radio) Render(ctx runtime.RenderContext)
- func (r *Radio) SetDisabled(disabled bool)
- func (r *Radio) SetFocusStyle(style backend.Style)
- func (r *Radio) SetLabel(label string)
- func (r *Radio) SetStyle(style backend.Style)
- func (r *Radio) StyleType() string
- func (r *Radio) Unbind()
- type RadioGroup
- type RangeSlider
- func (r *RangeSlider) Bind(services runtime.Services)
- func (r *RangeSlider) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (r *RangeSlider) Measure(constraints runtime.Constraints) runtime.Size
- func (r *RangeSlider) Render(ctx runtime.RenderContext)
- func (r *RangeSlider) SetLabel(label string)
- func (r *RangeSlider) SetRange(min, max, step float64)
- func (r *RangeSlider) SetStyles(base, track, thumb, fill backend.Style)
- func (r *RangeSlider) SetValues(minValue, maxValue float64)
- func (r *RangeSlider) StyleType() string
- func (r *RangeSlider) Unbind()
- func (r *RangeSlider) Values() (float64, float64)
- type RangeSliderOption
- func WithRangeSliderOrientation(orientation Orientation) RangeSliderOption
- func WithRangeSliderRange(min, max, step float64) RangeSliderOption
- func WithRangeSliderShowValue(show bool) RangeSliderOption
- func WithRangeSliderStyles(track, thumb, fill backend.Style) RangeSliderOption
- func WithRangeSliderValueFormat(format string) RangeSliderOption
- type Rating
- func (r *Rating) Bind(services runtime.Services)
- func (r *Rating) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (r *Rating) Max() int
- func (r *Rating) Measure(constraints runtime.Constraints) runtime.Size
- func (r *Rating) Render(ctx runtime.RenderContext)
- func (r *Rating) SetOnChange(fn func(int))
- func (r *Rating) SetStyle(style backend.Style)
- func (r *Rating) SetValue(value int)
- func (r *Rating) StyleType() string
- func (r *Rating) Unbind()
- func (r *Rating) Value() int
- type RenderFunc
- type RichText
- func (r *RichText) Bind(services runtime.Services)
- func (r *RichText) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (r *RichText) Layout(bounds runtime.Rect)
- func (r *RichText) Measure(constraints runtime.Constraints) runtime.Size
- func (r *RichText) PageBy(pages int)
- func (r *RichText) Render(ctx runtime.RenderContext)
- func (r *RichText) ScrollBy(dx, dy int)
- func (r *RichText) ScrollTo(x, y int)
- func (r *RichText) ScrollToAnchor(anchor string)
- func (r *RichText) ScrollToEnd()
- func (r *RichText) ScrollToStart()
- func (r *RichText) SetContent(content string)
- func (r *RichText) SetLabel(label string)
- func (r *RichText) SetLines(lines []markdown.StyledLine)
- func (r *RichText) SetRenderer(renderer *markdown.Renderer)
- func (r *RichText) SetShowScrollbar(show bool)
- func (r *RichText) SetSource(source string)
- func (r *RichText) SetStyle(style backend.Style)
- func (r *RichText) StyleType() string
- func (r *RichText) Unbind()
- type RichTextOption
- type ScrollView
- func (s *ScrollView) Bind(services runtime.Services)
- func (s *ScrollView) ChildWidgets() []runtime.Widget
- func (s *ScrollView) ContentSize() runtime.Size
- func (s *ScrollView) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (s *ScrollView) Layout(bounds runtime.Rect)
- func (s *ScrollView) Measure(constraints runtime.Constraints) runtime.Size
- func (s *ScrollView) PageBy(pages int)
- func (s *ScrollView) Render(ctx runtime.RenderContext)
- func (s *ScrollView) ScrollBy(dx, dy int)
- func (s *ScrollView) ScrollTo(x, y int)
- func (s *ScrollView) ScrollToEnd()
- func (s *ScrollView) ScrollToStart()
- func (s *ScrollView) SetBehavior(behavior scroll.ScrollBehavior)
- func (s *ScrollView) SetContent(content runtime.Widget)
- func (s *ScrollView) SetLabel(label string)
- func (s *ScrollView) SetStyle(style backend.Style)
- func (s *ScrollView) Unbind()
- type SearchWidget
- func (s *SearchWidget) Bind(services runtime.Services)
- func (s *SearchWidget) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (s *SearchWidget) Layout(bounds runtime.Rect)
- func (s *SearchWidget) Measure(constraints runtime.Constraints) runtime.Size
- func (s *SearchWidget) Query() string
- func (s *SearchWidget) Render(ctx runtime.RenderContext)
- func (s *SearchWidget) RenderHTML(ctx runtime.HTMLContext) runtime.HTML
- func (s *SearchWidget) SetLabel(label string)
- func (s *SearchWidget) SetMatchInfo(current, total int)
- func (s *SearchWidget) SetOnClose(fn func())
- func (s *SearchWidget) SetOnNavigate(next, prev func())
- func (s *SearchWidget) SetOnSearch(fn func(query string))
- func (s *SearchWidget) SetQuery(query string)
- func (s *SearchWidget) SetStyles(bg, border, text, match backend.Style)
- func (s *SearchWidget) StyleType() string
- func (s *SearchWidget) Unbind()
- type Searchable
- type Section
- func (s *Section) Bind(services runtime.Services)
- func (s *Section) ContentHeight() int
- func (s *Section) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (s *Section) IsExpanded() bool
- func (s *Section) Layout(bounds runtime.Rect)
- func (s *Section) Measure(constraints runtime.Constraints) runtime.Size
- func (s *Section) Render(ctx runtime.RenderContext)
- func (s *Section) SetExpanded(expanded bool)
- func (s *Section) SetIconStyle(style backend.Style)
- func (s *Section) SetItems(items []SectionItem)
- func (s *Section) SetMaxItems(max int)
- func (s *Section) SetStyles(header, item, active, completed, pending, activeIcon backend.Style)
- func (s *Section) SetTitle(title string)
- func (s *Section) StyleType() string
- func (s *Section) Toggle()
- func (s *Section) Unbind()
- type SectionItem
- type SegmentedControl
- func (s *SegmentedControl) Bind(services runtime.Services)
- func (s *SegmentedControl) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (s *SegmentedControl) Measure(constraints runtime.Constraints) runtime.Size
- func (s *SegmentedControl) Render(ctx runtime.RenderContext)
- func (s *SegmentedControl) Selected() int
- func (s *SegmentedControl) SetOnChange(fn func(index int, label string))
- func (s *SegmentedControl) SetSelected(index int)
- func (s *SegmentedControl) SetSelectedStyle(style backend.Style)
- func (s *SegmentedControl) SetStyle(style backend.Style)
- func (s *SegmentedControl) StyleType() string
- func (s *SegmentedControl) Unbind()
- type Select
- func (s *Select) Apply(opts ...SelectModeOption) *Select
- func (s *Select) Bind(services runtime.Services)
- func (s *Select) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (s *Select) Measure(constraints runtime.Constraints) runtime.Size
- func (s *Select) Render(ctx runtime.RenderContext)
- func (s *Select) Selected() int
- func (s *Select) SelectedOption() (SelectOption, bool)
- func (s *Select) SetFocusStyle(style backend.Style)
- func (s *Select) SetLabel(label string)
- func (s *Select) SetMode(mode SelectMode)
- func (s *Select) SetOnChange(fn func(option SelectOption))
- func (s *Select) SetSelected(index int)
- func (s *Select) SetStyle(style backend.Style)
- func (s *Select) StyleType() string
- func (s *Select) Unbind()
- type SelectMode
- type SelectModeOption
- type SelectOption
- type Selectable
- type Selection
- type Sidebar
- func (s *Sidebar) Bind(services runtime.Services)
- func (s *Sidebar) Expanded() bool
- func (s *Sidebar) GetItems() []SidebarItem
- func (s *Sidebar) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (s *Sidebar) Measure(constraints runtime.Constraints) runtime.Size
- func (s *Sidebar) PageBy(pages int)
- func (s *Sidebar) Render(ctx runtime.RenderContext)
- func (s *Sidebar) ScrollBy(dx, dy int)
- func (s *Sidebar) ScrollTo(x, y int)
- func (s *Sidebar) ScrollToEnd()
- func (s *Sidebar) ScrollToStart()
- func (s *Sidebar) Selected() int
- func (s *Sidebar) SelectedItem() *SidebarItem
- func (s *Sidebar) SetExpanded(expanded bool)
- func (s *Sidebar) SetItems(items ...SidebarItem)
- func (s *Sidebar) SetLabel(label string)
- func (s *Sidebar) SetSelectedStyle(style backend.Style)
- func (s *Sidebar) SetStyle(style backend.Style)
- func (s *Sidebar) SetWidth(w int)
- func (s *Sidebar) StyleType() string
- func (s *Sidebar) Unbind()
- func (s *Sidebar) Width() int
- type SidebarItem
- type SignalAdapter
- type SignalLabel
- func (s *SignalLabel) Bind(services runtime.Services)
- func (s *SignalLabel) Measure(constraints runtime.Constraints) runtime.Size
- func (s *SignalLabel) Mount()
- func (s *SignalLabel) Render(ctx runtime.RenderContext)
- func (s *SignalLabel) SetA11yLabel(label string)
- func (s *SignalLabel) SetAlignment(align Alignment)
- func (s *SignalLabel) SetStyle(style backend.Style)
- func (s *SignalLabel) StyleType() string
- func (s *SignalLabel) Text() string
- func (s *SignalLabel) Unbind()
- func (s *SignalLabel) Unmount()
- type SimpleWidget
- func (s *SimpleWidget) Bind(services runtime.Services)
- func (s *SimpleWidget) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (s *SimpleWidget) Layout(bounds runtime.Rect)
- func (s *SimpleWidget) Measure(constraints runtime.Constraints) runtime.Size
- func (s *SimpleWidget) Render(ctx runtime.RenderContext)
- func (s *SimpleWidget) RenderHTML(ctx runtime.HTMLContext) runtime.HTML
- func (s *SimpleWidget) Unbind()
- type Skeleton
- func (s *Skeleton) Frame() int
- func (s *Skeleton) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (s *Skeleton) IsAnimating() bool
- func (s *Skeleton) Measure(constraints runtime.Constraints) runtime.Size
- func (s *Skeleton) Render(ctx runtime.RenderContext)
- func (s *Skeleton) SetAnimate(animate bool)
- func (s *Skeleton) SetStyle(style backend.Style)
- func (s *Skeleton) StyleType() string
- type SkipNav
- func (s *SkipNav) Bind(services runtime.Services)
- func (s *SkipNav) FocusAffectsLayout() bool
- func (s *SkipNav) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (s *SkipNav) Label() string
- func (s *SkipNav) Measure(constraints runtime.Constraints) runtime.Size
- func (s *SkipNav) Render(ctx runtime.RenderContext)
- func (s *SkipNav) SetLabel(label string)
- func (s *SkipNav) SetStyle(style backend.Style)
- func (s *SkipNav) SetTarget(target runtime.Widget)
- func (s *SkipNav) StyleType() string
- func (s *SkipNav) Target() runtime.Widget
- func (s *SkipNav) Unbind()
- type SliceAdapter
- type SlideDirection
- type Slider
- func (s *Slider) Bind(services runtime.Services)
- func (s *Slider) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (s *Slider) Measure(constraints runtime.Constraints) runtime.Size
- func (s *Slider) Render(ctx runtime.RenderContext)
- func (s *Slider) SetLabel(label string)
- func (s *Slider) SetRange(min, max, step float64)
- func (s *Slider) SetStyles(base, track, thumb, fill backend.Style)
- func (s *Slider) SetValue(value float64)
- func (s *Slider) StyleType() string
- func (s *Slider) Unbind()
- func (s *Slider) Value() float64
- type SliderOption
- type SortDirection
- type Sparkline
- func (s *Sparkline) Bind(services runtime.Services)
- func (s *Sparkline) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (s *Sparkline) Measure(constraints runtime.Constraints) runtime.Size
- func (s *Sparkline) Render(ctx runtime.RenderContext)
- func (s *Sparkline) StyleType() string
- func (s *Sparkline) Unbind()
- type Spinner
- func (s *Spinner) Advance()
- func (s *Spinner) Bind(services runtime.Services)
- func (s *Spinner) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (s *Spinner) Measure(constraints runtime.Constraints) runtime.Size
- func (s *Spinner) Render(ctx runtime.RenderContext)
- func (s *Spinner) SetStyle(style backend.Style)
- func (s *Spinner) StyleType() string
- func (s *Spinner) Unbind()
- type Splitter
- func (s *Splitter) Bind(services runtime.Services)
- func (s *Splitter) ChildWidgets() []runtime.Widget
- func (s *Splitter) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (s *Splitter) Layout(bounds runtime.Rect)
- func (s *Splitter) Measure(constraints runtime.Constraints) runtime.Size
- func (s *Splitter) PathSegment(child runtime.Widget) string
- func (s *Splitter) Render(ctx runtime.RenderContext)
- func (s *Splitter) RenderHTML(ctx runtime.HTMLContext) runtime.HTML
- func (s *Splitter) SetLabel(label string)
- func (s *Splitter) Unbind()
- type SplitterOrientation
- type Stack
- func (s *Stack) Bind(services runtime.Services)
- func (s *Stack) ChildWidgets() []runtime.Widget
- func (s *Stack) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (s *Stack) Layout(bounds runtime.Rect)
- func (s *Stack) Measure(constraints runtime.Constraints) runtime.Size
- func (s *Stack) PathSegment(child runtime.Widget) string
- func (s *Stack) Render(ctx runtime.RenderContext)
- func (s *Stack) SetLabel(label string)
- func (s *Stack) Unbind()
- type StatusBar
- func (sb *StatusBar) AddItem(item StatusBarItem)
- func (sb *StatusBar) Bind(services runtime.Services)
- func (sb *StatusBar) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (sb *StatusBar) Items() []StatusBarItem
- func (sb *StatusBar) Layout(bounds runtime.Rect)
- func (sb *StatusBar) Measure(constraints runtime.Constraints) runtime.Size
- func (sb *StatusBar) RemoveItem(key string)
- func (sb *StatusBar) Render(ctx runtime.RenderContext)
- func (sb *StatusBar) Selected() int
- func (sb *StatusBar) SetBackground(style backend.Style)
- func (sb *StatusBar) SetItemVisible(key string, visible bool)
- func (sb *StatusBar) StyleType() string
- func (sb *StatusBar) Unbind()
- func (sb *StatusBar) UpdateItem(key string, text string)
- type StatusBarAlignment
- type StatusBarItem
- type Step
- type StepState
- type Stepper
- func (s *Stepper) Bind(services runtime.Services)
- func (s *Stepper) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (s *Stepper) Measure(constraints runtime.Constraints) runtime.Size
- func (s *Stepper) Render(ctx runtime.RenderContext)
- func (s *Stepper) SetStyle(style backend.Style)
- func (s *Stepper) StyleType() string
- func (s *Stepper) Unbind()
- type Tab
- type Table
- func (t *Table) Bind(services runtime.Services)
- func (t *Table) CancelEdit()
- func (t *Table) ClearFilter()
- func (t *Table) ColumnCount() int
- func (t *Table) CommitEdit()
- func (t *Table) DataSource() TabularDataSource
- func (t *Table) EditBuffer() string
- func (t *Table) EditCol() int
- func (t *Table) EditCursorPos() int
- func (t *Table) EditRow() int
- func (t *Table) Editing() bool
- func (t *Table) GetCell(row, col int) string
- func (t *Table) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (t *Table) Measure(constraints runtime.Constraints) runtime.Size
- func (t *Table) PageBy(pages int)
- func (t *Table) Render(ctx runtime.RenderContext)
- func (t *Table) RowCount() int
- func (t *Table) ScrollBy(dx, dy int)
- func (t *Table) ScrollTo(x, y int)
- func (t *Table) ScrollToEnd()
- func (t *Table) ScrollToStart()
- func (t *Table) SelectedCol() int
- func (t *Table) SelectedIndex() int
- func (t *Table) SelectedRow() []string
- func (t *Table) SetCell(row, col int, value string)
- func (t *Table) SetDataSource(source TabularDataSource)
- func (t *Table) SetFilter(fn func(row []string) bool)
- func (t *Table) SetHeaderStyle(style backend.Style)
- func (t *Table) SetLabel(label string)
- func (t *Table) SetOnCellEdit(fn func(row, col int, oldValue, newValue string))
- func (t *Table) SetRows(rows [][]string)
- func (t *Table) SetSelected(index int)
- func (t *Table) SetSelectedCol(col int)
- func (t *Table) SetSelectedStyle(style backend.Style)
- func (t *Table) SetSortColumn(col int, dir SortDirection)
- func (t *Table) SetStyle(style backend.Style)
- func (t *Table) SetVirtualOverscan(count int)
- func (t *Table) SetVirtualScroll(enabled bool)
- func (t *Table) Sort() TableSortState
- func (t *Table) StartEdit()
- func (t *Table) StyleType() string
- func (t *Table) Unbind()
- func (t *Table) VirtualScroll() bool
- func (t *Table) VisibleRange() (start, end int)
- type TableColumn
- type TableSortState
- type Tabs
- func (t *Tabs) Bind(services runtime.Services)
- func (t *Tabs) ChildWidgets() []runtime.Widget
- func (t *Tabs) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (t *Tabs) Layout(bounds runtime.Rect)
- func (t *Tabs) Measure(constraints runtime.Constraints) runtime.Size
- func (t *Tabs) Mount()
- func (t *Tabs) PathSegment(child runtime.Widget) string
- func (t *Tabs) Render(ctx runtime.RenderContext)
- func (t *Tabs) SelectedIndex() int
- func (t *Tabs) SetLabel(label string)
- func (t *Tabs) SetSelected(index int)
- func (t *Tabs) SetSelectedStyle(style backend.Style)
- func (t *Tabs) SetStyle(style backend.Style)
- func (t *Tabs) StyleType() string
- func (t *Tabs) Unbind()
- func (t *Tabs) Unmount()
- type TabularDataSource
- type TabularEditable
- type TabularRowProvider
- type TagInput
- func (t *TagInput) AddTag(tag string) bool
- func (t *TagInput) Bind(services runtime.Services)
- func (t *TagInput) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (t *TagInput) InputBuffer() string
- func (t *TagInput) Measure(constraints runtime.Constraints) runtime.Size
- func (t *TagInput) RemoveTag(tag string) bool
- func (t *TagInput) Render(ctx runtime.RenderContext)
- func (t *TagInput) SetMaxTags(max int)
- func (t *TagInput) SetOnChange(fn func(tags []string))
- func (t *TagInput) SetStyle(style backend.Style)
- func (t *TagInput) SetTags(tags []string)
- func (t *TagInput) StyleType() string
- func (t *TagInput) Tags() []string
- func (t *TagInput) Unbind()
- type Text
- func (t *Text) Bind(services runtime.Services)
- func (t *Text) Direction() i18n.Direction
- func (t *Text) Measure(constraints runtime.Constraints) runtime.Size
- func (t *Text) Render(ctx runtime.RenderContext)
- func (t *Text) SetA11yLabel(label string)
- func (t *Text) SetDirection(dir i18n.Direction)
- func (t *Text) SetStyle(style backend.Style)
- func (t *Text) SetText(text string)
- func (t *Text) StyleType() string
- func (t *Text) Text() string
- func (t *Text) Unbind()
- func (t *Text) WithStyle(style backend.Style) *Textdeprecated
- type TextArea
- func (t *TextArea) Bind(services runtime.Services)
- func (t *TextArea) Blur()
- func (t *TextArea) CanRedo() bool
- func (t *TextArea) CanUndo() bool
- func (t *TextArea) ClearHighlights()
- func (t *TextArea) ClearHistory()
- func (t *TextArea) ClipboardCopy() (string, bool)
- func (t *TextArea) ClipboardCut() (string, bool)
- func (t *TextArea) ClipboardPaste(text string) bool
- func (t *TextArea) CursorOffset() int
- func (t *TextArea) CursorPosition() (x, y int)
- func (t *TextArea) CursorWordLeft()
- func (t *TextArea) CursorWordRight()
- func (t *TextArea) Errors() []string
- func (t *TextArea) GetSelectedText() string
- func (t *TextArea) GetSelection() Selection
- func (t *TextArea) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (t *TextArea) HasSelection() bool
- func (t *TextArea) Measure(constraints runtime.Constraints) runtime.Size
- func (t *TextArea) OnChange(fn func(text string))deprecated
- func (t *TextArea) Redo() bool
- func (t *TextArea) Render(ctx runtime.RenderContext)
- func (t *TextArea) SelectAll()
- func (t *TextArea) SelectLine()
- func (t *TextArea) SelectNone()
- func (t *TextArea) SelectWord()
- func (t *TextArea) SetCursorOffset(offset int)
- func (t *TextArea) SetCursorPosition(x, y int)
- func (t *TextArea) SetFocusStyle(style backend.Style)
- func (t *TextArea) SetGutterStyle(style backend.Style)
- func (t *TextArea) SetHighlights(highlights []TextAreaHighlight)
- func (t *TextArea) SetLabel(label string)
- func (t *TextArea) SetOnChange(fn func(text string))
- func (t *TextArea) SetSelection(sel Selection)
- func (t *TextArea) SetShowLineNumbers(show bool)
- func (t *TextArea) SetStyle(style backend.Style)
- func (t *TextArea) SetTabMode(useTabs bool)
- func (t *TextArea) SetTabSize(n int)
- func (t *TextArea) SetText(text string)
- func (t *TextArea) SetValidators(validators ...forms.Validator)
- func (t *TextArea) SetVisibleLines(lines []int)
- func (t *TextArea) SetWordWrap(enabled bool)
- func (t *TextArea) StyleType() string
- func (t *TextArea) Text() string
- func (t *TextArea) Unbind()
- func (t *TextArea) Undo() bool
- func (t *TextArea) Valid() bool
- func (t *TextArea) Validate() []forms.ValidationError
- func (t *TextArea) VisibleLines() []int
- func (t *TextArea) WordWrap() bool
- type TextAreaHighlight
- type TextOption
- type TimePicker
- func (t *TimePicker) Bind(services runtime.Services)
- func (t *TimePicker) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (t *TimePicker) Measure(constraints runtime.Constraints) runtime.Size
- func (t *TimePicker) Render(ctx runtime.RenderContext)
- func (t *TimePicker) SetLabel(label string)
- func (t *TimePicker) SetOnChange(fn func(time.Time))
- func (t *TimePicker) SetOnSubmit(fn func(time.Time))
- func (t *TimePicker) SetShowSeconds(show bool)
- func (t *TimePicker) SetTime(value time.Time)
- func (t *TimePicker) StyleType() string
- func (t *TimePicker) Time() time.Time
- func (t *TimePicker) Unbind()
- type ToastStack
- func (t *ToastStack) Bind(services runtime.Services)
- func (t *ToastStack) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (t *ToastStack) HasActiveAnimations(now time.Time) bool
- func (t *ToastStack) Measure(constraints runtime.Constraints) runtime.Size
- func (t *ToastStack) Render(ctx runtime.RenderContext)
- func (t *ToastStack) SetAnimationsEnabled(enabled bool)
- func (t *ToastStack) SetLabel(label string)
- func (t *ToastStack) SetNow(now time.Time)
- func (t *ToastStack) SetOnDismiss(fn func(id string))
- func (t *ToastStack) SetStyles(bg, text, info, success, warn, err backend.Style)
- func (t *ToastStack) SetToasts(toasts []*toast.Toast)
- func (t *ToastStack) StyleType() string
- func (t *ToastStack) ToastAt(x, y int) (*toast.Toast, bool)
- func (t *ToastStack) Unbind()
- type Toggle
- func (t *Toggle) Bind(services runtime.Services)
- func (t *Toggle) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (t *Toggle) Label() string
- func (t *Toggle) Measure(constraints runtime.Constraints) runtime.Size
- func (t *Toggle) On() bool
- func (t *Toggle) Render(ctx runtime.RenderContext)
- func (t *Toggle) SetOn(value bool)
- func (t *Toggle) SetStyle(style backend.Style)
- func (t *Toggle) StyleType() string
- func (t *Toggle) Unbind()
- type ToggleOption
- type Tooltip
- func (t *Tooltip) Bind(services runtime.Services)
- func (t *Tooltip) ChildWidgets() []runtime.Widget
- func (t *Tooltip) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (t *Tooltip) HitSelf() bool
- func (t *Tooltip) Layout(bounds runtime.Rect)
- func (t *Tooltip) Measure(constraints runtime.Constraints) runtime.Size
- func (t *Tooltip) Render(ctx runtime.RenderContext)
- func (t *Tooltip) Unbind()
- type TooltipOption
- type TooltipTrigger
- type TrackGridBuilder
- func (b *TrackGridBuilder) Add(w runtime.Widget, row, col int) *TrackGridBuilder
- func (b *TrackGridBuilder) AddSpan(w runtime.Widget, row, col, rowSpan, colSpan int) *TrackGridBuilder
- func (b *TrackGridBuilder) Build() *Grid
- func (b *TrackGridBuilder) Columns(cols ...TrackSize) *TrackGridBuilder
- func (b *TrackGridBuilder) GapSize(gap int) *TrackGridBuilder
- func (b *TrackGridBuilder) Rows(rows ...TrackSize) *TrackGridBuilder
- type TrackSize
- type TrackSizeMode
- type Tree
- func (t *Tree) Bind(services runtime.Services)
- func (t *Tree) CanDrop(data runtime.DragData) bool
- func (t *Tree) DeselectAll()
- func (t *Tree) DeselectNode(path string)
- func (t *Tree) DragOrigin() int
- func (t *Tree) DropIndex() int
- func (t *Tree) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (t *Tree) IsDraggable() bool
- func (t *Tree) IsDragging() bool
- func (t *Tree) Measure(constraints runtime.Constraints) runtime.Size
- func (t *Tree) MultiSelect() bool
- func (t *Tree) OnDrop(data runtime.DragData) bool
- func (t *Tree) PageBy(pages int)
- func (t *Tree) Render(ctx runtime.RenderContext)
- func (t *Tree) ScrollBy(dx, dy int)
- func (t *Tree) ScrollTo(x, y int)
- func (t *Tree) ScrollToEnd()
- func (t *Tree) ScrollToStart()
- func (t *Tree) SelectAll()
- func (t *Tree) SelectNode(path string)
- func (t *Tree) SelectedNodes() []string
- func (t *Tree) SetDragStyle(style backend.Style)
- func (t *Tree) SetDraggable(enabled bool)
- func (t *Tree) SetLabel(label string)
- func (t *Tree) SetMultiSelect(enabled bool)
- func (t *Tree) SetOnNodeDrop(fn func(sourcePaths []string, targetPath string))
- func (t *Tree) SetRoot(root *TreeNode)
- func (t *Tree) SetSelectedStyle(style backend.Style)
- func (t *Tree) SetStyle(style backend.Style)
- func (t *Tree) SetVirtualOverscan(count int)
- func (t *Tree) SetVirtualScroll(enabled bool)
- func (t *Tree) StyleType() string
- func (t *Tree) Unbind()
- func (t *Tree) VirtualScroll() bool
- func (t *Tree) VisibleRange() (start, end int)
- type TreeNode
- type Validatable
- type Variant
- type VideoPlayer
- func (v *VideoPlayer) DroppedFrames() int64
- func (v *VideoPlayer) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (v *VideoPlayer) IsPlaying() bool
- func (v *VideoPlayer) Layout(bounds runtime.Rect)
- func (v *VideoPlayer) Measure(constraints runtime.Constraints) runtime.Size
- func (v *VideoPlayer) Pause()
- func (v *VideoPlayer) Play()
- func (v *VideoPlayer) Render(ctx runtime.RenderContext)
- func (v *VideoPlayer) Seek(pos time.Duration)
- func (v *VideoPlayer) SetBlitter(blitter graphics.Blitter)
- func (v *VideoPlayer) SetOnEnd(fn func())
- func (v *VideoPlayer) StyleType() string
- func (v *VideoPlayer) WithBlitter(blitter graphics.Blitter) *VideoPlayerdeprecated
- type VideoPlayerOption
- type VirtualList
- func (v *VirtualList[T]) Bind(services runtime.Services)
- func (v *VirtualList[T]) HandleMessage(msg runtime.Message) runtime.HandleResult
- func (v *VirtualList[T]) Layout(bounds runtime.Rect)
- func (v *VirtualList[T]) Measure(constraints runtime.Constraints) runtime.Size
- func (v *VirtualList[T]) Offset() int
- func (v *VirtualList[T]) OnSelect(fn func(index int, item T))deprecated
- func (v *VirtualList[T]) PageBy(pages int)
- func (v *VirtualList[T]) Render(ctx runtime.RenderContext)
- func (v *VirtualList[T]) ScrollBy(dx, dy int)
- func (v *VirtualList[T]) ScrollTo(x, y int)
- func (v *VirtualList[T]) ScrollToEnd()
- func (v *VirtualList[T]) ScrollToIndex(index int)
- func (v *VirtualList[T]) ScrollToOffset(offset int)
- func (v *VirtualList[T]) ScrollToStart()
- func (v *VirtualList[T]) SelectedIndex() int
- func (v *VirtualList[T]) SelectedItem() (T, bool)
- func (v *VirtualList[T]) SetAdapter(adapter VirtualListAdapter[T])
- func (v *VirtualList[T]) SetBehavior(behavior scroll.ScrollBehavior)
- func (v *VirtualList[T]) SetItemHeight(height int)
- func (v *VirtualList[T]) SetItemHeightFunc(fn func(index int) int)
- func (v *VirtualList[T]) SetLabel(label string)
- func (v *VirtualList[T]) SetLazyLoad(fn func(start, end, total int))
- func (v *VirtualList[T]) SetLazyLoadThreshold(threshold int)
- func (v *VirtualList[T]) SetOnSelect(fn func(index int, item T))
- func (v *VirtualList[T]) SetOverscan(count int)
- func (v *VirtualList[T]) SetSelected(index int)
- func (v *VirtualList[T]) SetSelectedStyle(style backend.Style)
- func (v *VirtualList[T]) SetStyle(style backend.Style)
- func (v *VirtualList[T]) SetWidgetPoolMax(max int)
- func (v *VirtualList[T]) StyleType() string
- func (v *VirtualList[T]) Unbind()
- func (v *VirtualList[T]) UseAdapterHeights()
- type VirtualListAdapter
- type VirtualListFixedHeightProvider
- type VirtualListHeightProvider
- type VirtualListWidgetFactory
- type VirtualListWidgetResetter
- type WidgetPlugin
Examples ¶
Constants ¶
const ( FlexColumn = runtime.Column FlexRow = runtime.Row )
FlexDirection constants.
Variables ¶
This section is empty.
Functions ¶
func DrawGauge ¶
func DrawGauge(buf *runtime.Buffer, x, y, width int, ratio float64, style GaugeStyle)
DrawGauge renders a horizontal gauge bar with gradient fill. ratio: 0.0-1.0 fill percentage width: total width in characters Returns the rendered gauge string and styles for each character.
func DrawGaugeString ¶
func DrawGaugeString(width int, ratio float64, style GaugeStyle) string
DrawGaugeString renders a gauge and returns it as a string (for inline use).
func FlexFixedSpace ¶
func MustRegisterWidgetPlugin ¶
func MustRegisterWidgetPlugin(plugin WidgetPlugin)
MustRegisterWidgetPlugin registers a plugin or panics.
func RegisterWidgetPlugin ¶
func RegisterWidgetPlugin(plugin WidgetPlugin) error
RegisterWidgetPlugin registers a plugin globally.
Types ¶
type Accordion ¶
type Accordion struct {
FocusableBase
// contains filtered or unexported fields
}
Accordion groups collapsible sections.
func NewAccordion ¶
func NewAccordion(sections ...*AccordionSection) *Accordion
NewAccordion creates an accordion.
func (*Accordion) AddSection ¶
func (a *Accordion) AddSection(section *AccordionSection)
AddSection appends a section.
func (*Accordion) ChildWidgets ¶
ChildWidgets returns section content widgets.
func (*Accordion) HandleMessage ¶
func (a *Accordion) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage handles navigation and toggling.
func (*Accordion) Measure ¶
func (a *Accordion) Measure(constraints runtime.Constraints) runtime.Size
Measure returns desired size.
func (*Accordion) PathSegment ¶
PathSegment returns a debug path segment for the given child.
func (*Accordion) Render ¶
func (a *Accordion) Render(ctx runtime.RenderContext)
Render draws headers and visible content.
func (*Accordion) SetAllowMultiple ¶
SetAllowMultiple toggles multiple expansion.
func (*Accordion) SetSections ¶
func (a *Accordion) SetSections(sections ...*AccordionSection)
SetSections updates accordion sections.
func (*Accordion) SetSelected ¶
SetSelected moves selection to the provided index.
func (*Accordion) ToggleSection ¶
ToggleSection toggles a section by index.
type AccordionOption ¶
AccordionOption configures an accordion.
type AccordionSection ¶
type AccordionSection struct {
// contains filtered or unexported fields
}
AccordionSection is a single collapsible section.
func NewAccordionSection ¶
func NewAccordionSection(title string, content runtime.Widget, opts ...AccordionSectionOption) *AccordionSection
NewAccordionSection creates a section.
func (*AccordionSection) Content ¶
func (s *AccordionSection) Content() runtime.Widget
Content returns the section content widget.
func (*AccordionSection) Disabled ¶
func (s *AccordionSection) Disabled() bool
Disabled reports whether the section is disabled.
func (*AccordionSection) Expanded ¶
func (s *AccordionSection) Expanded() bool
Expanded reports whether the section is expanded.
func (*AccordionSection) SetContent ¶
func (s *AccordionSection) SetContent(content runtime.Widget)
SetContent updates the section content widget.
func (*AccordionSection) SetDisabled ¶
func (s *AccordionSection) SetDisabled(disabled bool)
SetDisabled updates the disabled state.
func (*AccordionSection) SetExpanded ¶
func (s *AccordionSection) SetExpanded(expanded bool)
SetExpanded updates the expanded state.
func (*AccordionSection) SetTitle ¶
func (s *AccordionSection) SetTitle(title string)
SetTitle updates the section title.
func (*AccordionSection) Title ¶
func (s *AccordionSection) Title() string
Title returns the section title.
type AccordionSectionOption ¶
type AccordionSectionOption = Option[AccordionSection]
AccordionSectionOption configures a section.
func WithSectionAnimation ¶
func WithSectionAnimation(duration time.Duration, easing animation.EasingFunc) AccordionSectionOption
WithSectionAnimation sets animation configuration.
func WithSectionDisabled ¶
func WithSectionDisabled(disabled bool) AccordionSectionOption
WithSectionDisabled sets initial disabled state.
func WithSectionExpanded ¶
func WithSectionExpanded(expanded bool) AccordionSectionOption
WithSectionExpanded sets initial expanded state.
type Alert ¶
type Alert struct {
Base
Variant AlertVariant
Text string
// contains filtered or unexported fields
}
Alert renders an inline message.
Example ¶
package main
import (
"m31labs.dev/fluffyui/widgets"
)
func main() {
alert := widgets.NewAlert("All systems nominal", widgets.AlertSuccess)
_ = alert
}
Output:
func (*Alert) HandleMessage ¶
func (a *Alert) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage returns unhandled.
func (*Alert) Measure ¶
func (a *Alert) Measure(constraints runtime.Constraints) runtime.Size
Measure returns desired size.
func (*Alert) StyleClasses ¶
StyleClasses returns selector classes including the variant.
type AlertVariant ¶
type AlertVariant string
AlertVariant describes alert styling.
const ( AlertInfo AlertVariant = "info" AlertSuccess AlertVariant = "success" AlertWarning AlertVariant = "warning" AlertError AlertVariant = "error" )
type AnimatedGauge ¶
type AnimatedGauge struct {
CanvasWidget
// contains filtered or unexported fields
}
AnimatedGauge renders a radial gauge with spring animation.
func NewAnimatedGauge ¶
func NewAnimatedGauge(minValue, maxValue float64) *AnimatedGauge
NewAnimatedGauge creates a new animated gauge.
func (*AnimatedGauge) Bind ¶
func (g *AnimatedGauge) Bind(services runtime.Services)
Bind attaches services and registers the spring.
func (*AnimatedGauge) SetValue ¶
func (g *AnimatedGauge) SetValue(value float64)
SetValue updates the gauge target value. When reduced motion is enabled, the gauge snaps to the target immediately without spring animation.
func (*AnimatedGauge) StyleType ¶
func (g *AnimatedGauge) StyleType() string
StyleType returns the selector type name.
type AnimatedWidget ¶
type AnimatedWidget struct {
Component
Opacity animation.Float64
OffsetX animation.Float64
OffsetY animation.Float64
Scale animation.Float64
}
AnimatedWidget is a base for widgets with animation support.
func NewAnimatedWidget ¶
func NewAnimatedWidget() AnimatedWidget
NewAnimatedWidget creates an AnimatedWidget with defaults.
func (*AnimatedWidget) Animate ¶
func (w *AnimatedWidget) Animate(property string, endValue animation.Animatable, cfg animation.TweenConfig)
Animate starts a property animation.
func (*AnimatedWidget) FadeIn ¶
func (w *AnimatedWidget) FadeIn(duration time.Duration)
FadeIn animates opacity from 0 to 1.
func (*AnimatedWidget) FadeOut ¶
func (w *AnimatedWidget) FadeOut(duration time.Duration, onComplete func())
FadeOut animates opacity to 0.
func (*AnimatedWidget) SlideIn ¶
func (w *AnimatedWidget) SlideIn(from SlideDirection, distance int, duration time.Duration)
SlideIn animates the widget into place from a direction.
type AspectRatio ¶
type AspectRatio struct {
Base
// contains filtered or unexported fields
}
AspectRatio constrains a child to a fixed width/height ratio.
func NewAspectRatio ¶
func NewAspectRatio(child runtime.Widget, ratio float64) *AspectRatio
NewAspectRatio creates an aspect ratio container.
func (*AspectRatio) Bind ¶
func (a *AspectRatio) Bind(services runtime.Services)
Bind attaches app services.
func (*AspectRatio) ChildWidgets ¶
func (a *AspectRatio) ChildWidgets() []runtime.Widget
ChildWidgets returns the child widget.
func (*AspectRatio) HandleMessage ¶
func (a *AspectRatio) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage forwards messages to the child.
func (*AspectRatio) Layout ¶
func (a *AspectRatio) Layout(bounds runtime.Rect)
Layout assigns bounds and centers the child within the ratio box.
func (*AspectRatio) Measure ¶
func (a *AspectRatio) Measure(constraints runtime.Constraints) runtime.Size
Measure returns the constrained size preserving the ratio.
func (*AspectRatio) Render ¶
func (a *AspectRatio) Render(ctx runtime.RenderContext)
Render draws the child.
func (*AspectRatio) SetLabel ¶
func (a *AspectRatio) SetLabel(label string)
SetLabel updates the accessibility label.
func (*AspectRatio) SetRatio ¶
func (a *AspectRatio) SetRatio(ratio float64)
SetRatio updates the aspect ratio (width / height).
type AsyncImage ¶
type AsyncImage struct {
Component
// contains filtered or unexported fields
}
AsyncImage loads an image asynchronously and renders it when ready.
func NewAsyncImage ¶
func NewAsyncImage(path string, opts ...AsyncImageOption) *AsyncImage
NewAsyncImage loads an image from disk asynchronously.
func NewAsyncImageWithLoader ¶
func NewAsyncImageWithLoader(loader func() (image.Image, error), opts ...AsyncImageOption) *AsyncImage
NewAsyncImageWithLoader loads an image using a custom loader.
func (*AsyncImage) Bind ¶
func (w *AsyncImage) Bind(services runtime.Services)
Bind attaches services and starts loading.
func (*AsyncImage) Error ¶
func (w *AsyncImage) Error() error
Error returns the last load error, if any.
func (*AsyncImage) Layout ¶
func (w *AsyncImage) Layout(bounds runtime.Rect)
Layout updates layout bounds and placeholder layout.
func (*AsyncImage) Measure ¶
func (w *AsyncImage) Measure(constraints runtime.Constraints) runtime.Size
Measure returns desired size for the image.
func (*AsyncImage) Render ¶
func (w *AsyncImage) Render(ctx runtime.RenderContext)
Render draws the image or placeholder.
type AsyncImageOption ¶
type AsyncImageOption = Option[AsyncImage]
AsyncImageOption configures an async image widget.
func WithAsyncImageBlitter ¶
func WithAsyncImageBlitter(blitter graphics.Blitter) AsyncImageOption
WithAsyncImageBlitter overrides the blitter used for rendering.
func WithAsyncImageCenter ¶
func WithAsyncImageCenter(enabled bool) AsyncImageOption
WithAsyncImageCenter toggles centering within the widget bounds.
func WithAsyncImagePlaceholder ¶
func WithAsyncImagePlaceholder(widget runtime.Widget) AsyncImageOption
WithAsyncImagePlaceholder sets a placeholder widget for loading/error states.
func WithAsyncImageScaleMode ¶
func WithAsyncImageScaleMode(mode graphics.ScaleMode) AsyncImageOption
WithAsyncImageScaleMode sets the scaling interpolation mode.
func WithAsyncImageScaleToFit ¶
func WithAsyncImageScaleToFit(enabled bool) AsyncImageOption
WithAsyncImageScaleToFit toggles scaling to fit the widget bounds.
type AutoComplete ¶
type AutoComplete struct {
FocusableBase
// contains filtered or unexported fields
}
AutoComplete provides an input with suggestion list.
func NewAutoComplete ¶
func NewAutoComplete() *AutoComplete
NewAutoComplete creates a new AutoComplete widget.
func (*AutoComplete) Bind ¶
func (a *AutoComplete) Bind(services runtime.Services)
Bind attaches app services.
func (*AutoComplete) ChildWidgets ¶
func (a *AutoComplete) ChildWidgets() []runtime.Widget
ChildWidgets returns child widgets.
func (*AutoComplete) HandleMessage ¶
func (a *AutoComplete) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage processes keyboard input.
func (*AutoComplete) Input ¶
func (a *AutoComplete) Input() *Input
Input returns the underlying input widget.
func (*AutoComplete) Layout ¶
func (a *AutoComplete) Layout(bounds runtime.Rect)
Layout positions input and suggestion list.
func (*AutoComplete) Measure ¶
func (a *AutoComplete) Measure(constraints runtime.Constraints) runtime.Size
Measure returns desired size.
func (*AutoComplete) Query ¶
func (a *AutoComplete) Query() string
Query returns the current query text.
func (*AutoComplete) Render ¶
func (a *AutoComplete) Render(ctx runtime.RenderContext)
Render draws the input and suggestions.
func (*AutoComplete) SetLabel ¶
func (a *AutoComplete) SetLabel(label string)
SetLabel updates the accessibility label.
func (*AutoComplete) SetMaxSuggestions ¶
func (a *AutoComplete) SetMaxSuggestions(limit int)
SetMaxSuggestions limits the number of suggestions shown.
func (*AutoComplete) SetOnSelect ¶
func (a *AutoComplete) SetOnSelect(fn func(value string))
SetOnSelect registers a selection callback.
func (*AutoComplete) SetOptions ¶
func (a *AutoComplete) SetOptions(options []string)
SetOptions sets the candidate options for filtering.
func (*AutoComplete) SetProvider ¶
func (a *AutoComplete) SetProvider(fn func(query string) []string)
SetProvider sets a custom suggestion provider.
func (*AutoComplete) SetQuery ¶
func (a *AutoComplete) SetQuery(query string)
SetQuery updates the query text and refreshes suggestions.
func (*AutoComplete) StyleType ¶
func (a *AutoComplete) StyleType() string
StyleType returns the selector type name.
type Avatar ¶
type Avatar struct {
Base
// contains filtered or unexported fields
}
Avatar displays user initials or a placeholder character in a styled block. The background color is deterministically derived from the name.
func NewAvatar ¶
func NewAvatar(name string, opts ...AvatarOption) *Avatar
NewAvatar creates an avatar widget for the given name.
func (*Avatar) HandleMessage ¶
func (a *Avatar) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage returns unhandled (non-interactive widget).
func (*Avatar) Measure ¶
func (a *Avatar) Measure(constraints runtime.Constraints) runtime.Size
Measure returns the desired size.
type AvatarOption ¶
AvatarOption configures an Avatar widget.
func WithAvatarInitials ¶
func WithAvatarInitials(initials string) AvatarOption
WithAvatarInitials overrides the computed initials.
func WithAvatarSize ¶
func WithAvatarSize(size AvatarSize) AvatarOption
WithAvatarSize sets the display size.
type AvatarSize ¶
type AvatarSize int
AvatarSize controls the avatar display dimensions.
const ( // AvatarSmall renders as 3 wide x 1 tall. AvatarSmall AvatarSize = iota // AvatarMedium renders as 5 wide x 3 tall (with border). AvatarMedium // AvatarLarge renders as 7 wide x 3 tall (with border). AvatarLarge )
type Badge ¶
type Badge struct {
Base
// contains filtered or unexported fields
}
Badge is a non-focusable colored label widget. It displays a short text like a status indicator or count.
func (*Badge) HandleMessage ¶
func (b *Badge) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage returns unhandled (non-interactive widget).
func (*Badge) Measure ¶
func (b *Badge) Measure(constraints runtime.Constraints) runtime.Size
Measure returns the desired size.
type BarChart ¶
type BarChart struct {
Base
Data *state.Signal[[]BarData]
ShowValues bool
ShowLabels bool
Style backend.Style
// contains filtered or unexported fields
}
BarChart renders horizontal bars.
Example ¶
package main
import (
"m31labs.dev/fluffyui/state"
"m31labs.dev/fluffyui/widgets"
)
func main() {
data := state.NewSignal([]widgets.BarData{
{Label: "alpha", Value: 42},
{Label: "beta", Value: 27},
})
chart := widgets.NewBarChart(data)
_ = chart
}
Output:
func NewBarChart ¶
NewBarChart creates a bar chart.
func (*BarChart) HandleMessage ¶
func (b *BarChart) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage returns unhandled.
func (*BarChart) Measure ¶
func (b *BarChart) Measure(constraints runtime.Constraints) runtime.Size
Measure returns desired size.
func (*BarChart) Render ¶
func (b *BarChart) Render(ctx runtime.RenderContext)
Render draws the bars.
type Base ¶
type Base struct {
accessibility.Base
// contains filtered or unexported fields
}
Base provides common functionality for widgets. Base should be embedded in widget structs to get default implementations.
func (*Base) AddClasses ¶
AddClasses adds multiple classes.
func (*Base) ApplyStyle ¶
ApplyStyle stores the resolved style for layout.
func (*Base) Bind ¶
Bind implements runtime.Bindable for Base. Widgets that define their own Bind will shadow this; the onMount hook is separately invoked by OnMountHook which BindTree calls after Bind.
func (*Base) ClearInvalidation ¶
func (b *Base) ClearInvalidation()
ClearInvalidation clears the render-needed flag.
func (*Base) ContentBounds ¶
ContentBounds returns the widget's content bounds.
func (*Base) HandleMessage ¶
func (b *Base) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage returns Unhandled by default.
func (*Base) Invalidate ¶
func (b *Base) Invalidate()
Invalidate marks the widget as needing a render pass.
func (*Base) LayoutStyle ¶
LayoutStyle returns the resolved style used for layout.
func (*Base) NeedsRender ¶
NeedsRender reports whether the widget needs to re-render.
func (*Base) OnMount ¶
func (b *Base) OnMount(fn func())
OnMount registers a callback that fires when the widget is bound (mounted into a screen). If the widget type defines its own Bind method, call b.Base.Bind(services) to trigger the hook.
func (*Base) OnMountHook ¶
func (b *Base) OnMountHook()
OnMountHook implements runtime.MountHook. It invokes the onMount callback if one has been registered via OnMount. BindTree calls this automatically after Bind, so hooks fire even if a widget has its own Bind method.
func (*Base) OnUnmount ¶
func (b *Base) OnUnmount(fn func())
OnUnmount registers a callback that fires when the widget is unbound (removed from a screen). If the widget type defines its own Unbind method, call b.Base.Unbind() to trigger the hook.
func (*Base) OnUnmountHook ¶
func (b *Base) OnUnmountHook()
OnUnmountHook implements runtime.UnmountHook. It invokes the onUnmount callback if one has been registered via OnUnmount. UnbindTree calls this automatically before Unbind.
func (*Base) SetClasses ¶
SetClasses replaces the widget classes.
func (*Base) SetHovered ¶
SetHovered sets the hover state of the widget.
func (*Base) StyleClasses ¶
StyleClasses returns the style selector classes.
func (*Base) StyleState ¶
func (b *Base) StyleState() style.WidgetState
StyleState returns the default widget style state.
type Box ¶
type Box struct {
Base
// contains filtered or unexported fields
}
Box is a simple container that fills its background.
Example ¶
package main
import (
"m31labs.dev/fluffyui/backend"
"m31labs.dev/fluffyui/widgets"
)
func main() {
box := widgets.NewBox(widgets.NewLabel("Status"))
box.SetStyle(backend.DefaultStyle().Reverse(true))
_ = box
}
Output:
func (*Box) ChildWidgets ¶
ChildWidgets returns the box's child widget.
func (*Box) HandleMessage ¶
func (b *Box) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage delegates to child.
func (*Box) Measure ¶
func (b *Box) Measure(constraints runtime.Constraints) runtime.Size
Measure returns the child's size.
func (*Box) Render ¶
func (b *Box) Render(ctx runtime.RenderContext)
Render draws the background and child.
type BoxOption ¶
BoxOption configures a Box widget.
func WithBoxStyle ¶
WithBoxStyle sets the box background style.
type Breadcrumb ¶
type Breadcrumb struct {
FocusableBase
Items []BreadcrumbItem
// contains filtered or unexported fields
}
Breadcrumb renders a path of items with optional collapsing.
When the items exceed the available width, the breadcrumb automatically collapses middle items into an ellipsis ("..."), keeping the first item and the last N visible items (controlled by SetCollapseKeep, default 2). The collapse threshold can be configured with SetCollapseThreshold (minimum item count before collapsing, default 4).
Example ¶
package main
import (
"m31labs.dev/fluffyui/widgets"
)
func main() {
breadcrumb := widgets.NewBreadcrumb(
widgets.BreadcrumbItem{Label: "home"},
widgets.BreadcrumbItem{Label: "docs"},
widgets.BreadcrumbItem{Label: "readme.md"},
)
_ = breadcrumb
}
Output:
func NewBreadcrumb ¶
func NewBreadcrumb(items ...BreadcrumbItem) *Breadcrumb
NewBreadcrumb creates a breadcrumb.
func (*Breadcrumb) Bind ¶
func (b *Breadcrumb) Bind(services runtime.Services)
Bind attaches app services.
func (*Breadcrumb) CollapseKeep ¶
func (b *Breadcrumb) CollapseKeep() int
CollapseKeep returns the number of trailing items kept visible.
func (*Breadcrumb) CollapseThreshold ¶
func (b *Breadcrumb) CollapseThreshold() int
CollapseThreshold returns the minimum item count before collapsing.
func (*Breadcrumb) Collapsible ¶
func (b *Breadcrumb) Collapsible() bool
Collapsible reports whether automatic collapsing is enabled.
func (*Breadcrumb) HandleMessage ¶
func (b *Breadcrumb) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage handles mouse clicks and keyboard navigation.
func (*Breadcrumb) Measure ¶
func (b *Breadcrumb) Measure(constraints runtime.Constraints) runtime.Size
Measure returns desired size.
func (*Breadcrumb) OnNavigate
deprecated
func (b *Breadcrumb) OnNavigate(fn func(index int))
OnNavigate sets the callback for navigation to a breadcrumb item.
Deprecated: Use SetOnNavigate instead. This method will be removed in v1.0.
func (*Breadcrumb) Render ¶
func (b *Breadcrumb) Render(ctx runtime.RenderContext)
Render draws breadcrumb text.
func (*Breadcrumb) Selected ¶
func (b *Breadcrumb) Selected() int
Selected returns the currently selected item index.
func (*Breadcrumb) SetCollapseKeep ¶
func (b *Breadcrumb) SetCollapseKeep(n int)
SetCollapseKeep sets the number of trailing items kept visible when collapsed. Default is 2.
func (*Breadcrumb) SetCollapseThreshold ¶
func (b *Breadcrumb) SetCollapseThreshold(n int)
SetCollapseThreshold sets the minimum number of items before collapsing activates. Default is 4.
func (*Breadcrumb) SetCollapsible ¶
func (b *Breadcrumb) SetCollapsible(enabled bool)
SetCollapsible enables or disables automatic collapsing when items overflow.
func (*Breadcrumb) SetOnNavigate ¶
func (b *Breadcrumb) SetOnNavigate(fn func(index int))
SetOnNavigate sets the callback for navigation to a breadcrumb item.
func (*Breadcrumb) SetSeparator ¶
func (b *Breadcrumb) SetSeparator(sep string)
SetSeparator sets the separator between items (default " > ").
func (*Breadcrumb) StyleType ¶
func (b *Breadcrumb) StyleType() string
StyleType returns the selector type name for FSS stylesheet targeting.
type BreadcrumbItem ¶
type BreadcrumbItem struct {
Label string
OnClick func()
}
BreadcrumbItem represents a path segment.
type Button ¶
type Button struct {
FocusableBase
// contains filtered or unexported fields
}
Button is a clickable action widget.
Example ¶
package main
import (
"m31labs.dev/fluffyui/widgets"
)
func main() {
button := widgets.NewButton("Save", widgets.WithVariant(widgets.VariantPrimary))
button.SetLabel("Save changes")
_ = button
}
Output:
func NewButton ¶
func NewButton(label string, opts ...ButtonOption) *Button
NewButton creates a clickable button with the given label. Use ButtonOption functions (WithOnClick, WithVariant, WithDisabled, WithLoading) to configure behavior.
func (*Button) HandleMessage ¶
func (b *Button) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage handles button activation.
func (*Button) Measure ¶
func (b *Button) Measure(constraints runtime.Constraints) runtime.Size
Measure returns the size needed by the button.
func (*Button) SetDisabledStyle ¶
SetDisabledStyle updates the disabled style.
func (*Button) SetFocusStyle ¶
SetFocusStyle updates the focus style.
func (*Button) SetOnClick ¶
func (b *Button) SetOnClick(fn func())
SetOnClick sets the click handler.
func (*Button) SetVariant ¶
SetVariant updates the button variant.
func (*Button) StyleClasses ¶
StyleClasses returns selector classes including the variant.
type ButtonOption ¶
ButtonOption configures a button.
func WithClasses ¶
func WithClasses(classes ...string) ButtonOption
WithClasses adds multiple style classes.
func WithDisabled ¶
func WithDisabled(disabled *state.Signal[bool]) ButtonOption
WithDisabled sets the disabled signal.
func WithLoading ¶
func WithLoading(loading *state.Signal[bool]) ButtonOption
WithLoading sets the loading signal.
type Calendar ¶
type Calendar struct {
FocusableBase
// contains filtered or unexported fields
}
Calendar displays a month grid with selectable days.
func NewCalendar ¶
func NewCalendar(opts ...CalendarOption) *Calendar
NewCalendar creates a new calendar widget.
func (*Calendar) DisplayedMonth ¶
DisplayedMonth returns the month being displayed.
func (*Calendar) DisplayedMonthSignal ¶
DisplayedMonthSignal returns the displayed month signal.
func (*Calendar) HandleMessage ¶
func (c *Calendar) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage handles keyboard navigation and mouse selection.
func (*Calendar) Measure ¶
func (c *Calendar) Measure(constraints runtime.Constraints) runtime.Size
Measure returns the desired size.
func (*Calendar) OnRangeSelect
deprecated
func (*Calendar) RangeEndSignal ¶
RangeEndSignal returns the range end signal.
func (*Calendar) RangeStart ¶
RangeStart returns the current range start date.
func (*Calendar) RangeStartSignal ¶
RangeStartSignal returns the range start signal.
func (*Calendar) Render ¶
func (c *Calendar) Render(ctx runtime.RenderContext)
Render draws the calendar grid.
func (*Calendar) SelectedDate ¶
SelectedDate returns the selected date.
func (*Calendar) SelectedDateSignal ¶
SelectedDateSignal returns the selected date signal.
func (*Calendar) SetDayRenderer ¶
func (c *Calendar) SetDayRenderer(fn DayRenderFunc)
SetDayRenderer updates the day renderer.
func (*Calendar) SetDisplayedMonth ¶
SetDisplayedMonth changes the visible month.
func (*Calendar) SetHighlightDates ¶
SetHighlightDates sets highlighted dates.
func (*Calendar) SetMaxDate ¶
SetMaxDate sets the maximum selectable date (inclusive).
func (*Calendar) SetMinDate ¶
SetMinDate sets the minimum selectable date (inclusive).
func (*Calendar) SetOnRangeSelect ¶
SetOnRangeSelect registers a range selection callback.
func (*Calendar) SetOnSelect ¶
SetOnSelect registers a single-date selection callback.
func (*Calendar) SetSelectedDate ¶
SetSelectedDate updates the selected date.
func (*Calendar) SetSelectionMode ¶
func (c *Calendar) SetSelectionMode(mode CalendarSelectionMode)
SetSelectionMode updates selection mode.
func (*Calendar) SetShowWeekNumbers ¶
SetShowWeekNumbers toggles week number display.
func (*Calendar) SetStyles ¶
func (c *Calendar) SetStyles(base, header, weekday, selected, today, disabled, highlight, outside, rangeSty backend.Style)
SetStyles configures calendar styles.
func (*Calendar) SetWeekStart ¶
SetWeekStart updates the week start day.
type CalendarDayState ¶
type CalendarDayState struct {
InMonth bool
Selected bool
Disabled bool
Today bool
Highlighted bool
InRange bool
RangeStart bool
RangeEnd bool
}
CalendarDayState describes rendering flags for a day.
type CalendarOption ¶
CalendarOption configures a calendar.
func WithDayRenderer ¶
func WithDayRenderer(fn DayRenderFunc) CalendarOption
WithDayRenderer sets a custom day renderer.
func WithDisplayedMonthSignal ¶
func WithDisplayedMonthSignal(sig *state.Signal[time.Time]) CalendarOption
WithDisplayedMonthSignal sets the displayed month signal.
func WithHighlightDatesSignal ¶
func WithHighlightDatesSignal(sig *state.Signal[[]time.Time]) CalendarOption
WithHighlightDatesSignal sets the highlight dates signal.
func WithMaxDateSignal ¶
func WithMaxDateSignal(sig *state.Signal[*time.Time]) CalendarOption
WithMaxDateSignal sets the max date signal.
func WithMinDateSignal ¶
func WithMinDateSignal(sig *state.Signal[*time.Time]) CalendarOption
WithMinDateSignal sets the min date signal.
func WithNowFunc ¶
func WithNowFunc(fn func() time.Time) CalendarOption
WithNowFunc overrides the clock (useful for tests).
func WithSelectedDateSignal ¶
func WithSelectedDateSignal(sig *state.Signal[time.Time]) CalendarOption
WithSelectedDateSignal sets the selected date signal.
func WithSelectionMode ¶
func WithSelectionMode(mode CalendarSelectionMode) CalendarOption
WithSelectionMode sets the selection mode.
func WithShowWeekNumbers ¶
func WithShowWeekNumbers(show bool) CalendarOption
WithShowWeekNumbers toggles week number display.
func WithWeekStart ¶
func WithWeekStart(start time.Weekday) CalendarOption
WithWeekStart sets the week start day.
type CalendarSelectionMode ¶
type CalendarSelectionMode int
CalendarSelectionMode controls selection behavior.
const ( CalendarSelectionSingle CalendarSelectionMode = iota CalendarSelectionRange )
type CanvasOption ¶
type CanvasOption = Option[CanvasWidget]
CanvasOption configures a CanvasWidget.
func WithCanvasBlitter ¶
func WithCanvasBlitter(blitter graphics.Blitter) CanvasOption
WithCanvasBlitter sets the blitter used to render pixels to cells.
type CanvasWidget ¶
type CanvasWidget struct {
Component
// contains filtered or unexported fields
}
CanvasWidget is a widget that draws using a Canvas.
func NewCanvasWidget ¶
func NewCanvasWidget(draw func(canvas *graphics.Canvas), opts ...CanvasOption) *CanvasWidget
NewCanvasWidget creates a CanvasWidget with the draw callback.
func (*CanvasWidget) Layout ¶
func (w *CanvasWidget) Layout(bounds runtime.Rect)
Layout updates layout bounds and canvas size.
func (*CanvasWidget) Measure ¶
func (w *CanvasWidget) Measure(constraints runtime.Constraints) runtime.Size
Measure returns the desired size for the canvas widget.
func (*CanvasWidget) Render ¶
func (w *CanvasWidget) Render(ctx runtime.RenderContext)
Render draws the canvas.
func (*CanvasWidget) SetBlitter ¶
func (w *CanvasWidget) SetBlitter(blitter graphics.Blitter)
SetBlitter sets the blitter used to render pixels to cells.
func (*CanvasWidget) WithBlitter
deprecated
func (w *CanvasWidget) WithBlitter(blitter graphics.Blitter) *CanvasWidget
Deprecated: prefer WithCanvasBlitter during construction or SetBlitter for mutation.
type Card ¶
type Card struct {
Base
// contains filtered or unexported fields
}
Card is a non-focusable bordered container with optional header, body, and footer sections.
func (*Card) ChildWidgets ¶
ChildWidgets returns child widgets for tree traversal.
func (*Card) HandleMessage ¶
func (c *Card) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage forwards messages to children.
func (*Card) Measure ¶
func (c *Card) Measure(constraints runtime.Constraints) runtime.Size
Measure returns the desired size.
type ChartSeries ¶
ChartSeries represents a line chart series.
type Checkbox ¶
type Checkbox struct {
FocusableBase
// contains filtered or unexported fields
}
Checkbox is a toggle input widget.
Example ¶
package main
import (
"m31labs.dev/fluffyui/widgets"
)
func main() {
checked := true
checkbox := widgets.NewCheckbox("Accept terms")
checkbox.SetChecked(&checked)
_ = checkbox
}
Output:
func NewCheckbox ¶
NewCheckbox creates a checkbox with a label.
func (*Checkbox) HandleMessage ¶
func (c *Checkbox) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage toggles the checkbox.
func (*Checkbox) Measure ¶
func (c *Checkbox) Measure(constraints runtime.Constraints) runtime.Size
Measure returns the size needed.
func (*Checkbox) Render ¶
func (c *Checkbox) Render(ctx runtime.RenderContext)
Render draws the checkbox.
func (*Checkbox) SetChecked ¶
SetChecked updates the checkbox value (nil = indeterminate).
func (*Checkbox) SetFocusStyle ¶
SetFocusStyle sets the focused style.
func (*Checkbox) SetOnChange ¶
SetOnChange sets the change handler.
type Chip ¶
type Chip struct {
FocusableBase
// contains filtered or unexported fields
}
Chip is a compact label widget, optionally dismissible. When dismissible, it becomes focusable and handles Enter/Space to dismiss.
func NewChip ¶
func NewChip(label string, opts ...ChipOption) *Chip
NewChip creates a chip widget with the given label.
func (*Chip) Dismissible ¶
Dismissible returns true if the chip can be dismissed.
func (*Chip) HandleMessage ¶
func (c *Chip) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage processes keyboard input for dismissible chips.
func (*Chip) Measure ¶
func (c *Chip) Measure(constraints runtime.Constraints) runtime.Size
Measure returns the desired size.
func (*Chip) RenderHTML ¶
func (c *Chip) RenderHTML(ctx runtime.HTMLContext) runtime.HTML
RenderHTML renders the chip as a static HTML button.
type ChipOption ¶
ChipOption configures a Chip widget.
func WithChipDismiss ¶
func WithChipDismiss(fn func()) ChipOption
WithChipDismiss makes the chip dismissible with the given callback.
func WithChipVariant ¶
func WithChipVariant(v ChipVariant) ChipOption
WithChipVariant sets the chip variant for visual styling.
type ChipVariant ¶
type ChipVariant int
ChipVariant describes the visual style of a chip.
const ( // ChipDefault is the default chip variant. ChipDefault ChipVariant = iota // ChipPrimary is the primary chip variant. ChipPrimary // ChipSuccess is the success chip variant. ChipSuccess // ChipWarning is the warning chip variant. ChipWarning // ChipError is the error chip variant. ChipError )
type ColorPicker ¶
type ColorPicker struct {
FocusableBase
// contains filtered or unexported fields
}
ColorPicker is a focusable color selection widget. It displays a grid of preset color swatches and allows keyboard navigation.
func NewColorPicker ¶
func NewColorPicker(opts ...ColorPickerOption) *ColorPicker
NewColorPicker creates a color picker with the default palette.
func (*ColorPicker) Bind ¶
func (cp *ColorPicker) Bind(services runtime.Services)
Bind attaches app services.
func (*ColorPicker) HandleMessage ¶
func (cp *ColorPicker) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage processes keyboard input.
func (*ColorPicker) Measure ¶
func (cp *ColorPicker) Measure(constraints runtime.Constraints) runtime.Size
Measure returns the desired size.
func (*ColorPicker) Render ¶
func (cp *ColorPicker) Render(ctx runtime.RenderContext)
Render draws the color picker.
func (*ColorPicker) Selected ¶
func (cp *ColorPicker) Selected() backend.Color
Selected returns the currently selected color.
func (*ColorPicker) SelectedIndex ¶
func (cp *ColorPicker) SelectedIndex() int
SelectedIndex returns the index of the selected color.
func (*ColorPicker) SetSelected ¶
func (cp *ColorPicker) SetSelected(index int)
SetSelected sets the selected index.
func (*ColorPicker) SetStyle ¶
func (cp *ColorPicker) SetStyle(style backend.Style)
SetStyle sets the widget style.
func (*ColorPicker) StyleType ¶
func (cp *ColorPicker) StyleType() string
StyleType returns the selector type name.
type ColorPickerOption ¶
type ColorPickerOption = Option[ColorPicker]
ColorPickerOption configures a ColorPicker widget.
func WithColorPickerOnChange ¶
func WithColorPickerOnChange(fn func(backend.Color)) ColorPickerOption
WithColorPickerOnChange sets the change handler.
func WithColorPickerPalette ¶
func WithColorPickerPalette(colors []backend.Color, names []string) ColorPickerOption
WithColorPickerPalette sets custom palette colors.
type ColorScale ¶
ColorScale maps a normalized value in [0,1] to a color.
func BlueRedScale ¶
func BlueRedScale() ColorScale
BlueRedScale returns a color scale from blue (low) to red (high).
func GrayscaleScale ¶
func GrayscaleScale() ColorScale
GrayscaleScale returns a color scale from black (low) to white (high).
func GreenRedScale ¶
func GreenRedScale() ColorScale
GreenRedScale returns a color scale from green (low) to red (high).
type ColumnPin ¶
type ColumnPin int
ColumnPin determines whether a column is pinned to the left or right edge.
type Combobox ¶
type Combobox struct {
FocusableBase
// contains filtered or unexported fields
}
Combobox is a dropdown select that also accepts free-text input.
func NewCombobox ¶
NewCombobox creates a combobox with the given options.
func (*Combobox) HandleMessage ¶
func (c *Combobox) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage handles keyboard input.
func (*Combobox) Measure ¶
func (c *Combobox) Measure(constraints runtime.Constraints) runtime.Size
Measure returns the desired size.
func (*Combobox) Render ¶
func (c *Combobox) Render(ctx runtime.RenderContext)
Render draws the combobox.
func (*Combobox) SetFocusStyle ¶
SetFocusStyle sets the focused style.
func (*Combobox) SetOnChange ¶
SetOnChange sets the change handler.
func (*Combobox) SetOptions ¶
SetOptions replaces the option list and re-filters.
type CommandPalette ¶
type CommandPalette struct {
FocusableBase
// contains filtered or unexported fields
}
CommandPalette is a focusable fuzzy-search command launcher (VS Code-style Ctrl+K/Ctrl+P). It displays a filterable list of commands with keyboard navigation.
func NewCommandPalette ¶
func NewCommandPalette(commands ...PaletteCommand) *CommandPalette
NewCommandPalette creates a command palette with the given commands.
func (*CommandPalette) AddCommand ¶
func (cp *CommandPalette) AddCommand(cmd PaletteCommand)
AddCommand appends a single command and refilters.
func (*CommandPalette) Bind ¶
func (cp *CommandPalette) Bind(services runtime.Services)
Bind attaches app services.
func (*CommandPalette) FilteredCount ¶
func (cp *CommandPalette) FilteredCount() int
FilteredCount returns the number of matching commands.
func (*CommandPalette) HandleMessage ¶
func (cp *CommandPalette) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage processes keyboard input.
func (*CommandPalette) Measure ¶
func (cp *CommandPalette) Measure(constraints runtime.Constraints) runtime.Size
Measure returns the desired size.
func (*CommandPalette) Open ¶
func (cp *CommandPalette) Open() bool
Open returns whether the palette is visible.
func (*CommandPalette) Query ¶
func (cp *CommandPalette) Query() string
Query returns the current search query.
func (*CommandPalette) Render ¶
func (cp *CommandPalette) Render(ctx runtime.RenderContext)
Render draws the command palette.
func (*CommandPalette) SelectedIndex ¶
func (cp *CommandPalette) SelectedIndex() int
SelectedIndex returns the index within the filtered results.
func (*CommandPalette) SetCommands ¶
func (cp *CommandPalette) SetCommands(cmds []PaletteCommand)
SetCommands replaces the command list and refilters.
func (*CommandPalette) SetMaxResults ¶
func (cp *CommandPalette) SetMaxResults(n int)
SetMaxResults sets the maximum number of results to display.
func (*CommandPalette) SetOnExecute ¶
func (cp *CommandPalette) SetOnExecute(fn func(cmd PaletteCommand))
SetOnExecute sets a callback invoked after a command is executed.
func (*CommandPalette) SetOpen ¶
func (cp *CommandPalette) SetOpen(open bool)
SetOpen sets the visibility of the palette.
func (*CommandPalette) SetStyle ¶
func (cp *CommandPalette) SetStyle(style backend.Style)
SetStyle sets the widget style.
func (*CommandPalette) Show ¶
func (cp *CommandPalette) Show()
Show makes the palette visible, resetting the query and selection.
func (*CommandPalette) StyleType ¶
func (cp *CommandPalette) StyleType() string
StyleType returns the selector type name.
func (*CommandPalette) Toggle ¶
func (cp *CommandPalette) Toggle()
Toggle switches the palette between visible and hidden.
type CommandPaletteOption ¶
type CommandPaletteOption = Option[CommandPalette]
CommandPaletteOption configures a CommandPalette widget.
func WithCommandPaletteOpen ¶
func WithCommandPaletteOpen(open bool) CommandPaletteOption
WithCommandPaletteOpen sets the initial open/visible state.
type Component ¶
type Component struct {
Base
Services runtime.Services
Subs state.Subscriptions
}
Component is a base widget with bound services and subscriptions.
func (*Component) Observe ¶
func (c *Component) Observe(sub state.Subscribable, fn func())
Observe registers a subscription using the default scheduler.
type DataGrid ¶
type DataGrid struct {
FocusableBase
// contains filtered or unexported fields
}
DataGrid is an advanced data grid widget with column resizing, cell renderers, column pinning, sorting, and virtual scrolling. It provides per-cell selection, inline editing, and ARIA grid semantics.
func NewDataGrid ¶
func NewDataGrid(columns []DataGridColumn) *DataGrid
NewDataGrid creates a DataGrid with the given column definitions. MinWidth defaults to 3 for all columns. Width is clamped to [MinWidth, MaxWidth].
func (*DataGrid) CancelEdit ¶
func (dg *DataGrid) CancelEdit()
CancelEdit discards edits and exits edit mode.
func (*DataGrid) ColumnCount ¶
ColumnCount returns the number of columns.
func (*DataGrid) ColumnWidth ¶
ColumnWidth returns the current width of a column.
func (*DataGrid) Columns ¶
func (dg *DataGrid) Columns() []DataGridColumn
Columns returns a copy of the current column definitions.
func (*DataGrid) CommitEdit ¶
func (dg *DataGrid) CommitEdit()
CommitEdit saves edits and exits edit mode.
func (*DataGrid) HandleMessage ¶
func (dg *DataGrid) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage processes key events for cell navigation, inline editing, and column resizing (Ctrl+Left/Right shrinks/grows the selected column).
func (*DataGrid) Measure ¶
func (dg *DataGrid) Measure(constraints runtime.Constraints) runtime.Size
Measure returns the desired size.
func (*DataGrid) Render ¶
func (dg *DataGrid) Render(ctx runtime.RenderContext)
Render draws the data grid into the render context.
func (*DataGrid) ScrollToEnd ¶
func (dg *DataGrid) ScrollToEnd()
ScrollToEnd scrolls to the last row.
func (*DataGrid) ScrollToStart ¶
func (dg *DataGrid) ScrollToStart()
ScrollToStart scrolls to the first row.
func (*DataGrid) SelectedCell ¶
SelectedCell returns the currently selected row and column.
func (*DataGrid) SetColumnPin ¶
SetColumnPin sets the pin state for a column.
func (*DataGrid) SetColumnWidth ¶
SetColumnWidth sets the width of a column, clamped to [MinWidth, MaxWidth].
func (*DataGrid) SetHeaderStyle ¶
SetHeaderStyle updates the header row style.
func (*DataGrid) SetOnCellEdit ¶
SetOnCellEdit sets the callback invoked when a cell edit is committed.
func (*DataGrid) SetOverscan ¶
SetOverscan sets the number of extra rows rendered beyond the viewport.
func (*DataGrid) SetSelectedCell ¶
SetSelectedCell updates the selected cell position.
func (*DataGrid) SetSelectedStyle ¶
SetSelectedStyle updates the selected cell/row style.
func (*DataGrid) SetVirtualScroll ¶
SetVirtualScroll enables or disables virtual scrolling for large datasets.
func (*DataGrid) Sort ¶
func (dg *DataGrid) Sort(col int, dir SortDirection)
Sort sets the sort column and direction, then rebuilds the display order.
func (*DataGrid) SortState ¶
func (dg *DataGrid) SortState() (col int, dir SortDirection)
SortState returns the current sort column and direction.
func (*DataGrid) StartEdit ¶
func (dg *DataGrid) StartEdit()
StartEdit enters edit mode on the selected cell.
func (*DataGrid) VirtualScroll ¶
VirtualScroll reports whether virtual scrolling is enabled.
func (*DataGrid) VisibleRange ¶
VisibleRange returns the [start, end) row range currently rendered.
type DataGridColumn ¶
type DataGridColumn struct {
Header string // column header text
Width int // current width in cells
MinWidth int // minimum resize width (default 3)
MaxWidth int // maximum resize width (0 = unlimited)
Resizable bool // can be resized via Ctrl+Left/Right
Pinned ColumnPin // pinned to left/right edge
Sortable bool // can be sorted
Renderer func(row int, value string) string // custom cell renderer (optional)
}
DataGridColumn defines a column in a DataGrid. Unlike TableColumn, it supports resizing constraints, pinning, sortability, and per-cell renderers.
type DatePicker ¶
type DatePicker struct {
Base
// contains filtered or unexported fields
}
DatePicker combines a text input and calendar.
func (*DatePicker) Bind ¶
func (d *DatePicker) Bind(services runtime.Services)
Bind attaches app services.
func (*DatePicker) Calendar ¶
func (d *DatePicker) Calendar() *Calendar
Calendar returns the underlying calendar.
func (*DatePicker) ChildWidgets ¶
func (d *DatePicker) ChildWidgets() []runtime.Widget
ChildWidgets returns child widgets.
func (*DatePicker) HandleMessage ¶
func (d *DatePicker) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage forwards messages to children.
func (*DatePicker) Input ¶
func (d *DatePicker) Input() *Input
Input returns the underlying input widget.
func (*DatePicker) Layout ¶
func (d *DatePicker) Layout(bounds runtime.Rect)
Layout positions the input and calendar.
func (*DatePicker) Measure ¶
func (d *DatePicker) Measure(constraints runtime.Constraints) runtime.Size
Measure returns the desired size.
func (*DatePicker) PathSegment ¶
func (d *DatePicker) PathSegment(child runtime.Widget) string
PathSegment returns a debug path segment for the given child.
func (*DatePicker) Render ¶
func (d *DatePicker) Render(ctx runtime.RenderContext)
Render draws the date picker.
func (*DatePicker) SelectedDate ¶
func (d *DatePicker) SelectedDate() time.Time
SelectedDate returns the selected date.
func (*DatePicker) SetFormat ¶
func (d *DatePicker) SetFormat(format string)
SetFormat updates the date format.
func (*DatePicker) SetHighlightDates ¶
func (d *DatePicker) SetHighlightDates(dates []time.Time)
SetHighlightDates updates highlighted dates.
func (*DatePicker) SetLabel ¶
func (d *DatePicker) SetLabel(label string)
SetLabel updates the accessibility label.
func (*DatePicker) SetMaxDate ¶
func (d *DatePicker) SetMaxDate(date *time.Time)
SetMaxDate sets the maximum selectable date.
func (*DatePicker) SetMinDate ¶
func (d *DatePicker) SetMinDate(date *time.Time)
SetMinDate sets the minimum selectable date.
func (*DatePicker) SetSelectedDate ¶
func (d *DatePicker) SetSelectedDate(date time.Time)
SetSelectedDate updates the selected date.
func (*DatePicker) SetSelectionMode ¶
func (d *DatePicker) SetSelectionMode(mode CalendarSelectionMode)
SetSelectionMode updates selection mode.
func (*DatePicker) SetShowWeekNumbers ¶
func (d *DatePicker) SetShowWeekNumbers(show bool)
SetShowWeekNumbers toggles week numbers.
func (*DatePicker) SetWeekStart ¶
func (d *DatePicker) SetWeekStart(start time.Weekday)
SetWeekStart updates the calendar week start.
func (*DatePicker) StyleType ¶
func (d *DatePicker) StyleType() string
StyleType returns the selector type name.
type DateRangePicker ¶
type DateRangePicker struct {
Base
// contains filtered or unexported fields
}
DateRangePicker combines two inputs with a range-select calendar.
func NewDateRangePicker ¶
func NewDateRangePicker() *DateRangePicker
NewDateRangePicker creates a date range picker.
func (*DateRangePicker) Bind ¶
func (d *DateRangePicker) Bind(services runtime.Services)
Bind attaches app services.
func (*DateRangePicker) Calendar ¶
func (d *DateRangePicker) Calendar() *Calendar
Calendar returns the underlying calendar.
func (*DateRangePicker) ChildWidgets ¶
func (d *DateRangePicker) ChildWidgets() []runtime.Widget
ChildWidgets returns child widgets for traversal.
func (*DateRangePicker) EndInput ¶
func (d *DateRangePicker) EndInput() *Input
EndInput returns the end input widget.
func (*DateRangePicker) HandleMessage ¶
func (d *DateRangePicker) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage forwards messages to child widgets.
func (*DateRangePicker) Layout ¶
func (d *DateRangePicker) Layout(bounds runtime.Rect)
Layout positions the inputs and calendar.
func (*DateRangePicker) Measure ¶
func (d *DateRangePicker) Measure(constraints runtime.Constraints) runtime.Size
Measure returns the desired size.
func (*DateRangePicker) OnRangeSelect
deprecated
func (d *DateRangePicker) OnRangeSelect(fn func(start, end time.Time))
OnRangeSelect registers a selection callback.
Deprecated: Use SetOnRangeSelect instead. This method will be removed in v1.0.
func (*DateRangePicker) Render ¶
func (d *DateRangePicker) Render(ctx runtime.RenderContext)
Render draws inputs, separator, and calendar.
func (*DateRangePicker) SelectedRange ¶
SelectedRange returns the selected range and a flag if both ends are set.
func (*DateRangePicker) SetFormat ¶
func (d *DateRangePicker) SetFormat(format string)
SetFormat updates the date format.
func (*DateRangePicker) SetLabel ¶
func (d *DateRangePicker) SetLabel(label string)
SetLabel updates the accessibility label.
func (*DateRangePicker) SetOnRangeSelect ¶
func (d *DateRangePicker) SetOnRangeSelect(fn func(start, end time.Time))
SetOnRangeSelect registers a selection callback.
func (*DateRangePicker) SetRange ¶
func (d *DateRangePicker) SetRange(start, end *time.Time)
SetRange updates the selected date range.
func (*DateRangePicker) StartInput ¶
func (d *DateRangePicker) StartInput() *Input
StartInput returns the start input widget.
func (*DateRangePicker) StyleType ¶
func (d *DateRangePicker) StyleType() string
StyleType returns the selector type name.
type DayRenderFunc ¶
type DayRenderFunc func(ctx runtime.RenderContext, date time.Time, state CalendarDayState)
DayRenderFunc customizes day rendering.
type DebugOverlay ¶
type DebugOverlay struct {
Base
// contains filtered or unexported fields
}
DebugOverlay draws widget bounds and labels for layout debugging.
func NewDebugOverlay ¶
func NewDebugOverlay(root runtime.Widget, opts ...DebugOverlayOption) *DebugOverlay
NewDebugOverlay creates a debug overlay for the provided root widget.
func (*DebugOverlay) Bind ¶
func (d *DebugOverlay) Bind(services runtime.Services)
Bind attaches app services.
func (*DebugOverlay) Layout ¶
func (d *DebugOverlay) Layout(bounds runtime.Rect)
Layout stores bounds.
func (*DebugOverlay) Measure ¶
func (d *DebugOverlay) Measure(constraints runtime.Constraints) runtime.Size
Measure takes all available space.
func (*DebugOverlay) Render ¶
func (d *DebugOverlay) Render(ctx runtime.RenderContext)
Render draws bounding boxes for the widget tree.
type DebugOverlayOption ¶
type DebugOverlayOption = Option[DebugOverlay]
DebugOverlayOption configures a debug overlay.
func WithDebugLabelStyle ¶
func WithDebugLabelStyle(style backend.Style) DebugOverlayOption
WithDebugLabelStyle sets the label style.
func WithDebugLabels ¶
func WithDebugLabels(enabled bool) DebugOverlayOption
WithDebugLabels toggles label rendering.
func WithDebugMaxDepth ¶
func WithDebugMaxDepth(depth int) DebugOverlayOption
WithDebugMaxDepth limits traversal depth (0 = unlimited).
func WithDebugStyle ¶
func WithDebugStyle(style backend.Style) DebugOverlayOption
WithDebugStyle sets the box style.
type Dialog ¶
type Dialog struct {
FocusableBase
Title string
Body string // Text body (used if Content is nil)
Content runtime.Widget // Custom content widget (takes precedence over Body)
Buttons []DialogButton
// contains filtered or unexported fields
}
Dialog is a modal message container with optional custom content. Dialog supports keyboard shortcuts, auto-dismiss timers, and dismiss callbacks.
Example ¶
package main
import (
"m31labs.dev/fluffyui/widgets"
)
func main() {
dialog := widgets.NewDialog("Confirm", "Delete the item?", widgets.DialogButton{Label: "OK"})
_ = dialog
}
Output:
func NewDialog ¶
func NewDialog(title, body string, buttons ...DialogButton) *Dialog
NewDialog creates a dialog with title, body text, and optional buttons. Use builder methods to add custom content, auto-dismiss, etc.
func (*Dialog) Apply ¶
func (d *Dialog) Apply(opts ...DialogOption) *Dialog
Apply applies dialog options and returns the dialog for chaining.
func (*Dialog) Bind ¶
Bind attaches app services and announces dialog content. It saves the currently focused widget so focus can be restored on close.
func (*Dialog) CenteredBounds ¶
CenteredBounds returns bounds to center dialog within parent rect.
func (*Dialog) ChildWidgets ¶
ChildWidgets returns the content widget for proper widget tree traversal.
func (*Dialog) HandleMessage ¶
func (d *Dialog) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage handles button selection and keyboard shortcuts.
func (*Dialog) Measure ¶
func (d *Dialog) Measure(constraints runtime.Constraints) runtime.Size
Measure returns desired size.
func (*Dialog) PathSegment ¶
PathSegment returns a debug path segment for the given child.
func (*Dialog) ResumeTimer ¶
func (d *Dialog) ResumeTimer()
ResumeTimer resumes the auto-dismiss timer.
func (*Dialog) SetAutoDismiss ¶
SetAutoDismiss enables auto-dismiss after duration (0 = disabled).
func (*Dialog) SetButtons ¶
func (d *Dialog) SetButtons(buttons ...DialogButton)
SetButtons updates dialog buttons.
func (*Dialog) SetContent ¶
SetContent sets a custom widget as dialog body (replaces text Body).
func (*Dialog) SetDismissable ¶
SetDismissable sets whether Escape closes the dialog (default true).
func (*Dialog) SetOnDismiss ¶
func (d *Dialog) SetOnDismiss(fn func())
SetOnDismiss sets callback when dialog is dismissed via Escape.
func (*Dialog) ShouldDismiss ¶
ShouldDismiss returns true if auto-dismiss time has elapsed.
func (*Dialog) TimerProgress ¶
TimerProgress returns 0.0-1.0 progress toward auto-dismiss.
func (*Dialog) Unbind ¶
func (d *Dialog) Unbind()
Unbind releases app services and restores focus to the widget that was focused before the dialog opened.
func (*Dialog) WithAutoDismiss
deprecated
WithAutoDismiss enables auto-dismiss after duration and returns the dialog for chaining. Call ShouldDismiss() periodically to check if time has elapsed.
Deprecated: Use SetAutoDismiss for mutation or WithDialogAutoDismiss during construction. This method will be removed in v1.0.
func (*Dialog) WithContent
deprecated
func (*Dialog) WithDismissable
deprecated
type DialogButton ¶
type DialogButton struct {
Label string
Key rune // Keyboard shortcut (e.g., 'Y' for Yes). 0 = no shortcut.
OnClick func()
}
DialogButton represents an action in a dialog.
type DialogOption ¶
DialogOption configures a Dialog widget.
func WithDialogAutoDismiss ¶
func WithDialogAutoDismiss(duration time.Duration) DialogOption
WithDialogAutoDismiss enables auto-dismiss after duration.
func WithDialogButtons ¶
func WithDialogButtons(buttons ...DialogButton) DialogOption
WithDialogButtons sets the dialog buttons.
func WithDialogContent ¶
func WithDialogContent(content runtime.Widget) DialogOption
WithDialogContent sets a custom content widget.
func WithDialogDismissable ¶
func WithDialogDismissable(dismissable bool) DialogOption
WithDialogDismissable sets whether Escape closes the dialog.
func WithDialogOnDismiss ¶
func WithDialogOnDismiss(fn func()) DialogOption
WithDialogOnDismiss registers a dismiss callback.
func WithDialogStyle ¶
func WithDialogStyle(style backend.Style) DialogOption
WithDialogStyle sets the dialog style.
type DirectoryEntry ¶
type DirectoryEntry struct {
Path string
Name string
IsDir bool
Expanded bool
Depth int
Parent *DirectoryEntry
Children []*DirectoryEntry
Loaded bool // true if children have been loaded (for lazy loading)
}
DirectoryEntry represents a file or directory in the tree.
type DirectoryTree ¶
type DirectoryTree struct {
FocusableBase
// contains filtered or unexported fields
}
DirectoryTree is a lazy-loading file browser with virtual scrolling.
func NewDirectoryTree ¶
func NewDirectoryTree(root string, opts ...DirectoryTreeOption) *DirectoryTree
NewDirectoryTree creates a new directory tree widget.
func (*DirectoryTree) Bind ¶
func (d *DirectoryTree) Bind(services runtime.Services)
Bind attaches app services.
func (*DirectoryTree) CollapseSelected ¶
func (d *DirectoryTree) CollapseSelected()
CollapseSelected collapses the selected directory.
func (*DirectoryTree) ExpandSelected ¶
func (d *DirectoryTree) ExpandSelected()
ExpandSelected expands the selected directory.
func (*DirectoryTree) HandleMessage ¶
func (d *DirectoryTree) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage handles navigation and expansion input.
func (*DirectoryTree) Layout ¶
func (d *DirectoryTree) Layout(bounds runtime.Rect)
Layout stores the assigned bounds.
func (*DirectoryTree) LazyLoad ¶
func (d *DirectoryTree) LazyLoad() bool
LazyLoad returns whether lazy loading is enabled.
func (*DirectoryTree) Measure ¶
func (d *DirectoryTree) Measure(constraints runtime.Constraints) runtime.Size
Measure returns the desired size.
func (*DirectoryTree) PageBy ¶
func (d *DirectoryTree) PageBy(pages int)
PageBy scrolls by a number of pages.
func (*DirectoryTree) Refresh ¶
func (d *DirectoryTree) Refresh()
Refresh reloads the directory tree.
func (*DirectoryTree) Render ¶
func (d *DirectoryTree) Render(ctx runtime.RenderContext)
Render draws the directory tree.
func (*DirectoryTree) Root ¶
func (d *DirectoryTree) Root() string
Root returns the current root directory.
func (*DirectoryTree) ScrollBy ¶
func (d *DirectoryTree) ScrollBy(dx, dy int)
ScrollBy scrolls selection by delta rows.
func (*DirectoryTree) ScrollTo ¶
func (d *DirectoryTree) ScrollTo(x, y int)
ScrollTo scrolls to an absolute row index.
func (*DirectoryTree) ScrollToEnd ¶
func (d *DirectoryTree) ScrollToEnd()
ScrollToEnd scrolls to the last row.
func (*DirectoryTree) ScrollToStart ¶
func (d *DirectoryTree) ScrollToStart()
ScrollToStart scrolls to the first row.
func (*DirectoryTree) SelectedEntry ¶
func (d *DirectoryTree) SelectedEntry() *DirectoryEntry
SelectedEntry returns the currently selected entry.
func (*DirectoryTree) SelectedPath ¶
func (d *DirectoryTree) SelectedPath() string
SelectedPath returns the currently selected path.
func (*DirectoryTree) SetFilter ¶
func (d *DirectoryTree) SetFilter(filter func(os.DirEntry) bool)
SetFilter sets the filter function.
func (*DirectoryTree) SetLabel ¶
func (d *DirectoryTree) SetLabel(label string)
SetLabel sets the accessibility label.
func (*DirectoryTree) SetLazyLoad ¶
func (d *DirectoryTree) SetLazyLoad(lazy bool)
SetLazyLoad enables or disables lazy loading.
func (*DirectoryTree) SetOnSelect ¶
func (d *DirectoryTree) SetOnSelect(fn func(path string))
SetOnSelect sets the selection callback.
func (*DirectoryTree) SetRoot ¶
func (d *DirectoryTree) SetRoot(root string)
SetRoot changes the root directory.
func (*DirectoryTree) SetSelectedStyle ¶
func (d *DirectoryTree) SetSelectedStyle(style backend.Style)
SetSelectedStyle sets the selected row style.
func (*DirectoryTree) SetShowHidden ¶
func (d *DirectoryTree) SetShowHidden(show bool)
SetShowHidden enables or disables showing hidden files.
func (*DirectoryTree) SetStyle ¶
func (d *DirectoryTree) SetStyle(style backend.Style)
SetStyle sets the base style.
func (*DirectoryTree) ShowHidden ¶
func (d *DirectoryTree) ShowHidden() bool
ShowHidden returns whether hidden files are shown.
func (*DirectoryTree) StyleType ¶
func (d *DirectoryTree) StyleType() string
StyleType returns the selector type name.
func (*DirectoryTree) ToggleSelected ¶
func (d *DirectoryTree) ToggleSelected()
ToggleSelected toggles expand/collapse on the selected directory.
type DirectoryTreeOption ¶
type DirectoryTreeOption func(*DirectoryTree)
DirectoryTreeOption is a functional option for DirectoryTree.
func WithDirectoryFilter ¶
func WithDirectoryFilter(filter func(os.DirEntry) bool) DirectoryTreeOption
WithDirectoryFilter sets a filter function for entries.
func WithDirectoryIcons ¶
func WithDirectoryIcons(dir, file, expanded, collapsed string) DirectoryTreeOption
WithDirectoryIcons sets custom icons.
func WithDirectorySelectedStyle ¶
func WithDirectorySelectedStyle(s backend.Style) DirectoryTreeOption
WithDirectorySelectedStyle sets the selected row style.
func WithDirectoryStyle ¶
func WithDirectoryStyle(s backend.Style) DirectoryTreeOption
WithDirectoryStyle sets the base style.
func WithLazyLoad ¶
func WithLazyLoad(lazy bool) DirectoryTreeOption
WithLazyLoad enables lazy loading of children.
func WithOnSelect ¶
func WithOnSelect(fn func(path string)) DirectoryTreeOption
WithOnSelect sets the selection callback.
func WithShowHidden ¶
func WithShowHidden(show bool) DirectoryTreeOption
WithShowHidden enables showing hidden files (starting with .).
type Disclosure ¶
type Disclosure struct {
FocusableBase
// contains filtered or unexported fields
}
Disclosure is a single expandable section with a toggle header.
func NewDisclosure ¶
func NewDisclosure(title string, content runtime.Widget) *Disclosure
NewDisclosure creates a disclosure widget with the given title and content.
func (*Disclosure) Bind ¶
func (d *Disclosure) Bind(services runtime.Services)
Bind attaches app services.
func (*Disclosure) ChildWidgets ¶
func (d *Disclosure) ChildWidgets() []runtime.Widget
ChildWidgets returns the content widget when expanded.
func (*Disclosure) Expanded ¶
func (d *Disclosure) Expanded() bool
Expanded reports whether the disclosure is expanded.
func (*Disclosure) HandleMessage ¶
func (d *Disclosure) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage handles keyboard toggling.
func (*Disclosure) Layout ¶
func (d *Disclosure) Layout(bounds runtime.Rect)
Layout positions the header and content.
func (*Disclosure) Measure ¶
func (d *Disclosure) Measure(constraints runtime.Constraints) runtime.Size
Measure returns the desired size.
func (*Disclosure) Render ¶
func (d *Disclosure) Render(ctx runtime.RenderContext)
Render draws the disclosure header and optional content.
func (*Disclosure) SetExpanded ¶
func (d *Disclosure) SetExpanded(expanded bool)
SetExpanded sets the expanded state.
func (*Disclosure) SetFocusStyle ¶
func (d *Disclosure) SetFocusStyle(style backend.Style)
SetFocusStyle sets the focused style.
func (*Disclosure) SetOnChange ¶
func (d *Disclosure) SetOnChange(fn func(expanded bool))
SetOnChange sets the change handler.
func (*Disclosure) SetStyle ¶
func (d *Disclosure) SetStyle(style backend.Style)
SetStyle sets the normal style.
func (*Disclosure) StyleType ¶
func (d *Disclosure) StyleType() string
StyleType returns the selector type name.
type Drawer ¶
type Drawer struct {
Base
// contains filtered or unexported fields
}
Drawer is a slide-out panel that overlays from a screen edge. When closed, it takes no space. When open, it renders its child content at the specified edge with the specified width or height.
func NewDrawer ¶
NewDrawer creates a drawer containing the given child widget. The open signal controls whether the drawer is visible.
func (*Drawer) ChildWidgets ¶
ChildWidgets returns the child widget when the drawer is open.
func (*Drawer) HandleMessage ¶
func (d *Drawer) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage processes input for the drawer. Escape closes the drawer when it is open.
func (*Drawer) Measure ¶
func (d *Drawer) Measure(constraints runtime.Constraints) runtime.Size
Measure returns the desired size. When closed, returns zero size. When open, returns the drawer dimensions.
func (*Drawer) Render ¶
func (d *Drawer) Render(ctx runtime.RenderContext)
Render draws the drawer and its child content when open.
type DrawerOption ¶
DrawerOption configures a Drawer widget.
func WithDrawerHeight ¶
func WithDrawerHeight(height int) DrawerOption
WithDrawerHeight sets the height for bottom drawers.
func WithDrawerSide ¶
func WithDrawerSide(side DrawerSide) DrawerOption
WithDrawerSide sets which edge the drawer opens from.
func WithDrawerWidth ¶
func WithDrawerWidth(width int) DrawerOption
WithDrawerWidth sets the width for left/right drawers.
type DrawerSide ¶
type DrawerSide int
DrawerSide specifies which edge the drawer slides out from.
const ( // DrawerLeft opens from the left edge. DrawerLeft DrawerSide = iota // DrawerRight opens from the right edge. DrawerRight // DrawerBottom opens from the bottom edge. DrawerBottom )
type EnhancedPalette ¶
type EnhancedPalette struct {
Widget *PaletteWidget
// contains filtered or unexported fields
}
EnhancedPalette wraps a command registry with palette UI.
Example ¶
package main
import (
"m31labs.dev/fluffyui/keybind"
"m31labs.dev/fluffyui/widgets"
)
func main() {
registry := keybind.NewRegistry()
registry.Register(keybind.Command{
ID: "app.quit",
Title: "Quit",
Description: "Exit the app",
})
palette := widgets.NewEnhancedPalette(registry)
_ = palette
}
Output:
func NewEnhancedPalette ¶
func NewEnhancedPalette(registry *keybind.CommandRegistry) *EnhancedPalette
NewEnhancedPalette creates a palette from a registry.
func (*EnhancedPalette) Pin ¶
func (p *EnhancedPalette) Pin(id string)
Pin adds a command to pinned list.
func (*EnhancedPalette) Record ¶
func (p *EnhancedPalette) Record(id string)
Record marks a command as recently used.
func (*EnhancedPalette) Refresh ¶
func (p *EnhancedPalette) Refresh()
Refresh rebuilds palette items from the registry.
func (*EnhancedPalette) SetKeymapStack ¶
func (p *EnhancedPalette) SetKeymapStack(stack *keybind.KeymapStack)
SetKeymapStack supplies keymaps from a stack.
func (*EnhancedPalette) SetKeymaps ¶
func (p *EnhancedPalette) SetKeymaps(keymaps ...*keybind.Keymap)
SetKeymaps supplies keymaps for shortcut display.
func (*EnhancedPalette) Unpin ¶
func (p *EnhancedPalette) Unpin(id string)
Unpin removes a command from pinned list.
type FilePicker ¶
type FilePicker struct {
FocusableBase
// contains filtered or unexported fields
}
FilePicker is a focusable file/directory browser for selecting files.
func NewFilePicker ¶
func NewFilePicker(dir string, opts ...FilePickerOption) *FilePicker
NewFilePicker creates a file picker for the given directory.
func (*FilePicker) Bind ¶
func (fp *FilePicker) Bind(services runtime.Services)
Bind attaches app services.
func (*FilePicker) CurrentDir ¶
func (fp *FilePicker) CurrentDir() string
CurrentDir returns the current directory path.
func (*FilePicker) EntryCount ¶
func (fp *FilePicker) EntryCount() int
EntryCount returns the number of visible entries (including "..").
func (*FilePicker) HandleMessage ¶
func (fp *FilePicker) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage processes keyboard input.
func (*FilePicker) Measure ¶
func (fp *FilePicker) Measure(constraints runtime.Constraints) runtime.Size
Measure returns the desired size.
func (*FilePicker) Render ¶
func (fp *FilePicker) Render(ctx runtime.RenderContext)
Render draws the file picker.
func (*FilePicker) SelectedIndex ¶
func (fp *FilePicker) SelectedIndex() int
SelectedIndex returns the currently selected entry index.
func (*FilePicker) SetStyle ¶
func (fp *FilePicker) SetStyle(style backend.Style)
SetStyle sets the widget style.
func (*FilePicker) StyleType ¶
func (fp *FilePicker) StyleType() string
StyleType returns the selector type name.
type FilePickerOption ¶
type FilePickerOption = Option[FilePicker]
FilePickerOption configures a FilePicker widget.
func WithFileFilter ¶
func WithFileFilter(pattern string) FilePickerOption
WithFileFilter sets the file extension filter (e.g. "*.go").
func WithFilePickerShowHidden ¶
func WithFilePickerShowHidden(show bool) FilePickerOption
WithFilePickerShowHidden controls whether hidden files are shown.
func WithOnFileSelect ¶
func WithOnFileSelect(fn func(string)) FilePickerOption
WithOnFileSelect sets the file selection callback.
func WithStartDir ¶
func WithStartDir(dir string) FilePickerOption
WithStartDir sets the starting directory.
type FixedSpacer ¶
type FixedSpacer struct {
Base
// contains filtered or unexported fields
}
FixedSpacer is an empty widget with a fixed size, useful for adding precise spacing between widgets in a layout. Unlike runtime.FixedSpace which is a flex child helper, FixedSpacer is a full widget that can participate in the accessibility tree and stylesheet system.
func NewFixedSpacer ¶
func NewFixedSpacer(width, height int) *FixedSpacer
NewFixedSpacer creates a fixed-size empty widget. The spacer occupies exactly the given width and height and renders nothing.
func (*FixedSpacer) HandleMessage ¶
func (s *FixedSpacer) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage returns unhandled; spacers do not process input.
func (*FixedSpacer) Measure ¶
func (s *FixedSpacer) Measure(constraints runtime.Constraints) runtime.Size
Measure returns the fixed size, clamped to the given constraints.
func (*FixedSpacer) Render ¶
func (s *FixedSpacer) Render(ctx runtime.RenderContext)
Render is a no-op; the spacer is invisible.
func (*FixedSpacer) StyleType ¶
func (s *FixedSpacer) StyleType() string
StyleType returns the selector type name for stylesheets.
type FlexDirection ¶
type FlexDirection = runtime.FlexDirection
FlexDirection defines the layout axis for flex containers.
type FocusTrap ¶
type FocusTrap struct {
Base
// contains filtered or unexported fields
}
FocusTrap wraps a child widget and constrains Tab/Shift+Tab navigation within the child subtree. This is critical for modal dialogs, drawers, and overlays that must not let keyboard focus escape.
When active, Tab and Shift+Tab cycle only through focusable descendants. When inactive, focus navigation passes through normally.
func NewFocusTrap ¶
NewFocusTrap creates a FocusTrap wrapping the given child widget. The trap starts active by default.
func (*FocusTrap) ChildWidgets ¶
ChildWidgets returns the child widget for tree traversal.
func (*FocusTrap) HandleMessage ¶
func (f *FocusTrap) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage intercepts Tab/Shift+Tab when the trap is active to cycle focus within the child subtree.
func (*FocusTrap) Measure ¶
func (f *FocusTrap) Measure(constraints runtime.Constraints) runtime.Size
Measure returns desired size, delegating to the child.
func (*FocusTrap) PathSegment ¶
PathSegment returns a debug path segment.
func (*FocusTrap) Render ¶
func (f *FocusTrap) Render(ctx runtime.RenderContext)
Render draws the child widget.
func (*FocusTrap) Scope ¶
func (f *FocusTrap) Scope() *runtime.FocusScope
Scope returns the internal focus scope for testing and inspection.
func (*FocusTrap) SetActive ¶
SetActive enables or disables the focus trap. When activated, focus is announced and trapped within children. When deactivated, Tab/Shift+Tab pass through to the parent scope.
type FocusableBase ¶
type FocusableBase struct {
Base
// contains filtered or unexported fields
}
FocusableBase extends Base for focusable widgets.
func (*FocusableBase) Blur ¶
func (f *FocusableBase) Blur()
Blur marks the widget as unfocused and invokes the onBlur hook.
func (*FocusableBase) CanFocus ¶
func (f *FocusableBase) CanFocus() bool
CanFocus returns true for focusable widgets.
func (*FocusableBase) Focus ¶
func (f *FocusableBase) Focus()
Focus marks the widget as focused and invokes the onFocus hook.
func (*FocusableBase) OnBlur ¶
func (f *FocusableBase) OnBlur(fn func())
OnBlur registers a callback that fires when the widget loses focus.
func (*FocusableBase) OnFocus ¶
func (f *FocusableBase) OnFocus(fn func())
OnFocus registers a callback that fires when the widget gains focus.
type Form ¶
type Form struct {
Component
// contains filtered or unexported fields
}
Form is a container widget that manages a set of labeled input fields with validation, error display, and submit handling.
func NewForm ¶
func NewForm(fields ...FormFieldDef) *Form
NewForm creates a new form with the given field definitions.
func (*Form) ChildWidgets ¶
ChildWidgets returns all child widgets for focus traversal and binding.
func (*Form) FieldCount ¶
FieldCount returns the number of fields in the form.
func (*Form) HandleMessage ¶
func (f *Form) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage processes keyboard input for the form.
func (*Form) Measure ¶
func (f *Form) Measure(constraints runtime.Constraints) runtime.Size
Measure returns the size needed for the form.
func (*Form) PathSegment ¶
PathSegment returns a debug path segment for the given child.
func (*Form) Render ¶
func (f *Form) Render(ctx runtime.RenderContext)
Render draws the form to the buffer.
func (*Form) SetCancelLabel ¶
SetCancelLabel sets the label for the cancel button.
func (*Form) SetOnCancel ¶
func (f *Form) SetOnCancel(fn func())
SetOnCancel sets the callback invoked when the form is cancelled.
func (*Form) SetOnSubmit ¶
SetOnSubmit sets the callback invoked when the form is submitted. The callback receives a map of label -> text value for each field.
func (*Form) SetSubmitLabel ¶
SetSubmitLabel sets the label for the submit button.
type FormFieldDef ¶
FormFieldDef defines a labeled form field.
type GPUCanvasOption ¶
type GPUCanvasOption = Option[GPUCanvasWidget]
GPUCanvasOption configures a GPUCanvasWidget.
func WithGPUCanvasBackend ¶
func WithGPUCanvasBackend(backend gpu.Backend) GPUCanvasOption
WithGPUCanvasBackend sets the GPU backend used by the canvas.
func WithGPUCanvasDriver ¶
func WithGPUCanvasDriver(driver gpu.Driver) GPUCanvasOption
WithGPUCanvasDriver sets a specific driver instance.
func WithGPUCanvasEncoder ¶
func WithGPUCanvasEncoder(encoder graphics.TerminalEncoder) GPUCanvasOption
WithGPUCanvasEncoder sets a specific terminal encoder.
type GPUCanvasWidget ¶
type GPUCanvasWidget struct {
Component
// contains filtered or unexported fields
}
GPUCanvasWidget draws using a GPU canvas and image protocols.
func NewGPUCanvasWidget ¶
func NewGPUCanvasWidget(draw func(canvas *gpu.GPUCanvas), opts ...GPUCanvasOption) *GPUCanvasWidget
NewGPUCanvasWidget creates a GPUCanvasWidget with the draw callback.
func (*GPUCanvasWidget) Layout ¶
func (w *GPUCanvasWidget) Layout(bounds runtime.Rect)
Layout updates layout bounds and canvas size.
func (*GPUCanvasWidget) Measure ¶
func (w *GPUCanvasWidget) Measure(constraints runtime.Constraints) runtime.Size
Measure returns the desired size for the widget.
func (*GPUCanvasWidget) Render ¶
func (w *GPUCanvasWidget) Render(ctx runtime.RenderContext)
Render draws the GPU canvas.
func (*GPUCanvasWidget) SetBackend ¶
func (w *GPUCanvasWidget) SetBackend(backend gpu.Backend)
SetBackend sets the GPU backend used by the canvas.
func (*GPUCanvasWidget) SetDriver ¶
func (w *GPUCanvasWidget) SetDriver(driver gpu.Driver)
SetDriver sets a specific driver instance.
func (*GPUCanvasWidget) SetEncoder ¶
func (w *GPUCanvasWidget) SetEncoder(encoder graphics.TerminalEncoder)
SetEncoder sets a specific terminal encoder.
func (*GPUCanvasWidget) WithBackend
deprecated
func (w *GPUCanvasWidget) WithBackend(backend gpu.Backend) *GPUCanvasWidget
Deprecated: prefer WithGPUCanvasBackend during construction or SetBackend for mutation.
func (*GPUCanvasWidget) WithDriver
deprecated
func (w *GPUCanvasWidget) WithDriver(driver gpu.Driver) *GPUCanvasWidget
Deprecated: prefer WithGPUCanvasDriver during construction or SetDriver for mutation.
func (*GPUCanvasWidget) WithEncoder
deprecated
func (w *GPUCanvasWidget) WithEncoder(encoder graphics.TerminalEncoder) *GPUCanvasWidget
Deprecated: prefer WithGPUCanvasEncoder during construction or SetEncoder for mutation.
type GaugeColors ¶
GaugeColors defines the colors used for the animated gauge.
type GaugeSpan ¶
GaugeSpan represents a styled segment for composite rendering.
func DrawGaugeSpans ¶
func DrawGaugeSpans(width int, ratio float64, style GaugeStyle) []GaugeSpan
DrawGaugeSpans returns gauge as styled spans for scrollback integration.
type GaugeStyle ¶
type GaugeStyle struct {
// Fill characters
FillChar rune // Filled portion (default '█')
EmptyChar rune // Empty portion (default '░')
// Gradient thresholds and styles (ascending order)
// Each threshold defines the ratio at which a new color begins
Thresholds []GaugeThreshold
// EmptyStyle for unfilled portion
EmptyStyle backend.Style
// EdgeStyle for the leading edge (optional glow effect)
EdgeStyle backend.Style
}
GaugeStyle defines the visual appearance of a gauge.
func DefaultGaugeStyle ¶
func DefaultGaugeStyle(green, amber, coral, edge, empty backend.Style) GaugeStyle
DefaultGaugeStyle returns a green→amber→coral gradient gauge.
type GaugeThreshold ¶
type GaugeThreshold struct {
Ratio float64 // Start ratio for this color (0.0-1.0)
Style backend.Style // Style for this segment
}
GaugeThreshold defines a color breakpoint in the gradient.
type Grid ¶
type Grid struct {
Base
// Legacy: fixed uniform grid
Rows int
Cols int
// Enhanced: track-based sizing (CSS Grid-like)
ColTracks []TrackSize
RowTracks []TrackSize
Gap int
Children []GridChild
// contains filtered or unexported fields
}
Grid lays out children in rows and columns.
Example ¶
package main
import (
"m31labs.dev/fluffyui/widgets"
)
func main() {
grid := widgets.NewGrid(2, 2)
grid.Gap = 1
grid.Add(widgets.NewLabel("Top"), 0, 0, 1, 2)
grid.Add(widgets.NewLabel("Left"), 1, 0, 1, 1)
grid.Add(widgets.NewLabel("Right"), 1, 1, 1, 1)
_ = grid
}
Output:
func NewTrackGrid ¶
NewTrackGrid creates a grid with explicit column and row track definitions.
func (*Grid) ChildWidgets ¶
ChildWidgets returns grid children.
func (*Grid) HandleMessage ¶
func (g *Grid) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage forwards messages to children.
func (*Grid) Measure ¶
func (g *Grid) Measure(constraints runtime.Constraints) runtime.Size
Measure estimates the grid size.
func (*Grid) PathSegment ¶
PathSegment returns a debug path segment for the given child.
type GridBuilder ¶
type GridBuilder struct {
// contains filtered or unexported fields
}
GridBuilder provides a declarative API for constructing grids.
Usage:
grid := BuildGrid().
Columns(3).
Gap(1).
Row(nameInput, emailInput, phoneInput).
Row(addressInput, cityInput, zipInput).
Build()
func BuildGrid ¶
func BuildGrid() *GridBuilder
BuildGrid starts a new grid builder with a default of 1 column.
func (*GridBuilder) Build ¶
func (b *GridBuilder) Build() *Grid
Build constructs the Grid widget from the builder configuration.
func (*GridBuilder) Columns ¶
func (b *GridBuilder) Columns(n int) *GridBuilder
Columns sets the number of columns in the grid.
func (*GridBuilder) Gap ¶
func (b *GridBuilder) Gap(gap int) *GridBuilder
Gap sets the gap (in cells) between grid children.
func (*GridBuilder) Row ¶
func (b *GridBuilder) Row(children ...runtime.Widget) *GridBuilder
Row adds a row of widgets placed left-to-right into columns. If fewer widgets than columns are provided, the remaining cells are empty. If more widgets than columns are provided, excess widgets are ignored.
func (*GridBuilder) SpanRow ¶
func (b *GridBuilder) SpanRow(child runtime.Widget) *GridBuilder
SpanRow adds a single widget that spans all columns in the row.
type HTMLItemRenderer ¶
HTMLItemRenderer renders a list item as HTML.
type HeatMap ¶
type HeatMap struct {
Base
Data *state.Signal[[][]float64]
RowLabels []string
ColLabels []string
ColorScale ColorScale
CellWidth int // width per cell (default 3)
ShowValues bool // show numeric values in cells
// contains filtered or unexported fields
}
HeatMap displays a 2D grid of values as color-coded cells.
func NewHeatMap ¶
NewHeatMap creates a heat map widget.
func (*HeatMap) HandleMessage ¶
func (hm *HeatMap) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage returns unhandled.
func (*HeatMap) Measure ¶
func (hm *HeatMap) Measure(constraints runtime.Constraints) runtime.Size
Measure returns desired size.
func (*HeatMap) Render ¶
func (hm *HeatMap) Render(ctx runtime.RenderContext)
Render draws the heat map.
type Image ¶
type Image struct {
Base
// contains filtered or unexported fields
}
Image displays an image in the terminal.
func NewImageFromFile ¶
NewImageFromFile creates an Image widget by loading an image from a file.
func (*Image) HandleMessage ¶
func (w *Image) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage returns unhandled (non-interactive widget).
func (*Image) Measure ¶
func (w *Image) Measure(constraints runtime.Constraints) runtime.Size
Measure returns the desired size based on the image aspect ratio and the selected terminal transport's pixel density.
func (*Image) Protocol ¶
func (w *Image) Protocol() ImageProtocol
Protocol returns the current protocol setting.
func (*Image) Render ¶
func (w *Image) Render(ctx runtime.RenderContext)
Render draws the image through the selected terminal protocol or text fallback.
func (*Image) SetProtocol ¶
func (w *Image) SetProtocol(proto ImageProtocol)
SetProtocol sets the image rendering protocol.
type ImageFit ¶
type ImageFit int
ImageFit controls how images are sized within their bounds.
const ( // ImageFitContain fits the image within bounds, preserving aspect ratio. ImageFitContain ImageFit = iota // ImageFitCover fills the bounds, cropping any excess. ImageFitCover // ImageFitFill stretches the image to fill the bounds exactly. ImageFitFill // ImageFitScaleDown behaves like Contain but never upscales. ImageFitScaleDown )
type ImageProtocol ¶
type ImageProtocol int
ImageProtocol selects the terminal image protocol.
const ( // ImageProtocolAuto detects the best available protocol. ImageProtocolAuto ImageProtocol = iota // ImageProtocolKitty uses the Kitty image protocol. ImageProtocolKitty // ImageProtocolSixel uses the Sixel graphics protocol. ImageProtocolSixel // ImageProtocolITerm2 uses the iTerm2 inline image protocol. ImageProtocolITerm2 // ImageProtocolHalfBlock uses Unicode half-block character fallback. ImageProtocolHalfBlock )
type Input ¶
type Input struct {
FocusableBase
// contains filtered or unexported fields
}
Input is a text input widget with cursor support.
Example ¶
package main
import (
"m31labs.dev/fluffyui/widgets"
)
func main() {
input := widgets.NewInput()
input.SetPlaceholder("Search...")
input.SetText("fluffy")
input.SetOnSubmit(func(text string) {})
_ = input
}
Output:
func NewInput ¶
func NewInput() *Input
NewInput creates a single-line text input with cursor, selection, and undo/redo. Configure with SetPlaceholder, SetOnSubmit, and SetOnChange.
func (*Input) ClearHistory ¶
func (i *Input) ClearHistory()
ClearHistory resets the undo/redo history.
func (*Input) ClipboardCopy ¶
ClipboardCopy returns selected text, or all text if no selection.
func (*Input) ClipboardCut ¶
ClipboardCut returns selected text and deletes it, or all text if no selection.
func (*Input) ClipboardPaste ¶
ClipboardPaste inserts text at the cursor.
func (*Input) CursorOffset ¶
CursorOffset returns the current cursor offset (alias for CursorPos).
func (*Input) CursorPosition ¶
CursorPosition returns the cursor coordinates within the input.
func (*Input) CursorWordLeft ¶
func (i *Input) CursorWordLeft()
CursorWordLeft moves the cursor to the previous word boundary.
func (*Input) CursorWordRight ¶
func (i *Input) CursorWordRight()
CursorWordRight moves the cursor to the next word boundary.
func (*Input) GetSelectedText ¶
GetSelectedText returns the currently selected text.
func (*Input) GetSelection ¶
GetSelection returns the current selection range.
func (*Input) HandleMessage ¶
func (i *Input) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage processes keyboard input.
func (*Input) HasSelection ¶
HasSelection returns true if text is selected.
func (*Input) Measure ¶
func (i *Input) Measure(constraints runtime.Constraints) runtime.Size
Measure returns the size needed for the input.
func (*Input) Render ¶
func (i *Input) Render(ctx runtime.RenderContext)
Render draws the input field.
func (*Input) SelectLine ¶
func (i *Input) SelectLine()
SelectLine selects the entire line (all text for single-line input).
func (*Input) SelectWord ¶
func (i *Input) SelectWord()
SelectWord selects the word at the cursor position.
func (*Input) SetCursorOffset ¶
SetCursorOffset moves the cursor to the given offset.
func (*Input) SetCursorPosition ¶
SetCursorPosition moves the cursor to the given coordinates.
func (*Input) SetFocusStyle ¶
SetFocusStyle sets the focused style.
func (*Input) SetHistoryEnabled ¶
SetHistoryEnabled enables or disables undo/redo support.
func (*Input) SetHistoryOptions ¶
func (i *Input) SetHistoryOptions(opts ...state.HistoryOption)
SetHistoryOptions reconfigures the history with new options.
func (*Input) SetOnChange ¶
SetOnChange sets the callback for when text changes.
func (*Input) SetOnSubmit ¶
SetOnSubmit sets the callback for when Enter is pressed.
func (*Input) SetPlaceholder ¶
SetPlaceholder sets the placeholder text shown when empty.
func (*Input) SetSelection ¶
SetSelection sets the selection range.
func (*Input) SetValidators ¶
SetValidators updates validation rules for the input.
func (*Input) Validate ¶
func (i *Input) Validate() []forms.ValidationError
Validate runs validation rules and returns validation errors.
type Inspector ¶
type Inspector struct {
FocusableBase
// contains filtered or unexported fields
}
Inspector displays a two-column overlay showing the widget tree and properties of the selected widget. It can inspect any widget tree provided via SetRoot.
func NewInspector ¶
func NewInspector(root runtime.Widget, opts ...InspectorOption) *Inspector
NewInspector creates a new Inspector widget. If root is non-nil the tree is built immediately.
func (*Inspector) HandleMessage ¶
func (ins *Inspector) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage processes keyboard input.
func (*Inspector) Measure ¶
func (ins *Inspector) Measure(constraints runtime.Constraints) runtime.Size
Measure takes all available space.
func (*Inspector) Refresh ¶
func (ins *Inspector) Refresh()
Refresh rebuilds the tree from the current root.
func (*Inspector) Render ¶
func (ins *Inspector) Render(ctx runtime.RenderContext)
Render draws the two-column inspector overlay.
func (*Inspector) SelectedEntry ¶
func (ins *Inspector) SelectedEntry() inspectorEntry
SelectedEntry returns the inspectorEntry at the current selection, or a zero value if out of range.
type InspectorOption ¶
InspectorOption configures an Inspector.
type Label ¶
type Label struct {
Base
// contains filtered or unexported fields
}
Label is a single-line text widget often used for headers/labels.
Example ¶
package main
import (
"m31labs.dev/fluffyui/widgets"
)
func main() {
label := widgets.NewLabel("Title")
label.SetAlignment(widgets.AlignCenter)
_ = label
}
Output:
func NewLabel ¶
func NewLabel(text string, opts ...LabelOption) *Label
NewLabel creates a new label widget.
func (*Label) Direction ¶
Direction returns the effective text direction. If a direction was explicitly set, it returns that. Otherwise, it auto-detects from the text content.
func (*Label) Measure ¶
func (l *Label) Measure(constraints runtime.Constraints) runtime.Size
Measure returns the size needed for the label.
func (*Label) RenderHTML ¶
func (l *Label) RenderHTML(ctx runtime.HTMLContext) runtime.HTML
RenderHTML returns a static HTML representation of the label.
func (*Label) SetA11yLabel ¶
SetA11yLabel overrides the accessibility label without changing visible text.
func (*Label) SetAlignment ¶
SetAlignment sets text alignment.
func (*Label) SetDirection ¶
SetDirection sets an explicit text direction override. Pass DirectionRTL for right-to-left or DirectionLTR for left-to-right. When set, auto-detection is bypassed.
func (*Label) WithAlignment
deprecated
type LabelOption ¶
LabelOption configures a Label widget.
func WithLabelA11yLabel ¶
func WithLabelA11yLabel(label string) LabelOption
WithLabelA11yLabel sets an accessibility label override.
func WithLabelAlignment ¶
func WithLabelAlignment(align Alignment) LabelOption
WithLabelAlignment sets the label alignment.
func WithLabelDirection ¶
func WithLabelDirection(dir i18n.Direction) LabelOption
WithLabelDirection sets an explicit text direction (DirectionLTR or DirectionRTL). When set, auto-detection is bypassed for rendering.
func WithLabelStyle ¶
func WithLabelStyle(style backend.Style) LabelOption
WithLabelStyle sets the label style.
type LazyLoadable ¶
type LazyLoadable interface {
SetLazyLoad(fn func(start, end, total int))
SetLazyLoadThreshold(threshold int)
}
LazyLoadable represents widgets that can request more data as users scroll.
type LineChart ¶
type LineChart struct {
CanvasWidget
// contains filtered or unexported fields
}
LineChart renders one or more series using a CanvasWidget.
func (*LineChart) AddSeries ¶
func (c *LineChart) AddSeries(series ChartSeries)
AddSeries appends a new series.
func (*LineChart) AutoYAxis ¶
func (c *LineChart) AutoYAxis()
AutoYAxis enables auto-scaling on the Y axis.
func (*LineChart) HandleMessage ¶
func (c *LineChart) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage returns unhandled for all messages.
func (*LineChart) Measure ¶
func (c *LineChart) Measure(constraints runtime.Constraints) runtime.Size
Measure keeps the chart flexible within constraints.
func (*LineChart) Render ¶
func (c *LineChart) Render(ctx runtime.RenderContext)
Render draws the line chart to the buffer.
func (*LineChart) SetSeries ¶
func (c *LineChart) SetSeries(series []ChartSeries)
SetSeries replaces the chart series.
type Link ¶
type Link struct {
FocusableBase
// contains filtered or unexported fields
}
Link is a focusable text widget that renders as an OSC-8 hyperlink. In terminals that support OSC-8, the text becomes clickable.
func (*Link) HandleMessage ¶
func (l *Link) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage processes input events.
func (*Link) Measure ¶
func (l *Link) Measure(constraints runtime.Constraints) runtime.Size
Measure returns the size needed to display the link text.
func (*Link) Render ¶
func (l *Link) Render(ctx runtime.RenderContext)
Render draws the link text with underline styling.
func (*Link) RenderHTML ¶
func (l *Link) RenderHTML(ctx runtime.HTMLContext) runtime.HTML
RenderHTML returns a static HTML representation of the link.
func (*Link) SetFocusStyle ¶
SetFocusStyle sets the focused style.
func (*Link) SetOnActivate ¶
SetOnActivate sets the callback when the link is activated (Enter key).
type List ¶
type List[T any] struct { FocusableBase // contains filtered or unexported fields }
List renders a list of items.
Example ¶
package main
import (
"m31labs.dev/fluffyui/backend"
"m31labs.dev/fluffyui/runtime"
"m31labs.dev/fluffyui/widgets"
)
func main() {
items := []string{"alpha", "beta", "gamma"}
adapter := widgets.NewSliceAdapter(items, func(item string, index int, selected bool, ctx runtime.RenderContext) {
prefix := " "
if selected {
prefix = "> "
}
ctx.Buffer.SetString(ctx.Bounds.X, ctx.Bounds.Y, prefix+item, backend.DefaultStyle())
})
list := widgets.NewList(adapter)
list.SetSelected(1)
_ = list
}
Output:
func (*List[T]) DragOrigin ¶
DragOrigin returns the index of the item being dragged, or -1 if no drag is active.
func (*List[T]) DropIndex ¶
DropIndex returns the current drop target index, or -1 if no drag is active.
func (*List[T]) HandleMessage ¶
func (l *List[T]) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage handles navigation and drag-and-drop.
func (*List[T]) IsDraggable ¶
IsDraggable reports whether drag-and-drop reordering is enabled.
func (*List[T]) IsDragging ¶
IsDragging reports whether a drag operation is currently in progress.
func (*List[T]) Measure ¶
func (l *List[T]) Measure(constraints runtime.Constraints) runtime.Size
Measure returns the desired size.
func (*List[T]) Render ¶
func (l *List[T]) Render(ctx runtime.RenderContext)
Render draws list items.
func (*List[T]) RenderHTML ¶
func (l *List[T]) RenderHTML(ctx runtime.HTMLContext) runtime.HTML
RenderHTML renders the list as a static HTML unordered list.
func (*List[T]) ScrollToStart ¶
func (l *List[T]) ScrollToStart()
ScrollToStart scrolls to the first item.
func (*List[T]) SelectedIndex ¶
SelectedIndex returns the current selection index.
func (*List[T]) SelectedItem ¶
SelectedItem returns the selected item.
func (*List[T]) SetDragStyle ¶
SetDragStyle updates the style used for the item being dragged.
func (*List[T]) SetDraggable ¶
SetDraggable enables or disables drag-and-drop reordering. When enabled, the user can press Ctrl+G to grab a selected item, use arrow keys to move the drop indicator, Enter to drop (reorder), or Escape to cancel.
func (*List[T]) SetHTMLItemRenderer ¶
func (l *List[T]) SetHTMLItemRenderer(r HTMLItemRenderer[T])
SetHTMLItemRenderer sets a custom HTML renderer for list items.
func (*List[T]) SetOnDrop ¶
func (l *List[T]) SetOnDrop(fn ListOnDrop[T])
SetOnDrop registers a handler called when a drop completes.
func (*List[T]) SetOnSelect ¶
SetOnSelect registers a selection handler.
func (*List[T]) SetSelected ¶
SetSelected updates the selected index.
func (*List[T]) SetSelectedStyle ¶
SetSelectedStyle updates the selected row style.
type ListAdapter ¶
type ListAdapter[T any] interface { Count() int Item(index int) T Render(item T, index int, selected bool, ctx runtime.RenderContext) }
ListAdapter provides data for list widgets.
func NewSignalAdapter ¶
func NewSignalAdapter[T any](items *state.Signal[[]T], render RenderFunc[T]) ListAdapter[T]
NewSignalAdapter creates a signal adapter.
func NewSliceAdapter ¶
func NewSliceAdapter[T any](items []T, render RenderFunc[T]) ListAdapter[T]
NewSliceAdapter creates a slice adapter.
type ListOnDrop ¶
ListOnDrop is called when a drop completes on a list. It receives the source index, destination index, and the item that was moved.
type Log ¶
type Log struct {
FocusableBase
// contains filtered or unexported fields
}
Log is an auto-scrolling log viewer widget with filtering and level-based coloring.
func (*Log) AutoScroll ¶
AutoScroll returns whether auto-scrolling is enabled.
func (*Log) ClipboardCopy ¶
ClipboardCopy returns visible log entries for copying.
func (*Log) EntryCount ¶
EntryCount returns the number of entries in the log.
func (*Log) FilteredEntries ¶
FilteredEntries returns entries that pass the current filter.
func (*Log) HandleMessage ¶
func (l *Log) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage handles keyboard input.
func (*Log) Measure ¶
func (l *Log) Measure(constraints runtime.Constraints) runtime.Size
Measure returns the desired size.
func (*Log) ScrollToStart ¶
func (l *Log) ScrollToStart()
ScrollToStart scrolls to the oldest entries.
func (*Log) SetAutoScroll ¶
SetAutoScroll enables or disables auto-scrolling.
func (*Log) SetLevelStyle ¶
SetLevelStyle sets the style for a specific level.
func (*Log) SetMinLevel ¶
SetMinLevel sets the minimum level to display.
func (*Log) SetShowTime ¶
SetShowTime enables or disables timestamp display.
type LogOption ¶
type LogOption func(*Log)
LogOption is a functional option for Log.
func WithAutoScroll ¶
WithAutoScroll enables or disables auto-scrolling.
func WithLevelColors ¶
WithLevelColors sets custom level-based colors.
func WithLogFilter ¶
WithLogFilter sets a custom filter function.
func WithMaxLines ¶
WithMaxLines sets the maximum number of lines to keep.
func WithMinLevel ¶
WithMinLevel sets the minimum level to display.
func WithShowTime ¶
WithShowTime enables or disables timestamp display.
type MarkdownViewer ¶
type MarkdownViewer struct {
FocusableBase
// contains filtered or unexported fields
}
MarkdownViewer renders markdown content as styled terminal text. Supports headings, bold, italic, code blocks, links, lists, tables, and blockquotes. Content is scrollable when it exceeds the available height.
func NewMarkdownViewer ¶
func NewMarkdownViewer(content string, opts ...MarkdownViewerOption) *MarkdownViewer
NewMarkdownViewer creates a new MarkdownViewer widget.
func (*MarkdownViewer) Content ¶
func (m *MarkdownViewer) Content() string
Content returns the raw markdown content.
func (*MarkdownViewer) HandleMessage ¶
func (m *MarkdownViewer) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage handles scroll input.
func (*MarkdownViewer) Layout ¶
func (m *MarkdownViewer) Layout(bounds runtime.Rect)
Layout stores bounds and updates wrapping.
func (*MarkdownViewer) Measure ¶
func (m *MarkdownViewer) Measure(constraints runtime.Constraints) runtime.Size
Measure returns the required size.
func (*MarkdownViewer) Render ¶
func (m *MarkdownViewer) Render(ctx runtime.RenderContext)
Render draws the visible lines.
func (*MarkdownViewer) RenderHTML ¶
func (m *MarkdownViewer) RenderHTML(ctx runtime.HTMLContext) runtime.HTML
RenderHTML renders the markdown content as static HTML.
func (*MarkdownViewer) ScrollBy ¶
func (m *MarkdownViewer) ScrollBy(dx, dy int)
ScrollBy scrolls the content by delta.
func (*MarkdownViewer) ScrollTo ¶
func (m *MarkdownViewer) ScrollTo(x, y int)
ScrollTo scrolls to an absolute offset.
func (*MarkdownViewer) ScrollToEnd ¶
func (m *MarkdownViewer) ScrollToEnd()
ScrollToEnd scrolls to the bottom.
func (*MarkdownViewer) ScrollToStart ¶
func (m *MarkdownViewer) ScrollToStart()
ScrollToStart scrolls to the top.
func (*MarkdownViewer) SetContent ¶
func (m *MarkdownViewer) SetContent(content string)
SetContent updates the markdown content.
func (*MarkdownViewer) StyleType ¶
func (m *MarkdownViewer) StyleType() string
StyleType returns the selector type name.
type MarkdownViewerOption ¶
type MarkdownViewerOption = Option[MarkdownViewer]
MarkdownViewerOption configures a MarkdownViewer widget.
func WithMarkdownMaxWidth ¶
func WithMarkdownMaxWidth(width int) MarkdownViewerOption
WithMarkdownMaxWidth sets a maximum content width for readability. Lines will be wrapped at this width even if more space is available. A value of 0 disables the limit (uses full available width).
func WithMarkdownTheme ¶
func WithMarkdownTheme(t *theme.Theme) MarkdownViewerOption
WithMarkdownTheme sets a custom theme for markdown rendering.
func WithWordWrap ¶
func WithWordWrap(enabled bool) MarkdownViewerOption
WithWordWrap enables or disables word wrapping.
type MaskedInput ¶
type MaskedInput struct {
FocusableBase
// contains filtered or unexported fields
}
MaskedInput is a text input widget with a format mask. The mask defines the expected format for input using special characters:
- # = digit (0-9)
- A = letter (a-zA-Z)
- * = alphanumeric (letter or digit)
- ? = any character
- \ = escape next character as literal
Any other character in the mask is treated as a literal that is automatically inserted and cannot be edited.
func NewMaskedInput ¶
func NewMaskedInput(mask string, opts ...MaskedInputOption) *MaskedInput
NewMaskedInput creates a new masked input widget.
func (*MaskedInput) Bind ¶
func (m *MaskedInput) Bind(services runtime.Services)
Bind attaches app services.
func (*MaskedInput) Blur ¶
func (m *MaskedInput) Blur()
Blur removes focus and announces validation errors if any.
func (*MaskedInput) ClipboardCopy ¶
func (m *MaskedInput) ClipboardCopy() (string, bool)
ClipboardCopy returns the masked value for copying.
func (*MaskedInput) ClipboardCut ¶
func (m *MaskedInput) ClipboardCut() (string, bool)
ClipboardCut returns the masked value and clears the input.
func (*MaskedInput) ClipboardPaste ¶
func (m *MaskedInput) ClipboardPaste(text string) bool
ClipboardPaste inserts text, extracting valid characters.
func (*MaskedInput) CursorPos ¶
func (m *MaskedInput) CursorPos() int
CursorPos returns the current cursor position in the masked display.
func (*MaskedInput) Errors ¶
func (m *MaskedInput) Errors() []string
Errors returns the latest validation error messages.
func (*MaskedInput) HandleMessage ¶
func (m *MaskedInput) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage processes keyboard input.
func (*MaskedInput) Layout ¶
func (m *MaskedInput) Layout(bounds runtime.Rect)
Layout stores the assigned bounds.
func (*MaskedInput) Mask ¶
func (m *MaskedInput) Mask() string
Mask returns the current mask pattern.
func (*MaskedInput) MaskedValue ¶
func (m *MaskedInput) MaskedValue() string
MaskedValue returns the formatted value with mask characters included.
func (*MaskedInput) Measure ¶
func (m *MaskedInput) Measure(constraints runtime.Constraints) runtime.Size
Measure returns the size needed for the input.
func (*MaskedInput) Placeholder ¶
func (m *MaskedInput) Placeholder() rune
Placeholder returns the placeholder character.
func (*MaskedInput) Render ¶
func (m *MaskedInput) Render(ctx runtime.RenderContext)
Render draws the masked input field.
func (*MaskedInput) SetFocusStyle ¶
func (m *MaskedInput) SetFocusStyle(style backend.Style)
SetFocusStyle sets the focused style.
func (*MaskedInput) SetLabel ¶
func (m *MaskedInput) SetLabel(label string)
SetLabel sets the accessibility label.
func (*MaskedInput) SetMask ¶
func (m *MaskedInput) SetMask(mask string)
SetMask updates the mask pattern.
func (*MaskedInput) SetOnChange ¶
func (m *MaskedInput) SetOnChange(fn func(value string))
SetOnChange sets the callback for when value changes.
func (*MaskedInput) SetOnSubmit ¶
func (m *MaskedInput) SetOnSubmit(fn func(value string))
SetOnSubmit sets the callback for when Enter is pressed.
func (*MaskedInput) SetPlaceholder ¶
func (m *MaskedInput) SetPlaceholder(r rune)
SetPlaceholder sets the placeholder character.
func (*MaskedInput) SetStyle ¶
func (m *MaskedInput) SetStyle(style backend.Style)
SetStyle sets the normal style.
func (*MaskedInput) SetValidators ¶
func (m *MaskedInput) SetValidators(validators ...forms.Validator)
SetValidators updates validation rules.
func (*MaskedInput) SetValue ¶
func (m *MaskedInput) SetValue(value string)
SetValue sets the raw value (without mask characters).
func (*MaskedInput) StyleType ¶
func (m *MaskedInput) StyleType() string
StyleType returns the selector type name.
func (*MaskedInput) Valid ¶
func (m *MaskedInput) Valid() bool
Valid reports whether validation passes.
func (*MaskedInput) Validate ¶
func (m *MaskedInput) Validate() []forms.ValidationError
Validate runs validation rules and returns validation errors.
func (*MaskedInput) Value ¶
func (m *MaskedInput) Value() string
Value returns the raw input value without mask characters.
type MaskedInputOption ¶
type MaskedInputOption func(*MaskedInput)
MaskedInputOption is a functional option for MaskedInput.
func WithMaskedFocusStyle ¶
func WithMaskedFocusStyle(s backend.Style) MaskedInputOption
WithMaskedFocusStyle sets the focused style.
func WithMaskedLabel ¶
func WithMaskedLabel(label string) MaskedInputOption
WithMaskedLabel sets the accessibility label.
func WithMaskedStyle ¶
func WithMaskedStyle(s backend.Style) MaskedInputOption
WithMaskedStyle sets the normal style.
func WithPlaceholder ¶
func WithPlaceholder(r rune) MaskedInputOption
WithPlaceholder sets the placeholder character for unfilled positions.
type Menu ¶
type Menu struct {
FocusableBase
Items []*MenuItem
// contains filtered or unexported fields
}
Menu renders a vertical menu.
Example ¶
package main
import (
"m31labs.dev/fluffyui/widgets"
)
func main() {
menu := widgets.NewMenu(
&widgets.MenuItem{Title: "Open", Shortcut: "Ctrl+O"},
&widgets.MenuItem{Title: "Save", Shortcut: "Ctrl+S"},
)
_ = menu
}
Output:
func (*Menu) HandleMessage ¶
func (m *Menu) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage handles navigation and selection.
func (*Menu) Measure ¶
func (m *Menu) Measure(constraints runtime.Constraints) runtime.Size
Measure returns desired size.
func (*Menu) SetSelectedStyle ¶
SetSelectedStyle updates the selected row style.
type MenuItem ¶
type MenuItem struct {
ID string
Title string
Shortcut string
Children []*MenuItem
Expanded bool
Disabled bool
OnSelect func()
}
MenuItem describes a menu entry.
type MultiSelect ¶
type MultiSelect struct {
FocusableBase
// contains filtered or unexported fields
}
MultiSelect renders a list of options with multiple selection.
func NewMultiSelect ¶
func NewMultiSelect(options ...MultiSelectOption) *MultiSelect
NewMultiSelect creates a new multi-select list.
func (*MultiSelect) Bind ¶
func (m *MultiSelect) Bind(services runtime.Services)
Bind attaches app services.
func (*MultiSelect) HandleMessage ¶
func (m *MultiSelect) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage processes navigation and toggling.
func (*MultiSelect) Measure ¶
func (m *MultiSelect) Measure(constraints runtime.Constraints) runtime.Size
Measure returns desired size.
func (*MultiSelect) Render ¶
func (m *MultiSelect) Render(ctx runtime.RenderContext)
Render draws the options list.
func (*MultiSelect) SelectedOptions ¶
func (m *MultiSelect) SelectedOptions() []MultiSelectOption
SelectedOptions returns the currently selected options.
func (*MultiSelect) SetLabel ¶
func (m *MultiSelect) SetLabel(label string)
SetLabel updates the accessibility label.
func (*MultiSelect) SetOnChange ¶
func (m *MultiSelect) SetOnChange(fn func(selected []MultiSelectOption))
SetOnChange registers a change callback.
func (*MultiSelect) SetOptions ¶
func (m *MultiSelect) SetOptions(options []MultiSelectOption)
SetOptions updates the list of options.
func (*MultiSelect) StyleType ¶
func (m *MultiSelect) StyleType() string
StyleType returns the selector type name.
type MultiSelectOption ¶
MultiSelectOption represents an option in a multi-select list.
type MultilineInput ¶
type MultilineInput struct {
FocusableBase
// contains filtered or unexported fields
}
MultilineInput is a text input that supports multiple lines.
func NewMultilineInput ¶
func NewMultilineInput() *MultilineInput
NewMultilineInput creates a new multiline input widget.
func (*MultilineInput) Bind ¶
func (m *MultilineInput) Bind(services runtime.Services)
Bind attaches app services.
func (*MultilineInput) ClipboardCopy ¶
func (m *MultilineInput) ClipboardCopy() (string, bool)
ClipboardCopy returns selected text, or all text if no selection.
func (*MultilineInput) ClipboardCut ¶
func (m *MultilineInput) ClipboardCut() (string, bool)
ClipboardCut returns selected text and deletes it, or all text if no selection.
func (*MultilineInput) ClipboardPaste ¶
func (m *MultilineInput) ClipboardPaste(text string) bool
ClipboardPaste inserts text at the cursor.
func (*MultilineInput) CursorOffset ¶
func (m *MultilineInput) CursorOffset() int
CursorOffset returns the cursor offset in the full text.
func (*MultilineInput) CursorPosition ¶
func (m *MultilineInput) CursorPosition() (x, y int)
CursorPosition returns the cursor coordinates within the input.
func (*MultilineInput) CursorWordLeft ¶
func (m *MultilineInput) CursorWordLeft()
CursorWordLeft moves the cursor to the previous word boundary.
func (*MultilineInput) CursorWordRight ¶
func (m *MultilineInput) CursorWordRight()
CursorWordRight moves the cursor to the next word boundary.
func (*MultilineInput) Errors ¶
func (m *MultilineInput) Errors() []string
Errors returns the latest validation error messages.
func (*MultilineInput) GetSelectedText ¶
func (m *MultilineInput) GetSelectedText() string
GetSelectedText returns the currently selected text.
func (*MultilineInput) GetSelection ¶
func (m *MultilineInput) GetSelection() Selection
GetSelection returns the current selection range (character offsets).
func (*MultilineInput) HandleMessage ¶
func (m *MultilineInput) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage processes input for multiline editing.
func (*MultilineInput) HasSelection ¶
func (m *MultilineInput) HasSelection() bool
HasSelection returns true if text is selected.
func (*MultilineInput) Measure ¶
func (m *MultilineInput) Measure(constraints runtime.Constraints) runtime.Size
Measure returns the preferred size.
func (*MultilineInput) OnChange
deprecated
func (m *MultilineInput) OnChange(fn func(text string))
OnChange sets the callback for when the multiline input text changes.
Deprecated: Use SetOnChange instead. This method will be removed in v1.0.
func (*MultilineInput) OnSubmit
deprecated
func (m *MultilineInput) OnSubmit(fn func(text string))
OnSubmit sets the callback for when Ctrl+Enter is pressed.
Deprecated: Use SetOnSubmit instead. This method will be removed in v1.0.
func (*MultilineInput) Render ¶
func (m *MultilineInput) Render(ctx runtime.RenderContext)
Render draws the multiline input.
func (*MultilineInput) SelectLine ¶
func (m *MultilineInput) SelectLine()
SelectLine selects the current line.
func (*MultilineInput) SelectNone ¶
func (m *MultilineInput) SelectNone()
SelectNone clears the selection.
func (*MultilineInput) SelectWord ¶
func (m *MultilineInput) SelectWord()
SelectWord selects the word at the cursor position.
func (*MultilineInput) SetCursorOffset ¶
func (m *MultilineInput) SetCursorOffset(offset int)
SetCursorOffset moves the cursor to the given offset.
func (*MultilineInput) SetCursorPosition ¶
func (m *MultilineInput) SetCursorPosition(x, y int)
SetCursorPosition moves the cursor to the given coordinates.
func (*MultilineInput) SetFocusStyle ¶
func (m *MultilineInput) SetFocusStyle(style backend.Style)
SetFocusStyle sets the focused style.
func (*MultilineInput) SetLabel ¶
func (m *MultilineInput) SetLabel(label string)
SetLabel sets the accessibility label.
func (*MultilineInput) SetOnChange ¶
func (m *MultilineInput) SetOnChange(fn func(text string))
SetOnChange sets the callback for when text changes.
func (*MultilineInput) SetOnSubmit ¶
func (m *MultilineInput) SetOnSubmit(fn func(text string))
SetOnSubmit sets the callback (Ctrl+Enter to submit).
func (*MultilineInput) SetSelection ¶
func (m *MultilineInput) SetSelection(sel Selection)
SetSelection sets the selection range (character offsets).
func (*MultilineInput) SetStyle ¶
func (m *MultilineInput) SetStyle(style backend.Style)
SetStyle sets the normal style.
func (*MultilineInput) SetText ¶
func (m *MultilineInput) SetText(text string)
SetText sets the content.
func (*MultilineInput) SetValidators ¶
func (m *MultilineInput) SetValidators(validators ...forms.Validator)
SetValidators updates validation rules for the multiline input.
func (*MultilineInput) StyleType ¶
func (m *MultilineInput) StyleType() string
StyleType returns the selector type name.
func (*MultilineInput) Text ¶
func (m *MultilineInput) Text() string
Text returns the full text content.
func (*MultilineInput) Valid ¶
func (m *MultilineInput) Valid() bool
Valid reports whether validation passes.
func (*MultilineInput) Validate ¶
func (m *MultilineInput) Validate() []forms.ValidationError
Validate runs validation rules and returns validation errors.
type MutableListAdapter ¶
type MutableListAdapter[T any] interface { ListAdapter[T] // Move moves the item at fromIndex to toIndex, shifting other items as needed. Move(fromIndex, toIndex int) }
MutableListAdapter extends ListAdapter with mutation support for drag-and-drop reordering.
type MutableSliceAdapter ¶
type MutableSliceAdapter[T any] struct { SliceAdapter[T] }
MutableSliceAdapter adapts a mutable slice to a MutableListAdapter.
func NewMutableSliceAdapter ¶
func NewMutableSliceAdapter[T any](items []T, render RenderFunc[T]) *MutableSliceAdapter[T]
NewMutableSliceAdapter creates a mutable slice adapter.
func (*MutableSliceAdapter[T]) Items ¶
func (m *MutableSliceAdapter[T]) Items() []T
Items returns the current slice (useful for reading back after reorder).
func (*MutableSliceAdapter[T]) Move ¶
func (m *MutableSliceAdapter[T]) Move(fromIndex, toIndex int)
Move moves an item from one index to another.
type Notification ¶
type Notification struct {
ID string
Title string
Body string
Level NotificationLevel
Time time.Time
Read bool
Actions []NotificationAction
}
Notification represents a persistent notification entry.
type NotificationAction ¶
type NotificationAction struct {
Label string
OnClick func()
}
NotificationAction represents an optional action button on a notification.
type NotificationCenter ¶
type NotificationCenter struct {
FocusableBase
// contains filtered or unexported fields
}
NotificationCenter is a persistent, dismissible notification panel. When collapsed it shows an unread count badge; when expanded it shows a navigable list of notifications.
func NewNotificationCenter ¶
func NewNotificationCenter() *NotificationCenter
NewNotificationCenter creates a new notification center widget.
func (*NotificationCenter) Add ¶
func (nc *NotificationCenter) Add(n Notification)
Add adds a notification. It announces new notifications via the a11y announcer.
func (*NotificationCenter) AddSimple ¶
func (nc *NotificationCenter) AddSimple(level NotificationLevel, title, body string)
AddSimple is a convenience helper that creates a notification with an auto-generated ID.
func (*NotificationCenter) Bind ¶
func (nc *NotificationCenter) Bind(services runtime.Services)
Bind attaches app services.
func (*NotificationCenter) Dismiss ¶
func (nc *NotificationCenter) Dismiss(id string)
Dismiss removes a notification by ID.
func (*NotificationCenter) DismissAll ¶
func (nc *NotificationCenter) DismissAll()
DismissAll clears all notifications.
func (*NotificationCenter) Expanded ¶
func (nc *NotificationCenter) Expanded() bool
Expanded returns whether the panel is currently open.
func (*NotificationCenter) HandleMessage ¶
func (nc *NotificationCenter) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage handles keyboard input for navigation and actions.
func (*NotificationCenter) MarkAllRead ¶
func (nc *NotificationCenter) MarkAllRead()
MarkAllRead marks all notifications as read.
func (*NotificationCenter) MarkRead ¶
func (nc *NotificationCenter) MarkRead(id string)
MarkRead marks a notification as read by ID.
func (*NotificationCenter) Measure ¶
func (nc *NotificationCenter) Measure(constraints runtime.Constraints) runtime.Size
Measure returns the desired size.
func (*NotificationCenter) Notifications ¶
func (nc *NotificationCenter) Notifications() []Notification
Notifications returns a copy of all notifications.
func (*NotificationCenter) Render ¶
func (nc *NotificationCenter) Render(ctx runtime.RenderContext)
Render draws the notification center.
func (*NotificationCenter) Selected ¶
func (nc *NotificationCenter) Selected() int
Selected returns the currently selected index.
func (*NotificationCenter) SetExpanded ¶
func (nc *NotificationCenter) SetExpanded(expanded bool)
SetExpanded opens or closes the notification panel.
func (*NotificationCenter) SetHeaderStyle ¶
func (nc *NotificationCenter) SetHeaderStyle(style backend.Style)
SetHeaderStyle sets the style for the header line.
func (*NotificationCenter) SetLabel ¶
func (nc *NotificationCenter) SetLabel(label string)
SetLabel sets the accessibility label.
func (*NotificationCenter) SetMaxItems ¶
func (nc *NotificationCenter) SetMaxItems(max int)
SetMaxItems sets the maximum number of notifications to retain. Older notifications are dropped when the cap is exceeded.
func (*NotificationCenter) SetOnDismiss ¶
func (nc *NotificationCenter) SetOnDismiss(fn func(id string))
SetOnDismiss registers a callback invoked when a notification is dismissed.
func (*NotificationCenter) SetSelectedStyle ¶
func (nc *NotificationCenter) SetSelectedStyle(style backend.Style)
SetSelectedStyle sets the style for the selected notification row.
func (*NotificationCenter) SetStyle ¶
func (nc *NotificationCenter) SetStyle(style backend.Style)
SetStyle sets the base rendering style.
func (*NotificationCenter) StyleType ¶
func (nc *NotificationCenter) StyleType() string
StyleType returns the selector type name.
func (*NotificationCenter) Unbind ¶
func (nc *NotificationCenter) Unbind()
Unbind releases app services.
func (*NotificationCenter) UnreadCount ¶
func (nc *NotificationCenter) UnreadCount() int
UnreadCount returns the number of unread notifications.
type NotificationLevel ¶
type NotificationLevel int
NotificationLevel indicates notification severity.
const ( // NotificationInfo is for informational notifications. NotificationInfo NotificationLevel = iota // NotificationSuccess is for success notifications. NotificationSuccess // NotificationWarning is for warning notifications. NotificationWarning // NotificationError is for error notifications. NotificationError )
func (NotificationLevel) String ¶
func (l NotificationLevel) String() string
String returns a string representation of the notification level.
type NumberInput ¶
type NumberInput struct {
FocusableBase
// contains filtered or unexported fields
}
NumberInput is a focusable numeric input with increment/decrement controls. It renders as [v] 42 [^] and supports keyboard-driven value changes.
func NewNumberInput ¶
func NewNumberInput(value *state.Signal[float64], opts ...NumberInputOption) *NumberInput
NewNumberInput creates a numeric input bound to the given signal.
func (*NumberInput) Bind ¶
func (n *NumberInput) Bind(services runtime.Services)
Bind attaches app services.
func (*NumberInput) HandleMessage ¶
func (n *NumberInput) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage processes keyboard input for the number input.
func (*NumberInput) Max ¶
func (n *NumberInput) Max() float64
Max returns the maximum allowed value.
func (*NumberInput) Measure ¶
func (n *NumberInput) Measure(constraints runtime.Constraints) runtime.Size
Measure returns the desired size.
func (*NumberInput) Min ¶
func (n *NumberInput) Min() float64
Min returns the minimum allowed value.
func (*NumberInput) Render ¶
func (n *NumberInput) Render(ctx runtime.RenderContext)
Render draws the number input widget.
func (*NumberInput) SetStyle ¶
func (n *NumberInput) SetStyle(style backend.Style)
SetStyle sets the widget style.
func (*NumberInput) SetValue ¶
func (n *NumberInput) SetValue(v float64)
SetValue updates the current value, clamping to the min/max range.
func (*NumberInput) Step ¶
func (n *NumberInput) Step() float64
Step returns the increment/decrement step size.
func (*NumberInput) StyleType ¶
func (n *NumberInput) StyleType() string
StyleType returns the selector type name for FSS.
func (*NumberInput) Value ¶
func (n *NumberInput) Value() float64
Value returns the current numeric value.
type NumberInputOption ¶
type NumberInputOption = Option[NumberInput]
NumberInputOption configures a NumberInput widget.
func WithNumberOnChange ¶
func WithNumberOnChange(fn func(float64)) NumberInputOption
WithNumberOnChange sets the value change handler.
func WithNumberRange ¶
func WithNumberRange(min, max float64) NumberInputOption
WithNumberRange sets the minimum and maximum allowed values.
func WithNumberStep ¶
func WithNumberStep(step float64) NumberInputOption
WithNumberStep sets the increment/decrement step size.
type Orientation ¶
type Orientation int
Orientation describes slider orientation.
const ( Horizontal Orientation = iota Vertical )
type Pagination ¶
type Pagination struct {
FocusableBase
// contains filtered or unexported fields
}
Pagination is a focusable page navigation widget. It renders a page indicator like: < 1 2 [3] 4 5 ... 10 >
func NewPagination ¶
func NewPagination(total, pageSize int) *Pagination
NewPagination creates a pagination widget.
func (*Pagination) Bind ¶
func (p *Pagination) Bind(services runtime.Services)
Bind attaches app services.
func (*Pagination) HandleMessage ¶
func (p *Pagination) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage processes keyboard input.
func (*Pagination) Measure ¶
func (p *Pagination) Measure(constraints runtime.Constraints) runtime.Size
Measure returns the desired size.
func (*Pagination) Render ¶
func (p *Pagination) Render(ctx runtime.RenderContext)
Render draws the pagination widget.
func (*Pagination) SetOnChange ¶
func (p *Pagination) SetOnChange(fn func(page int))
SetOnChange sets the page change handler.
func (*Pagination) SetPage ¶
func (p *Pagination) SetPage(page int)
SetPage sets the current page (1-based).
func (*Pagination) SetStyle ¶
func (p *Pagination) SetStyle(style backend.Style)
SetStyle sets the widget style.
func (*Pagination) StyleType ¶
func (p *Pagination) StyleType() string
StyleType returns the selector type name.
func (*Pagination) TotalPages ¶
func (p *Pagination) TotalPages() int
TotalPages returns the total number of pages.
type PaletteCommand ¶
type PaletteCommand struct {
ID string
Label string
Description string
Shortcut string // display only, e.g. "Ctrl+S"
Category string // for grouping
OnExecute func()
}
PaletteCommand describes an executable action in the command palette.
type PaletteItem ¶
type PaletteItem struct {
ID string // Unique identifier
Category string // Optional category for grouping (e.g., "Recent", "Files", "Actions")
Label string // Display text
Description string // Optional secondary text
Shortcut string // Optional keyboard shortcut hint
Data any // Custom data for the action
}
PaletteItem represents a single item in the palette.
type PaletteWidget ¶
type PaletteWidget struct {
FocusableBase
// contains filtered or unexported fields
}
PaletteWidget provides a fuzzy-filtering command palette overlay.
Example ¶
package main
import (
"m31labs.dev/fluffyui/widgets"
)
func main() {
palette := widgets.NewPaletteWidget("Commands")
palette.SetItems([]widgets.PaletteItem{
{ID: "new", Category: "File", Label: "New file", Shortcut: "Ctrl+N"},
{ID: "open", Category: "File", Label: "Open file", Shortcut: "Ctrl+O"},
})
_ = palette
}
Output:
func NewPaletteWidget ¶
func NewPaletteWidget(title string) *PaletteWidget
NewPaletteWidget creates a new palette widget.
func (*PaletteWidget) Bind ¶
func (p *PaletteWidget) Bind(services runtime.Services)
Bind attaches app services.
func (*PaletteWidget) HandleMessage ¶
func (p *PaletteWidget) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage processes keyboard input.
func (*PaletteWidget) Layout ¶
func (p *PaletteWidget) Layout(bounds runtime.Rect)
Layout positions the widget (centered overlay).
func (*PaletteWidget) Measure ¶
func (p *PaletteWidget) Measure(constraints runtime.Constraints) runtime.Size
Measure returns the preferred size.
func (*PaletteWidget) Query ¶
func (p *PaletteWidget) Query() string
Query returns the current query string.
func (*PaletteWidget) Render ¶
func (p *PaletteWidget) Render(ctx runtime.RenderContext)
Render draws the palette.
func (*PaletteWidget) SelectedItem ¶
func (p *PaletteWidget) SelectedItem() *PaletteItem
SelectedItem returns the currently selected item, or nil if none.
func (*PaletteWidget) SetFilterFn ¶
func (p *PaletteWidget) SetFilterFn(fn func(item PaletteItem, query string) bool)
SetFilterFn sets a custom filter function.
func (*PaletteWidget) SetItems ¶
func (p *PaletteWidget) SetItems(items []PaletteItem)
SetItems sets the palette items.
func (*PaletteWidget) SetMaxVisible ¶
func (p *PaletteWidget) SetMaxVisible(max int)
SetMaxVisible sets the maximum visible items.
func (*PaletteWidget) SetOnSelect ¶
func (p *PaletteWidget) SetOnSelect(fn func(item PaletteItem))
SetOnSelect sets the callback for item selection.
func (*PaletteWidget) SetPlaceholder ¶
func (p *PaletteWidget) SetPlaceholder(placeholder string)
SetPlaceholder sets the query placeholder text.
func (*PaletteWidget) SetScoreFn ¶
func (p *PaletteWidget) SetScoreFn(fn func(item PaletteItem, query string) int)
SetScoreFn sets a custom scoring function.
func (*PaletteWidget) SetStyles ¶
func (p *PaletteWidget) SetStyles(bg, border, title, query, item, selected, category backend.Style)
SetStyles configures the palette appearance.
func (*PaletteWidget) StyleType ¶
func (p *PaletteWidget) StyleType() string
StyleType returns the selector type name.
type Panel ¶
type Panel struct {
Base
// contains filtered or unexported fields
}
Panel is a container widget with optional border and background.
Example ¶
package main
import (
"m31labs.dev/fluffyui/backend"
"m31labs.dev/fluffyui/widgets"
)
func main() {
panel := widgets.NewPanel(widgets.NewLabel("Details")).WithBorder(backend.DefaultStyle())
panel.SetTitle("Summary")
_ = panel
}
Output:
func NewPanel ¶
func NewPanel(child runtime.Widget, opts ...PanelOption) *Panel
NewPanel creates a new panel widget.
func (*Panel) ChildWidgets ¶
ChildWidgets returns the panel's child widget.
func (*Panel) HandleMessage ¶
func (p *Panel) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage delegates to child.
func (*Panel) Measure ¶
func (p *Panel) Measure(constraints runtime.Constraints) runtime.Size
Measure returns the size needed for the panel.
func (*Panel) SetBorderStyle ¶
SetBorderStyle sets the border style and enables the border.
func (*Panel) WithBorder
deprecated
type PanelOption ¶
PanelOption configures a Panel widget.
func WithPanelBorder ¶
func WithPanelBorder(style backend.Style) PanelOption
WithPanelBorder enables a border with the given style.
func WithPanelStyle ¶
func WithPanelStyle(style backend.Style) PanelOption
WithPanelStyle sets the panel background style.
func WithPanelTitle ¶
func WithPanelTitle(title string) PanelOption
WithPanelTitle sets the panel title.
type PerformanceDashboard ¶
type PerformanceDashboard struct {
Component
// contains filtered or unexported fields
}
PerformanceDashboard renders render-loop performance metrics.
func NewPerformanceDashboard ¶
func NewPerformanceDashboard(sampler *runtime.RenderSampler, opts ...PerformanceDashboardOption) *PerformanceDashboard
NewPerformanceDashboard creates a dashboard wired to a render sampler.
func (*PerformanceDashboard) Bind ¶
func (d *PerformanceDashboard) Bind(services runtime.Services)
Bind attaches app services and schedules refreshes.
func (*PerformanceDashboard) Measure ¶
func (d *PerformanceDashboard) Measure(constraints runtime.Constraints) runtime.Size
Measure returns the desired size.
func (*PerformanceDashboard) Render ¶
func (d *PerformanceDashboard) Render(ctx runtime.RenderContext)
Render draws the dashboard summary.
func (*PerformanceDashboard) SetRefreshInterval ¶
func (d *PerformanceDashboard) SetRefreshInterval(interval time.Duration)
SetRefreshInterval updates the auto-refresh interval.
func (*PerformanceDashboard) SetSampler ¶
func (d *PerformanceDashboard) SetSampler(sampler *runtime.RenderSampler)
SetSampler updates the render sampler.
func (*PerformanceDashboard) StyleType ¶
func (d *PerformanceDashboard) StyleType() string
StyleType returns the selector type name.
func (*PerformanceDashboard) Unbind ¶
func (d *PerformanceDashboard) Unbind()
Unbind releases subscriptions.
type PerformanceDashboardOption ¶
type PerformanceDashboardOption = Option[PerformanceDashboard]
PerformanceDashboardOption configures the dashboard.
func WithPerformanceHeaderStyle ¶
func WithPerformanceHeaderStyle(style backend.Style) PerformanceDashboardOption
WithPerformanceHeaderStyle overrides the header style.
func WithPerformanceLabel ¶
func WithPerformanceLabel(label string) PerformanceDashboardOption
WithPerformanceLabel sets the accessibility label.
func WithPerformanceMutedStyle ¶
func WithPerformanceMutedStyle(style backend.Style) PerformanceDashboardOption
WithPerformanceMutedStyle overrides the muted style.
func WithPerformanceRefresh ¶
func WithPerformanceRefresh(interval time.Duration) PerformanceDashboardOption
WithPerformanceRefresh sets the refresh interval (0 disables auto refresh).
func WithPerformanceStyle ¶
func WithPerformanceStyle(style backend.Style) PerformanceDashboardOption
WithPerformanceStyle overrides the base style.
type Popover ¶
type Popover struct {
Base
Child runtime.Widget
Anchor runtime.Rect
Placement PopoverPlacement
Gap int
MatchAnchorWidth bool
DismissOnOutside bool
DismissOnMoveOutside bool
DismissOnEscape bool
// contains filtered or unexported fields
}
Popover positions a child widget relative to an anchor rect.
func NewPopover ¶
NewPopover creates a popover anchored to the given rect.
func (*Popover) Bind ¶
Bind attaches app services. It saves the currently focused widget so focus can be restored on close.
func (*Popover) ChildWidgets ¶
ChildWidgets returns the popover content.
func (*Popover) HandleMessage ¶
func (p *Popover) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage forwards input to the child and optionally dismisses.
func (*Popover) Measure ¶
func (p *Popover) Measure(constraints runtime.Constraints) runtime.Size
Measure returns the full available size.
func (*Popover) Render ¶
func (p *Popover) Render(ctx runtime.RenderContext)
Render draws the child widget.
type PopoverOption ¶
PopoverOption configures a popover.
func WithPopoverDismissOnEscape ¶
func WithPopoverDismissOnEscape(enabled bool) PopoverOption
WithPopoverDismissOnEscape sets whether to dismiss on Escape.
func WithPopoverDismissOnMoveOutside ¶
func WithPopoverDismissOnMoveOutside(enabled bool) PopoverOption
WithPopoverDismissOnMoveOutside sets whether to dismiss on mouse move outside.
func WithPopoverDismissOnOutside ¶
func WithPopoverDismissOnOutside(enabled bool) PopoverOption
WithPopoverDismissOnOutside sets whether to dismiss on outside clicks.
func WithPopoverGap ¶
func WithPopoverGap(gap int) PopoverOption
WithPopoverGap sets the gap between anchor and popover.
func WithPopoverMatchAnchorWidth ¶
func WithPopoverMatchAnchorWidth(enabled bool) PopoverOption
WithPopoverMatchAnchorWidth sets whether the popover should match anchor width.
func WithPopoverOnClose ¶
func WithPopoverOnClose(fn func()) PopoverOption
WithPopoverOnClose registers a callback invoked when the popover closes.
func WithPopoverPlacement ¶
func WithPopoverPlacement(placement PopoverPlacement) PopoverOption
WithPopoverPlacement sets the placement behavior.
type PopoverPlacement ¶
type PopoverPlacement int
PopoverPlacement controls where the popover appears relative to the anchor.
const ( PopoverAuto PopoverPlacement = iota PopoverBelow PopoverAbove )
type Progress ¶
type Progress struct {
Base
Value float64
Max float64
Label string
ShowPercent bool
Style GaugeStyle
// contains filtered or unexported fields
}
Progress displays a determinate progress bar.
Example ¶
package main
import (
"m31labs.dev/fluffyui/widgets"
)
func main() {
progress := widgets.NewProgress()
progress.Value = 65
_ = progress
}
Output:
func (*Progress) HandleMessage ¶
func (p *Progress) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage returns unhandled.
func (*Progress) Measure ¶
func (p *Progress) Measure(constraints runtime.Constraints) runtime.Size
Measure returns desired size.
func (*Progress) Render ¶
func (p *Progress) Render(ctx runtime.RenderContext)
Render draws the progress bar.
type Radio ¶
type Radio struct {
FocusableBase
// contains filtered or unexported fields
}
Radio is a single radio option.
Example ¶
package main
import (
"m31labs.dev/fluffyui/widgets"
)
func main() {
group := widgets.NewRadioGroup()
first := widgets.NewRadio("First", group)
second := widgets.NewRadio("Second", group)
group.SetSelected(1)
_ = first
_ = second
}
Output:
func NewRadio ¶
func NewRadio(label string, group *RadioGroup) *Radio
NewRadio creates a radio option and registers it with the group.
func (*Radio) HandleMessage ¶
func (r *Radio) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage handles selection.
func (*Radio) Measure ¶
func (r *Radio) Measure(constraints runtime.Constraints) runtime.Size
Measure returns the desired size.
func (*Radio) SetDisabled ¶
SetDisabled updates disabled state.
func (*Radio) SetFocusStyle ¶
SetFocusStyle sets the focused style.
type RadioGroup ¶
type RadioGroup struct {
// contains filtered or unexported fields
}
RadioGroup manages a set of radio buttons.
func (*RadioGroup) OnChange
deprecated
func (g *RadioGroup) OnChange(fn func(index int))
OnChange registers a selection callback on the radio group.
Deprecated: Use SetOnChange instead. This method will be removed in v1.0.
func (*RadioGroup) Selected ¶
func (g *RadioGroup) Selected() int
Selected returns the selected index.
func (*RadioGroup) SetOnChange ¶
func (g *RadioGroup) SetOnChange(fn func(index int))
SetOnChange registers a selection callback.
func (*RadioGroup) SetSelected ¶
func (g *RadioGroup) SetSelected(index int)
SetSelected updates the selected index.
type RangeSlider ¶
type RangeSlider struct {
FocusableBase
// contains filtered or unexported fields
}
RangeSlider is a dual-handle slider.
func NewRangeSlider ¶
func NewRangeSlider(minValue, maxValue *state.Signal[float64], opts ...RangeSliderOption) *RangeSlider
NewRangeSlider creates a range slider.
func (*RangeSlider) Bind ¶
func (r *RangeSlider) Bind(services runtime.Services)
Bind attaches app services.
func (*RangeSlider) HandleMessage ¶
func (r *RangeSlider) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage updates value on input.
func (*RangeSlider) Measure ¶
func (r *RangeSlider) Measure(constraints runtime.Constraints) runtime.Size
Measure returns desired size.
func (*RangeSlider) Render ¶
func (r *RangeSlider) Render(ctx runtime.RenderContext)
Render draws the range slider.
func (*RangeSlider) SetLabel ¶
func (r *RangeSlider) SetLabel(label string)
SetLabel updates the accessibility label.
func (*RangeSlider) SetRange ¶
func (r *RangeSlider) SetRange(min, max, step float64)
SetRange updates min/max/step.
func (*RangeSlider) SetStyles ¶
func (r *RangeSlider) SetStyles(base, track, thumb, fill backend.Style)
SetStyles updates slider styles.
func (*RangeSlider) SetValues ¶
func (r *RangeSlider) SetValues(minValue, maxValue float64)
SetValues updates the min/max values.
func (*RangeSlider) StyleType ¶
func (r *RangeSlider) StyleType() string
StyleType returns the selector type name.
func (*RangeSlider) Values ¶
func (r *RangeSlider) Values() (float64, float64)
Values returns the current min/max values.
type RangeSliderOption ¶
type RangeSliderOption = Option[RangeSlider]
RangeSliderOption configures range slider behavior.
func WithRangeSliderOrientation ¶
func WithRangeSliderOrientation(orientation Orientation) RangeSliderOption
WithRangeSliderOrientation sets orientation.
func WithRangeSliderRange ¶
func WithRangeSliderRange(min, max, step float64) RangeSliderOption
WithRangeSliderRange configures min, max, and step.
func WithRangeSliderShowValue ¶
func WithRangeSliderShowValue(show bool) RangeSliderOption
WithRangeSliderShowValue toggles value label.
func WithRangeSliderStyles ¶
func WithRangeSliderStyles(track, thumb, fill backend.Style) RangeSliderOption
WithRangeSliderStyles configures styles.
func WithRangeSliderValueFormat ¶
func WithRangeSliderValueFormat(format string) RangeSliderOption
WithRangeSliderValueFormat sets format string.
type Rating ¶
type Rating struct {
FocusableBase
// contains filtered or unexported fields
}
Rating is a focusable star rating widget. It renders filled and empty stars based on the current value.
func (*Rating) HandleMessage ¶
func (r *Rating) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage processes keyboard input.
func (*Rating) Measure ¶
func (r *Rating) Measure(constraints runtime.Constraints) runtime.Size
Measure returns the desired size.
func (*Rating) Render ¶
func (r *Rating) Render(ctx runtime.RenderContext)
Render draws the rating widget.
func (*Rating) SetOnChange ¶
SetOnChange sets the value change handler.
type RenderFunc ¶
type RenderFunc[T any] func(item T, index int, selected bool, ctx runtime.RenderContext)
RenderFunc renders an item.
type RichText ¶
type RichText struct {
FocusableBase
// contains filtered or unexported fields
}
RichText renders markdown content with scrolling.
func NewRichText ¶
func NewRichText(content string, opts ...RichTextOption) *RichText
NewRichText creates a new RichText widget.
func (*RichText) HandleMessage ¶
func (r *RichText) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage handles scroll input.
func (*RichText) Measure ¶
func (r *RichText) Measure(constraints runtime.Constraints) runtime.Size
Measure returns the required size.
func (*RichText) Render ¶
func (r *RichText) Render(ctx runtime.RenderContext)
Render draws the visible lines.
func (*RichText) ScrollToAnchor ¶
ScrollToAnchor scrolls to a heading anchor if available.
func (*RichText) ScrollToStart ¶
func (r *RichText) ScrollToStart()
ScrollToStart scrolls to the top.
func (*RichText) SetContent ¶
SetContent updates the markdown content.
func (*RichText) SetLines ¶
func (r *RichText) SetLines(lines []markdown.StyledLine)
SetLines sets pre-rendered styled lines.
func (*RichText) SetRenderer ¶
SetRenderer replaces the markdown renderer.
func (*RichText) SetShowScrollbar ¶
SetShowScrollbar toggles the scrollbar.
type RichTextOption ¶
RichTextOption configures a RichText widget.
func WithRichTextLabel ¶
func WithRichTextLabel(label string) RichTextOption
WithRichTextLabel sets the accessibility label.
func WithRichTextRenderer ¶
func WithRichTextRenderer(renderer *markdown.Renderer) RichTextOption
WithRichTextRenderer uses a custom markdown renderer.
func WithRichTextScrollbar ¶
func WithRichTextScrollbar(show bool) RichTextOption
WithRichTextScrollbar toggles the scrollbar.
func WithRichTextSource ¶
func WithRichTextSource(source string) RichTextOption
WithRichTextSource sets the markdown source style key.
func WithRichTextStyle ¶
func WithRichTextStyle(style backend.Style) RichTextOption
WithRichTextStyle sets the base style.
type ScrollView ¶
type ScrollView struct {
FocusableBase
// contains filtered or unexported fields
}
ScrollView provides a scrollable container.
Example ¶
package main
import (
"m31labs.dev/fluffyui/widgets"
)
func main() {
content := widgets.NewText("Line 1\nLine 2\nLine 3")
scroll := widgets.NewScrollView(content)
scroll.ScrollBy(0, 1)
_ = scroll
}
Output:
func NewScrollView ¶
func NewScrollView(content runtime.Widget) *ScrollView
NewScrollView creates a scroll view for content.
func (*ScrollView) Bind ¶
func (s *ScrollView) Bind(services runtime.Services)
Bind attaches app services.
func (*ScrollView) ChildWidgets ¶
func (s *ScrollView) ChildWidgets() []runtime.Widget
ChildWidgets returns the content widget.
func (*ScrollView) ContentSize ¶
func (s *ScrollView) ContentSize() runtime.Size
ContentSize returns the current scrollable content size.
func (*ScrollView) HandleMessage ¶
func (s *ScrollView) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage handles scrolling input.
func (*ScrollView) Layout ¶
func (s *ScrollView) Layout(bounds runtime.Rect)
Layout positions the content.
func (*ScrollView) Measure ¶
func (s *ScrollView) Measure(constraints runtime.Constraints) runtime.Size
Measure returns the desired size.
func (*ScrollView) Render ¶
func (s *ScrollView) Render(ctx runtime.RenderContext)
Render draws the visible portion of content.
func (*ScrollView) ScrollBy ¶
func (s *ScrollView) ScrollBy(dx, dy int)
ScrollBy scrolls the view by delta.
func (*ScrollView) ScrollTo ¶
func (s *ScrollView) ScrollTo(x, y int)
ScrollTo scrolls to the specified offset.
func (*ScrollView) ScrollToEnd ¶
func (s *ScrollView) ScrollToEnd()
ScrollToEnd scrolls to the bottom-right.
func (*ScrollView) ScrollToStart ¶
func (s *ScrollView) ScrollToStart()
ScrollToStart scrolls to the top-left.
func (*ScrollView) SetBehavior ¶
func (s *ScrollView) SetBehavior(behavior scroll.ScrollBehavior)
SetBehavior updates scroll behavior.
func (*ScrollView) SetContent ¶
func (s *ScrollView) SetContent(content runtime.Widget)
SetContent updates the scroll content.
func (*ScrollView) SetLabel ¶
func (s *ScrollView) SetLabel(label string)
SetLabel updates the accessibility label.
func (*ScrollView) SetStyle ¶
func (s *ScrollView) SetStyle(style backend.Style)
SetStyle updates the scroll view background style.
type SearchWidget ¶
type SearchWidget struct {
FocusableBase
// contains filtered or unexported fields
}
SearchWidget provides a search input overlay for the chat view.
Example ¶
package main
import (
"m31labs.dev/fluffyui/widgets"
)
func main() {
search := widgets.NewSearchWidget()
search.SetOnSearch(func(query string) {})
search.SetMatchInfo(1, 4)
_ = search
}
Output:
func NewSearchWidget ¶
func NewSearchWidget() *SearchWidget
NewSearchWidget creates a new search widget.
func (*SearchWidget) Bind ¶
func (s *SearchWidget) Bind(services runtime.Services)
Bind attaches app services.
func (*SearchWidget) HandleMessage ¶
func (s *SearchWidget) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage processes keyboard input.
func (*SearchWidget) Layout ¶
func (s *SearchWidget) Layout(bounds runtime.Rect)
Layout positions at the bottom of the screen.
func (*SearchWidget) Measure ¶
func (s *SearchWidget) Measure(constraints runtime.Constraints) runtime.Size
Measure returns the preferred size (fixed height bar).
func (*SearchWidget) Query ¶
func (s *SearchWidget) Query() string
Query returns the current search query.
func (*SearchWidget) Render ¶
func (s *SearchWidget) Render(ctx runtime.RenderContext)
Render draws the search bar.
func (*SearchWidget) RenderHTML ¶
func (s *SearchWidget) RenderHTML(ctx runtime.HTMLContext) runtime.HTML
RenderHTML renders the search widget as a static HTML search input.
func (*SearchWidget) SetLabel ¶
func (s *SearchWidget) SetLabel(label string)
SetLabel updates the accessibility label.
func (*SearchWidget) SetMatchInfo ¶
func (s *SearchWidget) SetMatchInfo(current, total int)
SetMatchInfo updates the match count display.
func (*SearchWidget) SetOnClose ¶
func (s *SearchWidget) SetOnClose(fn func())
SetOnClose sets the close callback.
func (*SearchWidget) SetOnNavigate ¶
func (s *SearchWidget) SetOnNavigate(next, prev func())
SetOnNavigate sets callbacks for navigating search matches.
func (*SearchWidget) SetOnSearch ¶
func (s *SearchWidget) SetOnSearch(fn func(query string))
SetOnSearch sets the search callback.
func (*SearchWidget) SetQuery ¶
func (s *SearchWidget) SetQuery(query string)
SetQuery updates the search query and triggers search callback.
func (*SearchWidget) SetStyles ¶
func (s *SearchWidget) SetStyles(bg, border, text, match backend.Style)
SetStyles configures appearance.
func (*SearchWidget) StyleType ¶
func (s *SearchWidget) StyleType() string
StyleType returns the selector type name.
type Searchable ¶
Searchable represents widgets that expose a searchable query.
type Section ¶
type Section struct {
FocusableBase
// contains filtered or unexported fields
}
Section represents a collapsible section in the sidebar.
Example ¶
package main
import (
"m31labs.dev/fluffyui/widgets"
)
func main() {
section := widgets.NewSection("Pipeline")
section.SetItems([]widgets.SectionItem{
{Icon: '>', Text: "Build", Active: true},
{Icon: 'o', Text: "Test"},
{Icon: 'x', Text: "Deploy"},
})
section.SetMaxItems(3)
_ = section
}
Output:
func NewSection ¶
NewSection creates a new collapsible section.
func (*Section) ContentHeight ¶
ContentHeight returns the height needed for content (items).
func (*Section) HandleMessage ¶
func (s *Section) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage processes input.
func (*Section) IsExpanded ¶
IsExpanded returns the expanded state.
func (*Section) Measure ¶
func (s *Section) Measure(constraints runtime.Constraints) runtime.Size
Measure returns the preferred size.
func (*Section) Render ¶
func (s *Section) Render(ctx runtime.RenderContext)
Render draws the section.
func (*Section) SetExpanded ¶
SetExpanded sets the expanded state.
func (*Section) SetIconStyle ¶
SetIconStyle configures the default icon style.
func (*Section) SetItems ¶
func (s *Section) SetItems(items []SectionItem)
SetItems updates the section items.
func (*Section) SetMaxItems ¶
SetMaxItems sets the maximum items to show when expanded.
type SectionItem ¶
type SectionItem struct {
Icon rune // Status icon (✓, →, ○, ⟳)
Text string // Item text
Active bool // Whether this item is currently active/in-progress
SubText string // Optional secondary text (e.g., spinner detail)
}
SectionItem represents a single item in a collapsible section.
type SegmentedControl ¶
type SegmentedControl struct {
FocusableBase
// contains filtered or unexported fields
}
SegmentedControl is a horizontal row of mutually exclusive options.
func NewSegmentedControl ¶
func NewSegmentedControl(options ...string) *SegmentedControl
NewSegmentedControl creates a segmented control with the given options.
func (*SegmentedControl) Bind ¶
func (s *SegmentedControl) Bind(services runtime.Services)
Bind attaches app services.
func (*SegmentedControl) HandleMessage ¶
func (s *SegmentedControl) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage handles keyboard navigation.
func (*SegmentedControl) Measure ¶
func (s *SegmentedControl) Measure(constraints runtime.Constraints) runtime.Size
Measure returns the desired size.
func (*SegmentedControl) Render ¶
func (s *SegmentedControl) Render(ctx runtime.RenderContext)
Render draws the segmented control as [Option A | Option B | Option C].
func (*SegmentedControl) Selected ¶
func (s *SegmentedControl) Selected() int
Selected returns the currently selected index.
func (*SegmentedControl) SetOnChange ¶
func (s *SegmentedControl) SetOnChange(fn func(index int, label string))
SetOnChange sets the change handler.
func (*SegmentedControl) SetSelected ¶
func (s *SegmentedControl) SetSelected(index int)
SetSelected updates the selected index.
func (*SegmentedControl) SetSelectedStyle ¶
func (s *SegmentedControl) SetSelectedStyle(style backend.Style)
SetSelectedStyle sets the selected segment style.
func (*SegmentedControl) SetStyle ¶
func (s *SegmentedControl) SetStyle(style backend.Style)
SetStyle sets the normal style.
func (*SegmentedControl) StyleType ¶
func (s *SegmentedControl) StyleType() string
StyleType returns the selector type name.
type Select ¶
type Select struct {
FocusableBase
// contains filtered or unexported fields
}
Select is a dropdown-like selector (inline).
Example ¶
package main
import (
"m31labs.dev/fluffyui/widgets"
)
func main() {
selector := widgets.NewSelect(
widgets.SelectOption{Label: "Small", Value: "S"},
widgets.SelectOption{Label: "Medium", Value: "M"},
widgets.SelectOption{Label: "Large", Value: "L"},
)
selector.SetSelected(1)
_ = selector
}
Output:
func NewSelect ¶
func NewSelect(options ...SelectOption) *Select
NewSelect creates a single-selection picker from the given options. Use SetOnChange to handle selection. Apply WithDropdownMode for overlay rendering.
func (*Select) Apply ¶
func (s *Select) Apply(opts ...SelectModeOption) *Select
Apply configures the select with mode options.
func (*Select) HandleMessage ¶
func (s *Select) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage changes selection.
func (*Select) Measure ¶
func (s *Select) Measure(constraints runtime.Constraints) runtime.Size
Measure returns the desired size.
func (*Select) SelectedOption ¶
func (s *Select) SelectedOption() (SelectOption, bool)
SelectedOption returns the current option.
func (*Select) SetFocusStyle ¶
SetFocusStyle sets the focused style.
func (*Select) SetMode ¶
func (s *Select) SetMode(mode SelectMode)
SetMode updates the select rendering mode.
func (*Select) SetOnChange ¶
func (s *Select) SetOnChange(fn func(option SelectOption))
SetOnChange sets the change handler.
func (*Select) SetSelected ¶
SetSelected updates the selected index.
type SelectMode ¶
type SelectMode int
SelectMode controls how the select renders.
const ( SelectInline SelectMode = iota SelectDropdown )
type SelectModeOption ¶
SelectModeOption configures select behavior.
func WithDropdownMode ¶
func WithDropdownMode() SelectModeOption
WithDropdownMode enables dropdown overlay rendering.
func WithInlineMode ¶
func WithInlineMode() SelectModeOption
WithInlineMode forces inline rendering.
type SelectOption ¶
SelectOption represents a selectable option.
type Selectable ¶
type Selectable interface {
// GetSelection returns the current selection range.
GetSelection() Selection
// SetSelection sets the selection range.
SetSelection(sel Selection)
// SelectAll selects all text.
SelectAll()
// SelectNone clears the selection.
SelectNone()
// SelectWord selects the word at the cursor position.
SelectWord()
// SelectLine selects the current line.
SelectLine()
// HasSelection returns true if text is selected.
HasSelection() bool
// GetSelectedText returns the currently selected text.
GetSelectedText() string
}
Selectable is implemented by widgets that support text selection.
type Selection ¶
Selection represents a text selection range.
type Sidebar ¶
type Sidebar struct {
FocusableBase
// contains filtered or unexported fields
}
Sidebar renders a vertical navigation panel with keyboard support.
Items can be nested via Children. Nested items are expanded/collapsed with Left/Right or Enter keys. Up/Down moves selection. Enter activates the OnSelect callback of the focused item.
func NewSidebar ¶
func NewSidebar(items ...SidebarItem) *Sidebar
NewSidebar creates a new sidebar navigation widget.
func (*Sidebar) GetItems ¶
func (s *Sidebar) GetItems() []SidebarItem
Items returns the current sidebar items.
func (*Sidebar) HandleMessage ¶
func (s *Sidebar) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage handles keyboard navigation.
func (*Sidebar) Measure ¶
func (s *Sidebar) Measure(constraints runtime.Constraints) runtime.Size
Measure returns desired size.
func (*Sidebar) Render ¶
func (s *Sidebar) Render(ctx runtime.RenderContext)
Render draws the sidebar.
func (*Sidebar) ScrollToStart ¶
func (s *Sidebar) ScrollToStart()
ScrollToStart scrolls to the first row.
func (*Sidebar) SelectedItem ¶
func (s *Sidebar) SelectedItem() *SidebarItem
SelectedItem returns the currently selected SidebarItem, or nil.
func (*Sidebar) SetExpanded ¶
SetExpanded controls whether the sidebar is expanded (visible) or collapsed.
func (*Sidebar) SetItems ¶
func (s *Sidebar) SetItems(items ...SidebarItem)
SetItems replaces the sidebar items.
func (*Sidebar) SetSelectedStyle ¶
SetSelectedStyle updates the selected row style.
type SidebarItem ¶
type SidebarItem struct {
Label string
Icon string // optional single-char icon prefix
OnSelect func()
Badge string // optional badge text drawn right-aligned
Children []SidebarItem // for nested navigation
Expanded bool
}
SidebarItem represents a single entry in a Sidebar navigation.
type SignalAdapter ¶
type SignalAdapter[T any] struct { // contains filtered or unexported fields }
SignalAdapter adapts a signal slice to a ListAdapter.
func (*SignalAdapter[T]) Count ¶
func (s *SignalAdapter[T]) Count() int
Count returns the item count.
func (*SignalAdapter[T]) Render ¶
func (s *SignalAdapter[T]) Render(item T, index int, selected bool, ctx runtime.RenderContext)
Render draws an item.
type SignalLabel ¶
type SignalLabel struct {
Base
// contains filtered or unexported fields
}
SignalLabel is a tiny label bound to a signal. SignalLabel demonstrates managing subscriptions in Mount/Unmount with a state.Scheduler.
Example ¶
package main
import (
"m31labs.dev/fluffyui/state"
"m31labs.dev/fluffyui/widgets"
)
func main() {
signal := state.NewSignal("Ready")
label := widgets.NewSignalLabel(signal, state.DirectScheduler)
_ = label
}
Output:
func NewSignalLabel ¶
NewSignalLabel creates a new signal-backed label.
func (*SignalLabel) Bind ¶
func (s *SignalLabel) Bind(services runtime.Services)
Bind attaches app services.
func (*SignalLabel) Measure ¶
func (s *SignalLabel) Measure(constraints runtime.Constraints) runtime.Size
Measure returns the size needed for the label.
func (*SignalLabel) Render ¶
func (s *SignalLabel) Render(ctx runtime.RenderContext)
Render draws the label.
func (*SignalLabel) SetA11yLabel ¶
func (s *SignalLabel) SetA11yLabel(label string)
SetA11yLabel overrides the accessibility label without changing visible text.
func (*SignalLabel) SetAlignment ¶
func (s *SignalLabel) SetAlignment(align Alignment)
SetAlignment sets text alignment.
func (*SignalLabel) SetStyle ¶
func (s *SignalLabel) SetStyle(style backend.Style)
SetStyle sets the label style.
func (*SignalLabel) StyleType ¶
func (s *SignalLabel) StyleType() string
StyleType returns the selector type name.
func (*SignalLabel) Unmount ¶
func (s *SignalLabel) Unmount()
Unmount unsubscribes from signal changes.
type SimpleWidget ¶
type SimpleWidget struct {
Base
MeasureFunc func(runtime.Constraints) runtime.Size
LayoutFunc func(runtime.Rect)
RenderFunc func(runtime.RenderContext)
HandleMessageFunc func(runtime.Message) runtime.HandleResult
HTMLRenderFunc func(runtime.HTMLContext) runtime.HTML
// contains filtered or unexported fields
}
SimpleWidget provides function hooks for quick widgets with Base styling.
func (*SimpleWidget) Bind ¶
func (s *SimpleWidget) Bind(services runtime.Services)
Bind attaches app services.
func (*SimpleWidget) HandleMessage ¶
func (s *SimpleWidget) HandleMessage(msg runtime.Message) runtime.HandleResult
func (*SimpleWidget) Layout ¶
func (s *SimpleWidget) Layout(bounds runtime.Rect)
func (*SimpleWidget) Measure ¶
func (s *SimpleWidget) Measure(constraints runtime.Constraints) runtime.Size
func (*SimpleWidget) Render ¶
func (s *SimpleWidget) Render(ctx runtime.RenderContext)
func (*SimpleWidget) RenderHTML ¶
func (s *SimpleWidget) RenderHTML(ctx runtime.HTMLContext) runtime.HTML
RenderHTML returns a static HTML representation of the widget.
type Skeleton ¶
type Skeleton struct {
Component
// contains filtered or unexported fields
}
Skeleton is an animated placeholder widget that indicates loading state. It renders alternating block characters that shift with each tick.
func NewSkeleton ¶
NewSkeleton creates a skeleton placeholder with the given dimensions.
func (*Skeleton) HandleMessage ¶
func (s *Skeleton) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage advances animation on ticks. Skips frame advancement when reduced motion is active.
func (*Skeleton) IsAnimating ¶
IsAnimating returns whether animation is enabled.
func (*Skeleton) Measure ¶
func (s *Skeleton) Measure(constraints runtime.Constraints) runtime.Size
Measure returns the desired size.
func (*Skeleton) Render ¶
func (s *Skeleton) Render(ctx runtime.RenderContext)
Render draws the skeleton placeholder. When reduced motion is enabled, a uniform static pattern is shown instead of the shimmering animation.
func (*Skeleton) SetAnimate ¶
SetAnimate enables or disables animation.
type SkipNav ¶
type SkipNav struct {
// contains filtered or unexported fields
}
SkipNav is a skip-navigation landmark widget that lets keyboard users jump past navigation elements directly to main content. This is an essential accessibility pattern for screen reader and keyboard-only users.
SkipNav is only visible when focused (zero height when unfocused). When the user presses Enter, focus transfers to the target widget.
func NewSkipNav ¶
NewSkipNav creates a skip-navigation widget with the given label and target. The label is displayed when focused (e.g., "Skip to main content"). The target is the widget that receives focus when the skip nav is activated.
func (*SkipNav) FocusAffectsLayout ¶
FocusAffectsLayout returns true because the skip nav appears/disappears based on focus state, which changes the layout.
func (*SkipNav) HandleMessage ¶
func (s *SkipNav) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage processes keyboard input. Enter activates the skip nav and transfers focus to the target widget.
func (*SkipNav) Measure ¶
func (s *SkipNav) Measure(constraints runtime.Constraints) runtime.Size
Measure returns the desired size. When unfocused, the widget has zero height so it takes no visual space. When focused, it renders as a single line.
func (*SkipNav) Render ¶
func (s *SkipNav) Render(ctx runtime.RenderContext)
Render draws the skip nav label when focused.
type SliceAdapter ¶
type SliceAdapter[T any] struct { // contains filtered or unexported fields }
SliceAdapter adapts a slice to a ListAdapter.
func (*SliceAdapter[T]) Item ¶
func (s *SliceAdapter[T]) Item(index int) T
Item returns the item at index.
func (*SliceAdapter[T]) Render ¶
func (s *SliceAdapter[T]) Render(item T, index int, selected bool, ctx runtime.RenderContext)
Render renders the item.
type SlideDirection ¶
type SlideDirection int
SlideDirection indicates a slide direction.
const ( DirectionLeft SlideDirection = iota DirectionRight DirectionUp DirectionDown )
type Slider ¶
type Slider struct {
FocusableBase
// contains filtered or unexported fields
}
Slider is a focusable value slider.
func NewSlider ¶
func NewSlider(value *state.Signal[float64], opts ...SliderOption) *Slider
NewSlider creates a draggable value slider bound to the given signal. The signal's value is clamped to the slider's min/max range (default 0-100). Configure with SliderOption functions like WithSliderRange and WithSliderStep.
func (*Slider) HandleMessage ¶
func (s *Slider) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage updates value on input.
func (*Slider) Measure ¶
func (s *Slider) Measure(constraints runtime.Constraints) runtime.Size
Measure returns desired size.
type SliderOption ¶
SliderOption configures slider behavior.
func WithSliderOrientation ¶
func WithSliderOrientation(orientation Orientation) SliderOption
WithSliderOrientation sets orientation.
func WithSliderRange ¶
func WithSliderRange(min, max, step float64) SliderOption
WithSliderRange configures min, max, and step.
func WithSliderShowValue ¶
func WithSliderShowValue(show bool) SliderOption
WithSliderShowValue toggles value label.
func WithSliderStyles ¶
func WithSliderStyles(track, thumb, fill backend.Style) SliderOption
WithSliderStyles configures styles.
func WithSliderValueFormat ¶
func WithSliderValueFormat(format string) SliderOption
WithSliderValueFormat sets format string.
type SortDirection ¶
type SortDirection int
SortDirection indicates the direction of column sorting.
const ( // SortNone means no sorting is applied. SortNone SortDirection = iota // SortAsc sorts in ascending order. SortAsc // SortDesc sorts in descending order. SortDesc )
type Sparkline ¶
type Sparkline struct {
Base
Data *state.Signal[[]float64]
Width int
Style backend.Style
// contains filtered or unexported fields
}
Sparkline renders a compact single-line chart.
Example ¶
package main
import (
"m31labs.dev/fluffyui/state"
"m31labs.dev/fluffyui/widgets"
)
func main() {
data := state.NewSignal([]float64{1, 2, 3, 2, 4})
spark := widgets.NewSparkline(data)
_ = spark
}
Output:
func NewSparkline ¶
NewSparkline creates a sparkline.
func (*Sparkline) HandleMessage ¶
func (s *Sparkline) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage returns unhandled.
func (*Sparkline) Measure ¶
func (s *Sparkline) Measure(constraints runtime.Constraints) runtime.Size
Measure returns desired size.
func (*Sparkline) Render ¶
func (s *Sparkline) Render(ctx runtime.RenderContext)
Render draws the sparkline.
type Spinner ¶
Spinner is an animated loading indicator.
Example ¶
package main
import (
"m31labs.dev/fluffyui/widgets"
)
func main() {
spinner := widgets.NewSpinner()
spinner.Advance()
_ = spinner
}
Output:
func NewSpinner ¶
func NewSpinner() *Spinner
NewSpinner creates an animated loading indicator that cycles through frames on each tick. Shows a static indicator when reduced motion is enabled.
func (*Spinner) HandleMessage ¶
func (s *Spinner) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage advances on ticks. Skips frame advancement when reduced motion is active.
func (*Spinner) Measure ¶
func (s *Spinner) Measure(constraints runtime.Constraints) runtime.Size
Measure returns desired size.
func (*Spinner) Render ¶
func (s *Spinner) Render(ctx runtime.RenderContext)
Render draws the spinner frame, or a static indicator when reduced motion is enabled.
type Splitter ¶
type Splitter struct {
Base
First runtime.Widget
Second runtime.Widget
Orientation SplitterOrientation
Ratio float64
DividerSize int
// contains filtered or unexported fields
}
Splitter divides space between two panes.
Example ¶
package main
import (
"m31labs.dev/fluffyui/widgets"
)
func main() {
left := widgets.NewText("Logs")
right := widgets.NewText("Details")
split := widgets.NewSplitter(left, right)
split.Orientation = widgets.SplitHorizontal
split.Ratio = 0.65
_ = split
}
Output:
func NewSplitter ¶
NewSplitter creates a splitter with two panes.
func (*Splitter) ChildWidgets ¶
ChildWidgets returns the panes.
func (*Splitter) HandleMessage ¶
func (s *Splitter) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage forwards messages to child panes.
func (*Splitter) Measure ¶
func (s *Splitter) Measure(constraints runtime.Constraints) runtime.Size
Measure returns the max child size.
func (*Splitter) PathSegment ¶
PathSegment returns a debug path segment for the given child.
func (*Splitter) Render ¶
func (s *Splitter) Render(ctx runtime.RenderContext)
Render draws both panes.
func (*Splitter) RenderHTML ¶
func (s *Splitter) RenderHTML(ctx runtime.HTMLContext) runtime.HTML
RenderHTML renders the splitter as a static HTML flexbox layout.
type SplitterOrientation ¶
type SplitterOrientation int
SplitterOrientation describes the split direction.
const ( SplitHorizontal SplitterOrientation = iota // Left/right SplitVertical // Top/bottom )
type Stack ¶
Stack overlays child widgets.
Example ¶
package main
import (
"m31labs.dev/fluffyui/backend"
"m31labs.dev/fluffyui/widgets"
)
func main() {
base := widgets.NewBox(widgets.NewLabel("Base"))
overlay := widgets.NewPanel(widgets.NewLabel("Overlay")).WithBorder(backend.DefaultStyle())
stack := widgets.NewStack(base, overlay)
_ = stack
}
Output:
func (*Stack) ChildWidgets ¶
ChildWidgets returns stacked children.
func (*Stack) HandleMessage ¶
func (s *Stack) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage forwards messages to children from top to bottom.
func (*Stack) Measure ¶
func (s *Stack) Measure(constraints runtime.Constraints) runtime.Size
Measure returns the max size of children.
func (*Stack) PathSegment ¶
PathSegment returns a debug path segment for the given child.
func (*Stack) Render ¶
func (s *Stack) Render(ctx runtime.RenderContext)
Render draws children in order.
type StatusBar ¶
type StatusBar struct {
FocusableBase
// contains filtered or unexported fields
}
StatusBar is a VS Code-style bottom status bar with left, center, and right sections.
func NewStatusBar ¶
func NewStatusBar(items ...StatusBarItem) *StatusBar
NewStatusBar creates a status bar with the given items.
func (*StatusBar) AddItem ¶
func (sb *StatusBar) AddItem(item StatusBarItem)
AddItem appends an item to the status bar.
func (*StatusBar) HandleMessage ¶
func (sb *StatusBar) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage handles keyboard navigation and mouse clicks.
func (*StatusBar) Items ¶
func (sb *StatusBar) Items() []StatusBarItem
Items returns a copy of all items.
func (*StatusBar) Measure ¶
func (sb *StatusBar) Measure(constraints runtime.Constraints) runtime.Size
Measure returns the desired size (full width, one line tall).
func (*StatusBar) RemoveItem ¶
RemoveItem removes the item with the given key.
func (*StatusBar) Render ¶
func (sb *StatusBar) Render(ctx runtime.RenderContext)
Render draws the status bar.
func (*StatusBar) SetBackground ¶
SetBackground sets the bar background style.
func (*StatusBar) SetItemVisible ¶
SetItemVisible sets the visibility of an item identified by key.
func (*StatusBar) UpdateItem ¶
UpdateItem updates the text of an item identified by key.
type StatusBarAlignment ¶
type StatusBarAlignment int
StatusBarAlignment controls where an item is placed within the bar.
const ( // StatusBarLeft packs items to the left edge. StatusBarLeft StatusBarAlignment = iota // StatusBarCenter places items in the center. StatusBarCenter // StatusBarRight packs items to the right edge. StatusBarRight )
type StatusBarItem ¶
type StatusBarItem struct {
Key string // unique identifier
Text string // display text
Alignment StatusBarAlignment // placement within the bar
Style backend.Style // optional custom style
OnClick func() // optional click handler
Tooltip string // tooltip description
Priority int // higher priority = kept when space is limited
Visible bool // whether this item is shown
}
StatusBarItem represents a single section in a status bar.
type Stepper ¶
Stepper renders a sequence of steps.
Example ¶
package main
import (
"m31labs.dev/fluffyui/widgets"
)
func main() {
stepper := widgets.NewStepper(
widgets.Step{Title: "Fetch", State: widgets.StepCompleted},
widgets.Step{Title: "Build", State: widgets.StepActive},
widgets.Step{Title: "Ship", State: widgets.StepPending},
)
_ = stepper
}
Output:
func (*Stepper) HandleMessage ¶
func (s *Stepper) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage returns unhandled.
func (*Stepper) Measure ¶
func (s *Stepper) Measure(constraints runtime.Constraints) runtime.Size
Measure returns desired size.
func (*Stepper) Render ¶
func (s *Stepper) Render(ctx runtime.RenderContext)
Render draws the stepper.
type Table ¶
type Table struct {
FocusableBase
Columns []TableColumn
Rows [][]string
// contains filtered or unexported fields
}
Table is a simple data grid widget.
Example ¶
package main
import (
"m31labs.dev/fluffyui/widgets"
)
func main() {
table := widgets.NewTable(
widgets.TableColumn{Title: "Name", Width: 12},
widgets.TableColumn{Title: "Status", Width: 8},
)
table.SetRows([][]string{
{"alpha", "ok"},
{"beta", "warn"},
})
_ = table
}
Output:
func NewTable ¶
func NewTable(columns ...TableColumn) *Table
NewTable creates a data table with the given column definitions. Populate rows with SetRows or SetDataSource. Supports keyboard navigation, sorting, filtering, and virtual scrolling for large datasets.
func (*Table) CancelEdit ¶
func (t *Table) CancelEdit()
CancelEdit discards the current edit and exits edit mode.
func (*Table) ColumnCount ¶
ColumnCount returns the number of columns.
func (*Table) CommitEdit ¶
func (t *Table) CommitEdit()
CommitEdit saves the current edit and exits edit mode. If the data source implements TabularEditable, SetCell is called. Otherwise, for static Rows, the cell is updated directly. The onCellEdit callback (if set) is invoked with old and new values.
func (*Table) DataSource ¶
func (t *Table) DataSource() TabularDataSource
DataSource returns the active data source.
func (*Table) EditBuffer ¶
EditBuffer returns the current edit buffer contents.
func (*Table) EditCursorPos ¶
EditCursorPos returns the cursor position within the edit buffer.
func (*Table) GetCell ¶
GetCell returns the cell value at the given row and column. When sorting or filtering is active, row refers to the display index.
func (*Table) HandleMessage ¶
func (t *Table) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage handles row navigation and inline cell editing.
func (*Table) Measure ¶
func (t *Table) Measure(constraints runtime.Constraints) runtime.Size
Measure returns the desired size.
func (*Table) ScrollToStart ¶
func (t *Table) ScrollToStart()
ScrollToStart scrolls to the first row.
func (*Table) SelectedCol ¶
SelectedCol returns the currently selected column index.
func (*Table) SelectedIndex ¶
SelectedIndex returns the currently selected row index.
func (*Table) SelectedRow ¶
SelectedRow returns the currently selected row data, or nil if no selection.
func (*Table) SetCell ¶
SetCell updates a cell value at the given row and column. When sorting or filtering is active, row refers to the display index.
func (*Table) SetDataSource ¶
func (t *Table) SetDataSource(source TabularDataSource)
SetDataSource sets a virtualized data source for large datasets.
func (*Table) SetFilter ¶
SetFilter sets a filter function. Only rows for which fn returns true will be displayed. Pass nil to remove the filter. Filtering only applies to static Rows data, not to a TabularDataSource.
func (*Table) SetHeaderStyle ¶
SetHeaderStyle updates the header style.
func (*Table) SetOnCellEdit ¶
SetOnCellEdit sets the callback invoked when a cell edit is committed. The callback receives the display row, column, old value, and new value.
func (*Table) SetSelected ¶
SetSelected updates the selected row index.
func (*Table) SetSelectedCol ¶
SetSelectedCol updates the selected column index.
func (*Table) SetSelectedStyle ¶
SetSelectedStyle updates the selected row style.
func (*Table) SetSortColumn ¶
func (t *Table) SetSortColumn(col int, dir SortDirection)
SetSortColumn sets the sort column and direction, then rebuilds the view.
func (*Table) SetVirtualOverscan ¶
SetVirtualOverscan sets the number of extra rows to render above and below the visible area when virtual scrolling is enabled. Default is 2.
func (*Table) SetVirtualScroll ¶
SetVirtualScroll enables or disables virtual scrolling for large datasets. When enabled, only visible rows (plus overscan) are rendered each frame, which dramatically improves performance for tables with thousands of rows.
func (*Table) StartEdit ¶
func (t *Table) StartEdit()
StartEdit enters edit mode on the currently selected cell. The edit buffer is populated with the current cell value.
func (*Table) VirtualScroll ¶
VirtualScroll reports whether virtual scrolling is enabled.
func (*Table) VisibleRange ¶
VisibleRange returns the [start, end) row indices currently rendered. When virtual scrolling is disabled, start is the scroll offset and end is offset+viewportRows. When enabled, it returns the virtualized range.
type TableColumn ¶
TableColumn defines a column in a table.
type TableSortState ¶
type TableSortState struct {
Column int
Direction SortDirection
}
TableSortState holds the current sort column and direction.
type Tabs ¶
type Tabs struct {
FocusableBase
Tabs []Tab
// contains filtered or unexported fields
}
Tabs is a tabbed container widget.
Example ¶
package main
import (
"m31labs.dev/fluffyui/widgets"
)
func main() {
tabs := widgets.NewTabs(
widgets.Tab{Title: "Home", Content: widgets.NewText("Welcome")},
widgets.Tab{Title: "Logs", Content: widgets.NewText("...")},
)
_ = tabs
}
Output:
func NewTabs ¶
NewTabs creates a tabbed container that shows one tab's content at a time. Navigate tabs with arrow keys when focused.
func (*Tabs) ChildWidgets ¶
ChildWidgets returns the selected tab content.
func (*Tabs) HandleMessage ¶
func (t *Tabs) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage switches tabs.
func (*Tabs) Measure ¶
func (t *Tabs) Measure(constraints runtime.Constraints) runtime.Size
Measure returns the size of the selected tab.
func (*Tabs) PathSegment ¶
PathSegment returns a debug path segment for the given child.
func (*Tabs) Render ¶
func (t *Tabs) Render(ctx runtime.RenderContext)
Render draws tab titles and content.
func (*Tabs) SelectedIndex ¶
SelectedIndex returns the current tab index.
func (*Tabs) SetSelected ¶
SetSelected updates the active tab index.
func (*Tabs) SetSelectedStyle ¶
SetSelectedStyle updates the selected tab style.
type TabularDataSource ¶
TabularDataSource provides virtualized tabular data.
type TabularEditable ¶
type TabularEditable interface {
TabularDataSource
SetCell(row, col int, value string)
}
TabularEditable allows editing tabular data.
type TabularRowProvider ¶
type TabularRowProvider interface {
TabularDataSource
Row(row int) []string
}
TabularRowProvider optionally provides full row slices.
type TagInput ¶
type TagInput struct {
FocusableBase
// contains filtered or unexported fields
}
TagInput is a focusable widget for entering and managing tags. Tags are displayed as [tag1] [tag2] followed by an input area.
func (*TagInput) HandleMessage ¶
func (t *TagInput) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage processes keyboard input.
func (*TagInput) InputBuffer ¶
InputBuffer returns the current input text.
func (*TagInput) Measure ¶
func (t *TagInput) Measure(constraints runtime.Constraints) runtime.Size
Measure returns the desired size.
func (*TagInput) Render ¶
func (t *TagInput) Render(ctx runtime.RenderContext)
Render draws the tag input widget.
func (*TagInput) SetMaxTags ¶
SetMaxTags sets the maximum number of tags allowed (0 = unlimited).
func (*TagInput) SetOnChange ¶
SetOnChange sets the change handler.
type Text ¶
type Text struct {
Base
// contains filtered or unexported fields
}
Text is a simple text display widget.
Example ¶
package main
import (
"m31labs.dev/fluffyui/backend"
"m31labs.dev/fluffyui/widgets"
)
func main() {
text := widgets.NewText("Hello\nWorld")
text.SetStyle(backend.DefaultStyle().Bold(true))
_ = text
}
Output:
func NewText ¶
func NewText(text string, opts ...TextOption) *Text
NewText creates a new text widget.
func (*Text) Direction ¶
Direction returns the effective text direction. If a direction was explicitly set, it returns that. Otherwise, it auto-detects from the text content.
func (*Text) Measure ¶
func (t *Text) Measure(constraints runtime.Constraints) runtime.Size
Measure returns the size needed to display the text.
func (*Text) SetA11yLabel ¶
SetA11yLabel overrides the accessibility label without changing visible text.
func (*Text) SetDirection ¶
SetDirection sets an explicit text direction override. Pass DirectionRTL for right-to-left or DirectionLTR for left-to-right. When set, auto-detection is bypassed.
type TextArea ¶
type TextArea struct {
FocusableBase
// contains filtered or unexported fields
}
TextArea is a multi-line text input widget.
Example ¶
package main
import (
"m31labs.dev/fluffyui/widgets"
)
func main() {
area := widgets.NewTextArea()
area.SetText("First line\nSecond line")
area.SetOnChange(func(text string) {})
_ = area
}
Output:
func NewTextArea ¶
func NewTextArea() *TextArea
NewTextArea creates a multi-line text editor with line wrapping, selection, clipboard support, and undo/redo history.
func (*TextArea) Blur ¶
func (t *TextArea) Blur()
Blur removes focus and announces validation errors if any.
func (*TextArea) ClearHighlights ¶
func (t *TextArea) ClearHighlights()
ClearHighlights removes all highlight ranges.
func (*TextArea) ClearHistory ¶
func (t *TextArea) ClearHistory()
ClearHistory resets the undo/redo history.
func (*TextArea) ClipboardCopy ¶
ClipboardCopy returns selected text, or all text if no selection.
func (*TextArea) ClipboardCut ¶
ClipboardCut cuts selected text, or all text if no selection.
func (*TextArea) ClipboardPaste ¶
ClipboardPaste inserts text at the cursor, replacing any selection.
func (*TextArea) CursorOffset ¶
CursorOffset returns the cursor offset in the text.
func (*TextArea) CursorPosition ¶
CursorPosition returns the cursor coordinates within the text area.
func (*TextArea) CursorWordLeft ¶
func (t *TextArea) CursorWordLeft()
CursorWordLeft moves the cursor to the previous word boundary.
func (*TextArea) CursorWordRight ¶
func (t *TextArea) CursorWordRight()
CursorWordRight moves the cursor to the next word boundary.
func (*TextArea) GetSelectedText ¶
GetSelectedText returns the currently selected text.
func (*TextArea) GetSelection ¶
GetSelection returns the current selection range.
func (*TextArea) HandleMessage ¶
func (t *TextArea) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage processes keyboard and mouse input.
func (*TextArea) HasSelection ¶
HasSelection returns true if text is selected.
func (*TextArea) Measure ¶
func (t *TextArea) Measure(constraints runtime.Constraints) runtime.Size
Measure returns the desired size. TextArea returns minimal preferred size (1x1) to work correctly in flex layouts. When flex containers measure children with unbounded constraints (maxInt), returning maxInt would cause the flex shrink algorithm to shrink this widget to 0.
func (*TextArea) Redo ¶
Redo reapplies a previously undone state. Returns true if redo was successful.
func (*TextArea) Render ¶
func (t *TextArea) Render(ctx runtime.RenderContext)
Render draws the text area.
func (*TextArea) SelectWord ¶
func (t *TextArea) SelectWord()
SelectWord selects the word at the cursor position.
func (*TextArea) SetCursorOffset ¶
SetCursorOffset moves the cursor to the given offset.
func (*TextArea) SetCursorPosition ¶
SetCursorPosition moves the cursor to the given coordinates.
func (*TextArea) SetFocusStyle ¶
SetFocusStyle sets the focused style.
func (*TextArea) SetGutterStyle ¶
SetGutterStyle sets the style for the line number gutter.
func (*TextArea) SetHighlights ¶
func (t *TextArea) SetHighlights(highlights []TextAreaHighlight)
SetHighlights replaces the highlight ranges. Ranges must be sorted by Start. The TextArea does not sort them — the caller is responsible for ordering.
func (*TextArea) SetOnChange ¶
SetOnChange registers a callback for text changes.
func (*TextArea) SetSelection ¶
SetSelection sets the selection range, clamping to valid bounds.
func (*TextArea) SetShowLineNumbers ¶
SetShowLineNumbers enables or disables the line number gutter.
func (*TextArea) SetTabMode ¶
SetTabMode controls whether Tab inserts a literal '\t' (true) or spaces (false).
func (*TextArea) SetTabSize ¶
SetTabSize sets the number of spaces for a tab. Default is 4.
func (*TextArea) SetValidators ¶
SetValidators updates validation rules for the text area.
func (*TextArea) SetVisibleLines ¶
SetVisibleLines limits the rendered/interactive display to the provided logical line indices. Passing nil or an empty slice restores all lines.
func (*TextArea) SetWordWrap ¶
SetWordWrap enables or disables soft wrapping for long lines.
func (*TextArea) Validate ¶
func (t *TextArea) Validate() []forms.ValidationError
Validate runs validation rules and returns validation errors.
func (*TextArea) VisibleLines ¶
VisibleLines returns the active logical line filter. Nil means all lines are visible.
type TextAreaHighlight ¶
type TextAreaHighlight struct {
Start int // rune offset, inclusive
End int // rune offset, exclusive
Style backend.Style // override style (typically just foreground color)
}
TextAreaHighlight defines a styled range within the TextArea content. Ranges are in rune offsets (not byte offsets) to match TextArea's internal []rune storage.
type TextOption ¶
TextOption configures a Text widget.
func WithTextA11yLabel ¶
func WithTextA11yLabel(label string) TextOption
WithTextA11yLabel sets an accessibility label override.
func WithTextDirection ¶
func WithTextDirection(dir i18n.Direction) TextOption
WithTextDirection sets an explicit text direction (DirectionLTR or DirectionRTL). When set, auto-detection is bypassed for rendering.
func WithTextStyle ¶
func WithTextStyle(style backend.Style) TextOption
WithTextStyle sets the text style.
type TimePicker ¶
type TimePicker struct {
FocusableBase
// contains filtered or unexported fields
}
TimePicker allows selecting a time of day.
func (*TimePicker) Bind ¶
func (t *TimePicker) Bind(services runtime.Services)
Bind attaches app services.
func (*TimePicker) HandleMessage ¶
func (t *TimePicker) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage processes keyboard input.
func (*TimePicker) Measure ¶
func (t *TimePicker) Measure(constraints runtime.Constraints) runtime.Size
Measure returns desired size.
func (*TimePicker) Render ¶
func (t *TimePicker) Render(ctx runtime.RenderContext)
Render draws the time.
func (*TimePicker) SetLabel ¶
func (t *TimePicker) SetLabel(label string)
SetLabel updates the accessibility label.
func (*TimePicker) SetOnChange ¶
func (t *TimePicker) SetOnChange(fn func(time.Time))
SetOnChange registers a change callback.
func (*TimePicker) SetOnSubmit ¶
func (t *TimePicker) SetOnSubmit(fn func(time.Time))
SetOnSubmit registers a submit callback.
func (*TimePicker) SetShowSeconds ¶
func (t *TimePicker) SetShowSeconds(show bool)
SetShowSeconds toggles second display.
func (*TimePicker) SetTime ¶
func (t *TimePicker) SetTime(value time.Time)
SetTime updates the selected time.
func (*TimePicker) StyleType ¶
func (t *TimePicker) StyleType() string
StyleType returns the selector type name.
func (*TimePicker) Time ¶
func (t *TimePicker) Time() time.Time
Time returns the current time selection.
type ToastStack ¶
type ToastStack struct {
Base
// contains filtered or unexported fields
}
ToastStack renders toast notifications.
Example ¶
package main
import (
"m31labs.dev/fluffyui/toast"
"m31labs.dev/fluffyui/widgets"
)
func main() {
manager := toast.NewToastManager()
stack := widgets.NewToastStack()
manager.SetOnChange(stack.SetToasts)
_ = stack
}
Output:
func NewToastStack ¶
func NewToastStack() *ToastStack
NewToastStack creates a new toast stack widget.
func (*ToastStack) Bind ¶
func (t *ToastStack) Bind(services runtime.Services)
Bind attaches app services.
func (*ToastStack) HandleMessage ¶
func (t *ToastStack) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage handles dismiss clicks.
func (*ToastStack) HasActiveAnimations ¶
func (t *ToastStack) HasActiveAnimations(now time.Time) bool
HasActiveAnimations returns true when any toast is animating.
func (*ToastStack) Measure ¶
func (t *ToastStack) Measure(constraints runtime.Constraints) runtime.Size
Measure fills the available space.
func (*ToastStack) Render ¶
func (t *ToastStack) Render(ctx runtime.RenderContext)
Render draws the toast stack.
func (*ToastStack) SetAnimationsEnabled ¶
func (t *ToastStack) SetAnimationsEnabled(enabled bool)
SetAnimationsEnabled toggles toast animations.
func (*ToastStack) SetLabel ¶
func (t *ToastStack) SetLabel(label string)
SetLabel updates the accessibility label.
func (*ToastStack) SetNow ¶
func (t *ToastStack) SetNow(now time.Time)
SetNow updates the animation timestamp.
func (*ToastStack) SetOnDismiss ¶
func (t *ToastStack) SetOnDismiss(fn func(id string))
SetOnDismiss registers a handler for dismiss actions.
func (*ToastStack) SetStyles ¶
func (t *ToastStack) SetStyles(bg, text, info, success, warn, err backend.Style)
SetStyles configures the toast styles by level.
func (*ToastStack) SetToasts ¶
func (t *ToastStack) SetToasts(toasts []*toast.Toast)
SetToasts updates the toast list.
func (*ToastStack) StyleType ¶
func (t *ToastStack) StyleType() string
StyleType returns the selector type name.
type Toggle ¶
type Toggle struct {
FocusableBase
// contains filtered or unexported fields
}
Toggle is a focusable on/off switch widget. It is visually distinct from a checkbox, rendering as a sliding toggle.
func NewToggle ¶
func NewToggle(on *state.Signal[bool], opts ...ToggleOption) *Toggle
NewToggle creates a toggle switch bound to the given signal.
func (*Toggle) HandleMessage ¶
func (t *Toggle) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage processes keyboard input for the toggle.
func (*Toggle) Measure ¶
func (t *Toggle) Measure(constraints runtime.Constraints) runtime.Size
Measure returns the desired size.
func (*Toggle) Render ¶
func (t *Toggle) Render(ctx runtime.RenderContext)
Render draws the toggle switch.
type ToggleOption ¶
ToggleOption configures a Toggle widget.
func WithToggleLabel ¶
func WithToggleLabel(label *state.Signal[string]) ToggleOption
WithToggleLabel sets the label displayed next to the toggle.
func WithToggleOnChange ¶
func WithToggleOnChange(fn func(bool)) ToggleOption
WithToggleOnChange sets the callback invoked when the toggle state changes.
type Tooltip ¶
type Tooltip struct {
Base
// contains filtered or unexported fields
}
Tooltip displays content anchored to a target widget.
func NewTooltip ¶
NewTooltip creates a tooltip wrapper.
func (*Tooltip) ChildWidgets ¶
ChildWidgets returns the tooltip target.
func (*Tooltip) HandleMessage ¶
func (t *Tooltip) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage forwards messages to the target and manages tooltip state.
func (*Tooltip) Measure ¶
func (t *Tooltip) Measure(constraints runtime.Constraints) runtime.Size
Measure returns the target size within constraints.
func (*Tooltip) Render ¶
func (t *Tooltip) Render(ctx runtime.RenderContext)
Render draws the target.
type TooltipOption ¶
TooltipOption configures a tooltip.
func WithTooltipGap ¶
func WithTooltipGap(gap int) TooltipOption
WithTooltipGap sets the gap between target and tooltip.
func WithTooltipPlacement ¶
func WithTooltipPlacement(placement PopoverPlacement) TooltipOption
WithTooltipPlacement sets the popover placement.
func WithTooltipTrigger ¶
func WithTooltipTrigger(trigger TooltipTrigger) TooltipOption
WithTooltipTrigger sets the activation trigger.
type TooltipTrigger ¶
type TooltipTrigger int
TooltipTrigger describes how a tooltip is activated.
const ( TooltipHover TooltipTrigger = iota TooltipFocus TooltipClick )
type TrackGridBuilder ¶
type TrackGridBuilder struct {
// contains filtered or unexported fields
}
TrackGridBuilder provides a fluent API for constructing track-based grids with CSS Grid-like column and row definitions.
func NewTrackGridBuilder ¶
func NewTrackGridBuilder() *TrackGridBuilder
NewTrackGridBuilder creates a new TrackGridBuilder.
func (*TrackGridBuilder) Add ¶
func (b *TrackGridBuilder) Add(w runtime.Widget, row, col int) *TrackGridBuilder
Add adds a widget at the given row and column with span 1x1.
func (*TrackGridBuilder) AddSpan ¶
func (b *TrackGridBuilder) AddSpan(w runtime.Widget, row, col, rowSpan, colSpan int) *TrackGridBuilder
AddSpan adds a widget at the given row and column with the specified spans.
func (*TrackGridBuilder) Build ¶
func (b *TrackGridBuilder) Build() *Grid
Build constructs the Grid from the builder configuration.
func (*TrackGridBuilder) Columns ¶
func (b *TrackGridBuilder) Columns(cols ...TrackSize) *TrackGridBuilder
Columns sets the column track definitions.
func (*TrackGridBuilder) GapSize ¶
func (b *TrackGridBuilder) GapSize(gap int) *TrackGridBuilder
GapSize sets the gap between grid cells.
func (*TrackGridBuilder) Rows ¶
func (b *TrackGridBuilder) Rows(rows ...TrackSize) *TrackGridBuilder
Rows sets the row track definitions.
type TrackSize ¶
type TrackSize struct {
Mode TrackSizeMode
Value float64
}
TrackSize defines the size of a grid column or row.
type TrackSizeMode ¶
type TrackSizeMode int
TrackSizeMode defines how a grid track is sized.
const ( TrackFixed TrackSizeMode = iota // Fixed pixel size TrackFr // Fractional unit (CSS fr) TrackAuto // Size to content )
type Tree ¶
type Tree struct {
FocusableBase
Root *TreeNode
// contains filtered or unexported fields
}
Tree renders a hierarchical tree.
Example ¶
package main
import (
"m31labs.dev/fluffyui/widgets"
)
func main() {
root := &widgets.TreeNode{
Label: "root",
Expanded: true,
Children: []*widgets.TreeNode{
{Label: "configs"},
{
Label: "data",
Expanded: true,
Children: []*widgets.TreeNode{
{Label: "2024"},
},
},
},
}
tree := widgets.NewTree(root)
_ = tree
}
Output:
func NewTree ¶
NewTree creates a hierarchical tree view rooted at the given node. Nodes can be expanded/collapsed with Enter and navigated with arrow keys.
func (*Tree) DeselectNode ¶
DeselectNode deselects the node at the given path.
func (*Tree) DragOrigin ¶
DragOrigin returns the flat index of the drag origin, or -1 if not dragging.
func (*Tree) DropIndex ¶
DropIndex returns the current drop target flat index, or -1 if not dragging.
func (*Tree) HandleMessage ¶
func (t *Tree) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage handles navigation and expansion.
func (*Tree) IsDraggable ¶
IsDraggable reports whether drag-and-drop is enabled.
func (*Tree) IsDragging ¶
IsDragging reports whether a drag operation is in progress.
func (*Tree) Measure ¶
func (t *Tree) Measure(constraints runtime.Constraints) runtime.Size
Measure returns desired size.
func (*Tree) MultiSelect ¶
MultiSelect reports whether multi-selection is enabled.
func (*Tree) SelectAll ¶
func (t *Tree) SelectAll()
SelectAll selects all visible (flattened) nodes.
func (*Tree) SelectNode ¶
SelectNode selects the node at the given path.
func (*Tree) SelectedNodes ¶
SelectedNodes returns the paths of all currently selected nodes, sorted by their position in the flattened tree (i.e. visual order).
func (*Tree) SetDragStyle ¶
SetDragStyle sets the style used for the drop indicator during drag.
func (*Tree) SetDraggable ¶
SetDraggable enables or disables drag-and-drop for tree nodes.
func (*Tree) SetMultiSelect ¶
SetMultiSelect enables or disables multi-selection.
func (*Tree) SetOnNodeDrop ¶
SetOnNodeDrop sets the callback invoked when nodes are dropped. sourcePaths are the paths of the dragged nodes; targetPath is the drop target.
func (*Tree) SetSelectedStyle ¶
SetSelectedStyle updates the selected row style.
func (*Tree) SetVirtualOverscan ¶
SetVirtualOverscan sets the number of extra rows to render above and below the visible area when virtual scrolling is enabled. Default is 2.
func (*Tree) SetVirtualScroll ¶
SetVirtualScroll enables or disables virtual scrolling for large trees. When enabled, only visible rows (plus overscan) are rendered each frame, which dramatically improves performance for trees with thousands of nodes.
func (*Tree) VirtualScroll ¶
VirtualScroll reports whether virtual scrolling is enabled.
func (*Tree) VisibleRange ¶
VisibleRange returns the [start, end) flattened node indices currently rendered.
type Validatable ¶
type Validatable interface {
SetValidators(validators ...forms.Validator)
Validate() []forms.ValidationError
Errors() []string
Valid() bool
}
Validatable represents widgets that can be validated with form validators.
type VideoPlayer ¶
type VideoPlayer struct {
Component
// contains filtered or unexported fields
}
VideoPlayer renders video frames onto a canvas.
func NewVideoPlayer ¶
func NewVideoPlayer(path string, opts ...VideoPlayerOption) (*VideoPlayer, error)
NewVideoPlayer creates a player and starts decoding frames.
func (*VideoPlayer) DroppedFrames ¶
func (v *VideoPlayer) DroppedFrames() int64
DroppedFrames returns the count of frames dropped during loading.
func (*VideoPlayer) HandleMessage ¶
func (v *VideoPlayer) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage advances playback on ticks and toggles play on spacebar.
func (*VideoPlayer) IsPlaying ¶
func (v *VideoPlayer) IsPlaying() bool
IsPlaying reports whether the player is currently playing.
func (*VideoPlayer) Layout ¶
func (v *VideoPlayer) Layout(bounds runtime.Rect)
Layout updates layout bounds and canvas size.
func (*VideoPlayer) Measure ¶
func (v *VideoPlayer) Measure(constraints runtime.Constraints) runtime.Size
Measure returns the desired size for the video player.
func (*VideoPlayer) Render ¶
func (v *VideoPlayer) Render(ctx runtime.RenderContext)
Render draws the current video frame.
func (*VideoPlayer) Seek ¶
func (v *VideoPlayer) Seek(pos time.Duration)
Seek moves the playhead to the given position.
func (*VideoPlayer) SetBlitter ¶
func (v *VideoPlayer) SetBlitter(blitter graphics.Blitter)
SetBlitter configures the blitter used for rendering frames.
func (*VideoPlayer) SetOnEnd ¶
func (v *VideoPlayer) SetOnEnd(fn func())
SetOnEnd registers a callback for when playback completes.
func (*VideoPlayer) StyleType ¶
func (v *VideoPlayer) StyleType() string
StyleType returns the selector type name.
func (*VideoPlayer) WithBlitter
deprecated
func (v *VideoPlayer) WithBlitter(blitter graphics.Blitter) *VideoPlayer
Deprecated: prefer WithVideoPlayerBlitter during construction or SetBlitter for mutation.
type VideoPlayerOption ¶
type VideoPlayerOption = Option[VideoPlayer]
VideoPlayerOption configures a VideoPlayer.
func WithVideoPlayerBlitter ¶
func WithVideoPlayerBlitter(blitter graphics.Blitter) VideoPlayerOption
WithVideoPlayerBlitter configures the blitter used for rendering frames.
func WithVideoPlayerOnEnd ¶
func WithVideoPlayerOnEnd(fn func()) VideoPlayerOption
WithVideoPlayerOnEnd registers a callback for when playback completes.
type VirtualList ¶
type VirtualList[T any] struct { FocusableBase // contains filtered or unexported fields }
VirtualList renders large datasets efficiently using virtualization.
func NewVirtualList ¶
func NewVirtualList[T any](adapter VirtualListAdapter[T]) *VirtualList[T]
NewVirtualList creates a virtual list widget.
func (*VirtualList[T]) Bind ¶
func (v *VirtualList[T]) Bind(services runtime.Services)
Bind attaches app services.
func (*VirtualList[T]) HandleMessage ¶
func (v *VirtualList[T]) HandleMessage(msg runtime.Message) runtime.HandleResult
HandleMessage handles navigation input.
func (*VirtualList[T]) Layout ¶
func (v *VirtualList[T]) Layout(bounds runtime.Rect)
Layout stores bounds and updates viewport height.
func (*VirtualList[T]) Measure ¶
func (v *VirtualList[T]) Measure(constraints runtime.Constraints) runtime.Size
Measure returns the desired size.
func (*VirtualList[T]) Offset ¶
func (v *VirtualList[T]) Offset() int
Offset returns the current scroll offset.
func (*VirtualList[T]) OnSelect
deprecated
func (v *VirtualList[T]) OnSelect(fn func(index int, item T))
OnSelect registers a selection handler on the virtual list.
Deprecated: Use SetOnSelect instead. This method will be removed in v1.0.
func (*VirtualList[T]) PageBy ¶
func (v *VirtualList[T]) PageBy(pages int)
PageBy scrolls selection by a number of pages.
func (*VirtualList[T]) Render ¶
func (v *VirtualList[T]) Render(ctx runtime.RenderContext)
Render draws the list items.
func (*VirtualList[T]) ScrollBy ¶
func (v *VirtualList[T]) ScrollBy(dx, dy int)
ScrollBy scrolls selection by delta rows.
func (*VirtualList[T]) ScrollTo ¶
func (v *VirtualList[T]) ScrollTo(x, y int)
ScrollTo scrolls to an absolute index.
func (*VirtualList[T]) ScrollToEnd ¶
func (v *VirtualList[T]) ScrollToEnd()
ScrollToEnd selects the last item.
func (*VirtualList[T]) ScrollToIndex ¶
func (v *VirtualList[T]) ScrollToIndex(index int)
ScrollToIndex scrolls to the specified index.
func (*VirtualList[T]) ScrollToOffset ¶
func (v *VirtualList[T]) ScrollToOffset(offset int)
ScrollToOffset scrolls to the specified offset in rows/pixels.
func (*VirtualList[T]) ScrollToStart ¶
func (v *VirtualList[T]) ScrollToStart()
ScrollToStart selects the first item.
func (*VirtualList[T]) SelectedIndex ¶
func (v *VirtualList[T]) SelectedIndex() int
SelectedIndex returns the current selection.
func (*VirtualList[T]) SelectedItem ¶
func (v *VirtualList[T]) SelectedItem() (T, bool)
SelectedItem returns the selected item.
func (*VirtualList[T]) SetAdapter ¶
func (v *VirtualList[T]) SetAdapter(adapter VirtualListAdapter[T])
SetAdapter replaces the data adapter.
func (*VirtualList[T]) SetBehavior ¶
func (v *VirtualList[T]) SetBehavior(behavior scroll.ScrollBehavior)
SetBehavior updates scroll behavior.
func (*VirtualList[T]) SetItemHeight ¶
func (v *VirtualList[T]) SetItemHeight(height int)
SetItemHeight sets a fixed item height for faster indexing.
func (*VirtualList[T]) SetItemHeightFunc ¶
func (v *VirtualList[T]) SetItemHeightFunc(fn func(index int) int)
SetItemHeightFunc sets a variable height function.
func (*VirtualList[T]) SetLabel ¶
func (v *VirtualList[T]) SetLabel(label string)
SetLabel updates the accessibility label.
func (*VirtualList[T]) SetLazyLoad ¶
func (v *VirtualList[T]) SetLazyLoad(fn func(start, end, total int))
SetLazyLoad registers a lazy-load callback for visible ranges.
func (*VirtualList[T]) SetLazyLoadThreshold ¶
func (v *VirtualList[T]) SetLazyLoadThreshold(threshold int)
SetLazyLoadThreshold sets the item count threshold for triggering lazy loads.
func (*VirtualList[T]) SetOnSelect ¶
func (v *VirtualList[T]) SetOnSelect(fn func(index int, item T))
SetOnSelect registers a selection handler.
func (*VirtualList[T]) SetOverscan ¶
func (v *VirtualList[T]) SetOverscan(count int)
SetOverscan updates the number of extra items to render.
func (*VirtualList[T]) SetSelected ¶
func (v *VirtualList[T]) SetSelected(index int)
SetSelected updates the selected index.
func (*VirtualList[T]) SetSelectedStyle ¶
func (v *VirtualList[T]) SetSelectedStyle(style backend.Style)
SetSelectedStyle updates the selected row style.
func (*VirtualList[T]) SetStyle ¶
func (v *VirtualList[T]) SetStyle(style backend.Style)
SetStyle updates the list base style.
func (*VirtualList[T]) SetWidgetPoolMax ¶
func (v *VirtualList[T]) SetWidgetPoolMax(max int)
SetWidgetPoolMax limits the pooled widget count when using widget factories.
func (*VirtualList[T]) StyleType ¶
func (v *VirtualList[T]) StyleType() string
StyleType returns the selector type name.
func (*VirtualList[T]) UseAdapterHeights ¶
func (v *VirtualList[T]) UseAdapterHeights()
UseAdapterHeights reverts to adapter-provided heights when available.
type VirtualListAdapter ¶
type VirtualListAdapter[T any] interface { Count() int Item(index int) T Render(item T, index int, selected bool, ctx runtime.RenderContext) }
VirtualListAdapter provides data for a virtual list.
type VirtualListFixedHeightProvider ¶
type VirtualListFixedHeightProvider interface {
FixedItemHeight() int
}
VirtualListFixedHeightProvider optionally provides a fixed item height.
type VirtualListHeightProvider ¶
VirtualListHeightProvider optionally provides variable item heights.
type VirtualListWidgetFactory ¶
type VirtualListWidgetFactory[T any] interface { NewWidget() runtime.Widget UpdateWidget(widget runtime.Widget, item T, index int, selected bool) }
VirtualListWidgetFactory provides pooled widget rendering.
type VirtualListWidgetResetter ¶
VirtualListWidgetResetter resets widgets before reusing them.
type WidgetPlugin ¶
type WidgetPlugin struct {
ID string
Name string
Version string
Description string
Categories []string
New func() runtime.Widget
}
WidgetPlugin describes a third-party widget plugin.
func WidgetPluginByID ¶
func WidgetPluginByID(id string) (WidgetPlugin, bool)
WidgetPluginByID fetches a plugin by ID.
func WidgetPlugins ¶
func WidgetPlugins() []WidgetPlugin
WidgetPlugins returns all registered plugins sorted by ID.
func (WidgetPlugin) Validate ¶
func (p WidgetPlugin) Validate() error
Validate returns an error if the plugin metadata is incomplete.
Source Files
¶
- accordion.go
- alert.go
- animated_gauge.go
- animated_widget.go
- aspect_ratio.go
- async_image.go
- autocomplete.go
- avatar.go
- badge.go
- base.go
- breadcrumb.go
- button.go
- calendar.go
- canvas_widget.go
- card.go
- charts.go
- checkbox.go
- chip.go
- color_picker.go
- combobox.go
- command_palette.go
- component.go
- data_grid.go
- date_range_picker.go
- datepicker.go
- debug_overlay.go
- dialog.go
- directory_tree.go
- disclosure.go
- drawer.go
- enhanced_palette.go
- file_picker.go
- flex.go
- focus_trap.go
- form.go
- gauge.go
- gpu_canvas.go
- grid.go
- grid_builder.go
- grid_track.go
- heatmap.go
- image.go
- input.go
- inspector.go
- interfaces.go
- layout.go
- line_chart.go
- link.go
- list.go
- log.go
- markdown_viewer.go
- masked_input.go
- menu.go
- multiselect.go
- notification_center.go
- number_input.go
- option.go
- pagination.go
- palette.go
- panel.go
- performance_dashboard.go
- plugin_registry.go
- popover.go
- progress_bar.go
- radio.go
- rating.go
- rich_text.go
- scrollview.go
- search.go
- section.go
- segmented_control.go
- select.go
- select_dropdown.go
- selection.go
- sidebar.go
- signal_label.go
- simple.go
- skeleton.go
- skip_nav.go
- slider.go
- spacer.go
- spinner.go
- splitter.go
- stack.go
- status_bar.go
- stepper.go
- table.go
- tabs.go
- tag_input.go
- text.go
- textarea.go
- time_picker.go
- toasts.go
- toggle.go
- tooltip.go
- tree.go
- validation_helpers.go
- video_player.go
- virtuallist.go