Documentation
¶
Overview ¶
Package input holds MujicaUI buttons, text fields, choices, form controls and general essentials.
Index ¶
- Constants
- func Banner(c *ui.Context, open *bool, message string, opts BannerOptions) core.AlertResult
- func BulkActionBar(c *ui.Context, selected int, opts BulkActionBarOptions, actions func()) core.ChoiceResult
- func Button(c *ui.Context, label string, opts ButtonOptions) ui.Element
- func ButtonColors(k theme.Tokens, v ButtonVariant, hover, pressed bool) (bg, fg, border ui.Color)
- func Cascader(c *ui.Context, path *[]string, opts CascaderOptions) core.ChoiceResult
- func Checkbox(c *ui.Context, value *bool, label string, opts CheckboxOptions) ui.Element
- func CheckboxGroup(c *ui.Context, label string, items []CheckboxItem, opts CheckboxGroupOptions) core.ChoiceResult
- func ChoiceChips[T comparable](c *ui.Context, value *[]T, items []ToggleItem[T], opts ChoiceChipsOptions) core.ChoiceResult
- func ColorPalette(c *ui.Context, value *ui.Color, swatches []ColorSwatch, ...) core.ChoiceResult
- func ColorPickerHex(col ui.Color) string
- func CopyButton(c *ui.Context, text string, opts CopyButtonOptions) core.ChoiceResult
- func CurrencyFormat(minor int64, decimals int, group bool) string
- func DockPanel(c *ui.Context, layout *DockLayout, items []DockItem, opts DockPanelOptions) core.ChoiceResult
- func FileDropZone(c *ui.Context, files *[]DroppedFile, opts FileDropZoneOptions) core.ChoiceResult
- func FormField(c *ui.Context, label string, opts FormFieldOptions, control func() ui.Element) ui.Element
- func FormItem[T any](c *ui.Context, f *FormScope, name string, value *T, opts FormItemOptions[T], ...) ui.Element
- func HoldToConfirm(c *ui.Context, label string, opts HoldToConfirmOptions) core.ChoiceResult
- func IconButton(c *ui.Context, icon *ui.SVG, label string, opts IconButtonOptions) ui.Element
- func Knob(c *ui.Context, value *float64, opts KnobOptions) core.ChoiceResult
- func MaskFormat(mask, raw string) string
- func Masonry(c *ui.Context, n int, opts MasonryOptions, item func(i int)) ui.Element
- func MultiSelect[T comparable](c *ui.Context, values *[]T, options []SelectOption[T], opts MultiSelectOptions) core.ChoiceResult
- func MultiSelectAll[T comparable](values []T, shown []SelectOption[T], on bool, limit int) []T
- func MultiSelectCheck(c *ui.Context, k theme.Tokens, on *bool, st internal.CheckState, label string, ...) ui.Element
- func MultiSelectSet[T comparable](values []T, v T, on bool) []T
- func MultiSelectTags[T comparable](c *ui.Context, values *[]T, options []SelectOption[T], opts MultiSelectOptions)
- func NumberInputButton(c *ui.Context, icon, name string, can bool) bool
- func QRCode(c *ui.Context, text string, opts QRCodeOptions) ui.Element
- func RadioGroup[T comparable](c *ui.Context, value *T, items []RadioItem[T], opts RadioGroupOptions) core.ChoiceResult
- func RangeSlider(c *ui.Context, low, high *float64, opts RangeSliderOptions) core.ChoiceResult
- func Rating(c *ui.Context, value *float64, opts RatingOptions) core.ChoiceResult
- func Select[T comparable](c *ui.Context, value *T, options []SelectOption[T], opts SelectOptions) core.ChoiceResult
- func SelectCheck(c *ui.Context, on bool)
- func SelectField(c *ui.Context, tr ui.Element, open bool, content func())
- func SelectLabel[T comparable](options []SelectOption[T], v T) (string, bool)
- func SelectNote(c *ui.Context, s string)
- func SelectPanel(c *ui.Context, panel ui.Element)
- func SelectRow(c *ui.Context, row ui.Element, highlighted, chosen bool, label string)
- func SelectSearch(c *ui.Context, query *string, placeholder string) ui.Element
- func SignaturePad(c *ui.Context, strokes *[][]SignaturePoint, opts SignaturePadOptions) core.ChoiceResult
- func SignaturePath(strokes [][]SignaturePoint) string
- func Slider(c *ui.Context, value *float64, opts SliderOptions) core.ChoiceResult
- func SliderControl(c *ui.Context, v float64, g SliderGeom, from, to float64) (s ui.Element, next float64, dragged bool)
- func SliderDecimals(vs ...float64) int
- func SliderThumbPaint(p *ui.Painter, k theme.Tokens, x, y float32, hot, focus bool)
- func SliderTrackPaint(p *ui.Painter, r ui.Rect, g SliderGeom, k theme.Tokens, marks []SliderMark, ...)
- func Switch(c *ui.Context, on *bool, label string, opts SwitchOptions) ui.Element
- func TextInputEditor(c *ui.Context, frame ui.Element, value *string, locked bool, ...) ui.Element
- func Toggle(c *ui.Context, on *bool, label string, opts ToggleOptions) ui.Element
- func ToggleGroup[T comparable](c *ui.Context, value *[]T, items []ToggleItem[T], opts ToggleGroupOptions) core.ChoiceResult
- func Transfer(c *ui.Context, target *[]string, items []TransferItem, opts TransferOptions) core.ChoiceResult
- func TreeSelect(c *ui.Context, selected *[]string, nodes []TreeSelectNode, ...) core.ChoiceResult
- func VerticalSlider(c *ui.Context, value *float64, opts VerticalSliderOptions) core.ChoiceResult
- type BannerOptions
- type BulkActionBarOptions
- type ButtonGroupItem
- type ButtonGroupOptions
- type ButtonGroupResult
- type ButtonOptions
- type ButtonVariant
- type CascaderLevel
- type CascaderNode
- type CascaderOptions
- type CascaderStatus
- type CheckboxGroupOptions
- type CheckboxItem
- type CheckboxOptions
- type ChoiceChipsOptions
- type ColorPaletteOptions
- type ColorPickerOptions
- type ColorPickerParts
- type ColorSwatch
- type ComboboxOptions
- type ComboboxResult
- type CopyButtonOptions
- type CurrencyInputOptions
- type DockItem
- type DockLayout
- type DockPanelOptions
- type DockZone
- type DroppedFile
- type FileDropZoneOptions
- type FilePickerOptions
- type FilePickerParts
- type FormFieldOptions
- type FormFieldState
- type FormItemOptions
- type FormOptions
- type FormParts
- type FormScope
- type FormState
- type HoldToConfirmOptions
- type IconButtonOptions
- type InputGroupButton
- type InputGroupOptions
- type InputGroupParts
- type InputResult
- func CurrencyInput(c *ui.Context, value *int64, opts CurrencyInputOptions) InputResult
- func MaskedInput(c *ui.Context, value *string, opts MaskedInputOptions) InputResult
- func MentionInput(c *ui.Context, value *string, mentions *[]Mention, opts MentionInputOptions) InputResult
- func NewInputResult(e, input ui.Element, changed, submitted bool) InputResult
- func NumberInput(c *ui.Context, value *float64, opts NumberInputOptions) InputResult
- func PasswordInput(c *ui.Context, value *string, opts PasswordInputOptions) InputResult
- func ScrubInput(c *ui.Context, label string, value *float64, opts ScrubInputOptions) InputResult
- func TextArea(c *ui.Context, value *string, opts TextAreaOptions) InputResult
- func TextInput(c *ui.Context, value *string, opts TextInputOptions) InputResult
- type KnobOptions
- type MaskedInputOptions
- type MasonryOptions
- type Mention
- type MentionCandidate
- type MentionInputOptions
- type MultiSelectOptions
- type NumberInputOptions
- type NumberInputSpec
- type PasswordInputOptions
- type PinInputOptions
- type PinInputParts
- type QRCodeOptions
- type QRLevel
- type QRMatrix
- type RadioGroupOptions
- type RadioItem
- type RangeSliderOptions
- type RatingOptions
- type ResizablePanel
- type ResizablePanelGroupOptions
- type ResizablePanelGroupResult
- type ScrubInputOptions
- type SearchInputOptions
- type SearchInputResult
- type SelectOption
- type SelectOptions
- type SignaturePadOptions
- type SignaturePoint
- type SliderGeom
- type SliderMark
- type SliderOptions
- type SwitchOptions
- type TagsInputOptions
- type TagsInputParts
- type TextAreaOptions
- type TextInputOptions
- type ToggleGroupOptions
- type ToggleItem
- type ToggleOptions
- type TransferItem
- type TransferOptions
- type TreeSelectNode
- type TreeSelectOptions
- type TreeSelectRule
- type VerticalSliderOptions
Examples ¶
- Banner
- BulkActionBar
- Button
- ButtonGroup
- Cascader
- Checkbox
- ChoiceChips
- ColorPalette
- ColorPicker
- Combobox
- CopyButton
- CurrencyInput
- DockPanel
- FileDropZone
- FilePicker
- Form
- FormField
- HoldToConfirm
- IconButton
- InputGroup
- Knob
- MaskedInput
- Masonry
- MentionInput
- MultiSelect
- NumberInput
- PasswordInput
- PinInput
- QRCode
- RadioGroup
- RangeSlider
- Rating
- ResizablePanelGroup
- ScrubInput
- SearchInput
- Select
- SignaturePad
- Slider
- Switch
- TagsInput
- TextArea
- TextInput
- Toggle
- ToggleGroup
- Transfer
- TreeSelect
- VerticalSlider
Constants ¶
const ( SliderThumb float32 = 16 SliderTrack float32 = 4 )
Variables ¶
This section is empty.
Functions ¶
func Banner ¶
func Banner(c *ui.Context, open *bool, message string, opts BannerOptions) core.AlertResult
Banner is a full-width notice for the top of a page; a non-nil open adds a close button.
Example ¶
package main
import (
"github.com/egoist/mygo/ui"
"github.com/ELY-Open-Source/MujicaUI/core"
"github.com/ELY-Open-Source/MujicaUI/input"
)
func main() {
open := true
view := func(c *ui.Context) {
core.Use(c, core.Settings{})
r := input.Banner(c, &open, "Maintenance tonight at 22:00.", input.BannerOptions{
Severity: core.SeverityWarning,
Action: "Details",
})
if r.Action {
// show the details
}
}
ui.Render(view, 400, 300, 1)
}
Output:
func BulkActionBar ¶
func BulkActionBar(c *ui.Context, selected int, opts BulkActionBarOptions, actions func()) core.ChoiceResult
BulkActionBar shows while selected > 0 with the count, actions and a clear button; Changed reports a clear.
Example ¶
package main
import (
"github.com/egoist/mygo/ui"
"github.com/ELY-Open-Source/MujicaUI/core"
"github.com/ELY-Open-Source/MujicaUI/input"
)
func main() {
selected := 3
view := func(c *ui.Context) {
core.Use(c, core.Settings{})
r := input.BulkActionBar(c, selected, input.BulkActionBarOptions{}, func() {
input.Button(c, "Archive", input.ButtonOptions{Variant: input.Secondary})
})
if r.Changed() {
selected = 0
}
}
ui.Render(view, 400, 300, 1)
}
Output:
func Button ¶
Button is a push button. Loading keeps its size and blocks clicks.
Example ¶
package main
import (
"fmt"
"github.com/egoist/mygo/ui"
"github.com/ELY-Open-Source/MujicaUI/core"
"github.com/ELY-Open-Source/MujicaUI/icons"
"github.com/ELY-Open-Source/MujicaUI/input"
)
func main() {
view := func(c *ui.Context) {
core.Use(c, core.Settings{})
if input.Button(c, "Save", input.ButtonOptions{Icon: icons.Must("check")}).Clicked() {
fmt.Println("saved")
}
}
ui.Render(view, 400, 300, 1)
}
Output:
func ButtonColors ¶
func Cascader ¶
func Cascader(c *ui.Context, path *[]string, opts CascaderOptions) core.ChoiceResult
Cascader chooses a path through levels the caller supplies, loading children on demand.
Example ¶
package main
import (
"github.com/egoist/mygo/ui"
"github.com/ELY-Open-Source/MujicaUI/core"
"github.com/ELY-Open-Source/MujicaUI/input"
)
func main() {
var path []string
level := func(p []string) input.CascaderLevel {
if len(p) == 0 {
return input.CascaderLevel{Nodes: []input.CascaderNode{{Value: "fr", Label: "France"}}}
}
return input.CascaderLevel{Nodes: []input.CascaderNode{{Value: "paris", Label: "Paris", Leaf: true}}}
}
view := func(c *ui.Context) {
core.Use(c, core.Settings{})
input.Cascader(c, &path, input.CascaderOptions{Level: level, Label: "City"})
}
ui.Render(view, 400, 300, 1)
}
Output:
func Checkbox ¶
Checkbox toggles *value; a click on the box or its label toggles, as does Space.
Example ¶
package main
import (
"github.com/egoist/mygo/ui"
"github.com/ELY-Open-Source/MujicaUI/core"
"github.com/ELY-Open-Source/MujicaUI/input"
)
func main() {
var mail, calendar bool
view := func(c *ui.Context) {
core.Use(c, core.Settings{})
input.CheckboxGroup(c, "Notifications", []input.CheckboxItem{
{Label: "Mail", Value: &mail},
{Label: "Calendar", Value: &calendar},
}, input.CheckboxGroupOptions{})
}
ui.Render(view, 400, 300, 1)
}
Output:
func CheckboxGroup ¶
func CheckboxGroup(c *ui.Context, label string, items []CheckboxItem, opts CheckboxGroupOptions) core.ChoiceResult
CheckboxGroup shows a select-all box over items: checked, mixed or clear.
func ChoiceChips ¶
func ChoiceChips[T comparable](c *ui.Context, value *[]T, items []ToggleItem[T], opts ChoiceChipsOptions) core.ChoiceResult
ChoiceChips are wrapping filter chips toggling values in *value; arrows move between them.
Example ¶
package main
import (
"github.com/egoist/mygo/ui"
"github.com/ELY-Open-Source/MujicaUI/core"
"github.com/ELY-Open-Source/MujicaUI/input"
)
func main() {
var status []string
view := func(c *ui.Context) {
core.Use(c, core.Settings{})
input.ChoiceChips(c, &status, []input.ToggleItem[string]{
{Value: "open", Label: "Open"}, {Value: "closed", Label: "Closed"},
}, input.ChoiceChipsOptions{Multiple: true, Label: "Status"})
}
ui.Render(view, 400, 300, 1)
}
Output:
func ColorPalette ¶
func ColorPalette(c *ui.Context, value *ui.Color, swatches []ColorSwatch, opts ColorPaletteOptions) core.ChoiceResult
ColorPalette picks *value from preset swatches in a grid; arrows move in two dimensions.
Example ¶
package main
import (
"github.com/egoist/mygo/ui"
"github.com/ELY-Open-Source/MujicaUI/core"
"github.com/ELY-Open-Source/MujicaUI/input"
)
func main() {
color := ui.Hex("#7D2034")
view := func(c *ui.Context) {
core.Use(c, core.Settings{})
input.ColorPalette(c, &color, []input.ColorSwatch{
{Color: ui.Hex("#7D2034"), Name: "Wine"},
{Color: ui.Hex("#AD9164"), Name: "Old gold"},
{Color: ui.Hex("#355E80"), Name: "Slate blue"},
}, input.ColorPaletteOptions{Custom: true, Label: "Tag color"})
}
ui.Render(view, 400, 300, 1)
}
Output:
func ColorPickerHex ¶
ColorPickerHex returns col as #rrggbb, or #rrggbbaa when translucent.
func CopyButton ¶
func CopyButton(c *ui.Context, text string, opts CopyButtonOptions) core.ChoiceResult
CopyButton puts text on the clipboard, then shows and announces Copied for two seconds.
Example ¶
package main
import (
"github.com/egoist/mygo/ui"
"github.com/ELY-Open-Source/MujicaUI/core"
"github.com/ELY-Open-Source/MujicaUI/input"
)
func main() {
view := func(c *ui.Context) {
core.Use(c, core.Settings{})
input.CopyButton(c, "https://example.com/invite/42", input.CopyButtonOptions{Label: "Copy link"})
}
ui.Render(view, 400, 300, 1)
}
Output:
func CurrencyFormat ¶
CurrencyFormat writes minor units as an amount with thousands separators.
func DockPanel ¶
func DockPanel(c *ui.Context, layout *DockLayout, items []DockItem, opts DockPanelOptions) core.ChoiceResult
DockPanel arranges panels in left, center, right and bottom zones; tabs drag to an edge or zone to dock there.
Example ¶
package main
import (
"github.com/egoist/mygo/ui"
"github.com/ELY-Open-Source/MujicaUI/core"
"github.com/ELY-Open-Source/MujicaUI/input"
)
func main() {
var layout input.DockLayout
view := func(c *ui.Context) {
core.Use(c, core.Settings{})
r := input.DockPanel(c, &layout, []input.DockItem{
{ID: "files", Title: "Files", Build: func() { ui.Text(c, "Files") }},
{ID: "terminal", Title: "Terminal", Build: func() { ui.Text(c, "$") }},
}, input.DockPanelOptions{})
if r.Changed() {
// save layout
}
}
ui.Render(view, 400, 300, 1)
}
Output:
func FileDropZone ¶
func FileDropZone(c *ui.Context, files *[]DroppedFile, opts FileDropZoneOptions) core.ChoiceResult
FileDropZone checks dropped or browsed files and lists them; it never reads or uploads them.
Example ¶
package main
import (
"github.com/egoist/mygo/ui"
"github.com/ELY-Open-Source/MujicaUI/core"
"github.com/ELY-Open-Source/MujicaUI/input"
)
func main() {
var files []input.DroppedFile
view := func(c *ui.Context) {
core.Use(c, core.Settings{})
input.FileDropZone(c, &files, input.FileDropZoneOptions{
Extensions: []string{"png", "jpg"}, MaxFiles: 3, MaxSize: 5 << 20,
})
}
ui.Render(view, 400, 300, 1)
}
Output:
func FormField ¶
func FormField(c *ui.Context, label string, opts FormFieldOptions, control func() ui.Element) ui.Element
FormField labels the element control returns and shows help and error text for it.
Example ¶
package main
import (
"github.com/egoist/mygo/ui"
"github.com/ELY-Open-Source/MujicaUI/core"
"github.com/ELY-Open-Source/MujicaUI/input"
)
func main() {
email := ""
view := func(c *ui.Context) {
core.Use(c, core.Settings{})
input.FormField(c, "Email", input.FormFieldOptions{Required: true, Description: "For receipts."}, func() ui.Element {
return input.InputGroup(c, &email, input.InputGroupOptions{}).Input
})
}
ui.Render(view, 400, 300, 1)
}
Output:
func FormItem ¶
func FormItem[T any](c *ui.Context, f *FormScope, name string, value *T, opts FormItemOptions[T], control func() ui.Element) ui.Element
FormItem registers field name around the focusable element control returns.
func HoldToConfirm ¶
func HoldToConfirm(c *ui.Context, label string, opts HoldToConfirmOptions) core.ChoiceResult
HoldToConfirm runs a dangerous action only after the pointer or Space is held for Duration.
Example ¶
package main
import (
"github.com/egoist/mygo/ui"
"github.com/ELY-Open-Source/MujicaUI/core"
"github.com/ELY-Open-Source/MujicaUI/input"
)
func main() {
view := func(c *ui.Context) {
core.Use(c, core.Settings{})
if input.HoldToConfirm(c, "Delete project", input.HoldToConfirmOptions{}).Changed() {
// delete the project
}
}
ui.Render(view, 400, 300, 1)
}
Output:
func IconButton ¶
IconButton is a square button showing only icon; label names its action.
Example ¶
package main
import (
"fmt"
"github.com/egoist/mygo/ui"
"github.com/ELY-Open-Source/MujicaUI/core"
"github.com/ELY-Open-Source/MujicaUI/icons"
"github.com/ELY-Open-Source/MujicaUI/input"
)
func main() {
view := func(c *ui.Context) {
core.Use(c, core.Settings{})
if input.IconButton(c, icons.Must("settings"), "Settings", input.IconButtonOptions{Variant: input.Ghost}).Clicked() {
fmt.Println("open settings")
}
}
ui.Render(view, 400, 300, 1)
}
Output:
func Knob ¶
func Knob(c *ui.Context, value *float64, opts KnobOptions) core.ChoiceResult
Knob sets *value by dragging up and down, the arrows, Home and End; the dial shows the value and ticks.
Example ¶
package main
import (
"github.com/egoist/mygo/ui"
"github.com/ELY-Open-Source/MujicaUI/core"
"github.com/ELY-Open-Source/MujicaUI/input"
)
func main() {
gain := 35.0
view := func(c *ui.Context) {
core.Use(c, core.Settings{})
input.Knob(c, &gain, input.KnobOptions{Label: "Gain", Ticks: 11})
}
ui.Render(view, 400, 300, 1)
}
Output:
func MaskFormat ¶
MaskFormat lays raw into mask; unfilled slots show as underscores.
func Masonry ¶
Masonry lays n items in as many columns as fit, each into the shortest column, building only those in view.
Example ¶
package main
import (
"github.com/egoist/mygo/ui"
"github.com/ELY-Open-Source/MujicaUI/core"
"github.com/ELY-Open-Source/MujicaUI/input"
)
func main() {
titles := []string{"Sea", "Forest", "Desert", "Glacier"}
view := func(c *ui.Context) {
core.Use(c, core.Settings{})
input.Masonry(c, len(titles), input.MasonryOptions{
Key: func(i int) string { return titles[i] },
}, func(i int) {
ui.Text(c, titles[i])
}).Size(380, 280)
}
ui.Render(view, 400, 300, 1)
}
Output:
func MultiSelect ¶
func MultiSelect[T comparable](c *ui.Context, values *[]T, options []SelectOption[T], opts MultiSelectOptions) core.ChoiceResult
MultiSelect chooses several *values from options in a popup with search and "Select all".
Example ¶
package main
import (
"github.com/egoist/mygo/ui"
"github.com/ELY-Open-Source/MujicaUI/core"
"github.com/ELY-Open-Source/MujicaUI/input"
)
func main() {
tags := []int{1}
options := []input.SelectOption[int]{
{Value: 1, Label: "Rose"},
{Value: 2, Label: "Lily"},
{Value: 3, Label: "Iris"},
}
view := func(c *ui.Context) {
core.Use(c, core.Settings{})
input.MultiSelect(c, &tags, options, input.MultiSelectOptions{Max: 2, Label: "Flowers"})
}
ui.Render(view, 400, 300, 1)
}
Output:
func MultiSelectAll ¶
func MultiSelectAll[T comparable](values []T, shown []SelectOption[T], on bool, limit int) []T
MultiSelectAll checks every enabled shown option up to max, or unchecks them all.
func MultiSelectCheck ¶
func MultiSelectCheck(c *ui.Context, k theme.Tokens, on *bool, st internal.CheckState, label string, disabled bool) ui.Element
MultiSelectCheck is a CheckboxBase row drawing its own box.
func MultiSelectSet ¶
func MultiSelectSet[T comparable](values []T, v T, on bool) []T
MultiSelectSet adds or removes v.
func MultiSelectTags ¶
func MultiSelectTags[T comparable](c *ui.Context, values *[]T, options []SelectOption[T], opts MultiSelectOptions)
MultiSelectTags shows the chosen values as removable tags, collapsing the rest into "+N".
func NumberInputButton ¶
NumberInputButton builds a pointer-only step button; Up and Down are its keys.
func QRCode ¶
QRCode draws text as a QR code, encoded offline; too long a text shows an error.
Example ¶
package main
import (
"github.com/egoist/mygo/ui"
"github.com/ELY-Open-Source/MujicaUI/core"
"github.com/ELY-Open-Source/MujicaUI/input"
)
func main() {
view := func(c *ui.Context) {
core.Use(c, core.Settings{})
input.QRCode(c, "https://example.com/mujica", input.QRCodeOptions{Level: input.QRQuartile})
}
ui.Render(view, 400, 300, 1)
}
Output:
func RadioGroup ¶
func RadioGroup[T comparable](c *ui.Context, value *T, items []RadioItem[T], opts RadioGroupOptions) core.ChoiceResult
RadioGroup chooses one item's Value into *value; arrows move the choice.
Example ¶
package main
import (
"fmt"
"github.com/egoist/mygo/ui"
"github.com/ELY-Open-Source/MujicaUI/core"
"github.com/ELY-Open-Source/MujicaUI/input"
)
func main() {
size := "m"
view := func(c *ui.Context) {
core.Use(c, core.Settings{})
items := []input.RadioItem[string]{{Value: "s", Label: "Small"}, {Value: "m", Label: "Medium"}, {Value: "l", Label: "Large"}}
if input.RadioGroup(c, &size, items, input.RadioGroupOptions{Label: "Size"}).Changed() {
fmt.Println("size", size)
}
}
ui.Render(view, 400, 300, 1)
}
Output:
func RangeSlider ¶
func RangeSlider(c *ui.Context, low, high *float64, opts RangeSliderOptions) core.ChoiceResult
RangeSlider sets *low and *high, which never cross; a press moves the nearer thumb, each takes the keys.
Example ¶
package main
import (
"github.com/egoist/mygo/ui"
"github.com/ELY-Open-Source/MujicaUI/core"
"github.com/ELY-Open-Source/MujicaUI/input"
)
func main() {
low, high := 20.0, 80.0
view := func(c *ui.Context) {
core.Use(c, core.Settings{})
input.RangeSlider(c, &low, &high, input.RangeSliderOptions{Step: 10, Label: "Price"})
}
ui.Render(view, 400, 300, 1)
}
Output:
func Rating ¶
func Rating(c *ui.Context, value *float64, opts RatingOptions) core.ChoiceResult
Rating shows *value as stars and lets the pointer and arrows set it in steps.
Example ¶
package main
import (
"github.com/egoist/mygo/ui"
"github.com/ELY-Open-Source/MujicaUI/core"
"github.com/ELY-Open-Source/MujicaUI/input"
)
func main() {
stars := 3.5
view := func(c *ui.Context) {
core.Use(c, core.Settings{})
input.Rating(c, &stars, input.RatingOptions{Step: 0.5, ShowValue: true})
}
ui.Render(view, 400, 300, 1)
}
Output:
func Select ¶
func Select[T comparable](c *ui.Context, value *T, options []SelectOption[T], opts SelectOptions) core.ChoiceResult
Select chooses *value from options in a popup; typing on the closed select jumps to a match.
Example ¶
package main
import (
"github.com/egoist/mygo/ui"
"github.com/ELY-Open-Source/MujicaUI/core"
"github.com/ELY-Open-Source/MujicaUI/input"
)
func main() {
plan := ""
options := []input.SelectOption[string]{
{Value: "free", Label: "Free"},
{Value: "pro", Label: "Pro"},
{Value: "team", Label: "Team", Disabled: true},
}
view := func(c *ui.Context) {
core.Use(c, core.Settings{})
input.Select(c, &plan, options, input.SelectOptions{Clearable: true, Label: "Plan"})
}
ui.Render(view, 400, 300, 1)
}
Output:
func SelectCheck ¶
SelectCheck reserves room for the chosen mark and draws it when on.
func SelectField ¶
SelectField styles tr as a field that opens a popup, with content and a chevron.
func SelectLabel ¶
func SelectLabel[T comparable](options []SelectOption[T], v T) (string, bool)
func SelectNote ¶
SelectNote shows a muted line in a popup, as an empty state.
func SelectPanel ¶
SelectPanel styles a popup panel.
func SelectRow ¶
SelectRow styles an option row: chosen has the selection fill and a check, highlighted a side bar.
func SelectSearch ¶
SelectSearch is the search field at the top of a popup; it takes the focus as the popup opens.
func SignaturePad ¶
func SignaturePad(c *ui.Context, strokes *[][]SignaturePoint, opts SignaturePadOptions) core.ChoiceResult
SignaturePad records pointer strokes into *strokes; Changed reports a finished stroke or a clear.
Example ¶
package main
import (
"github.com/egoist/mygo/ui"
"github.com/ELY-Open-Source/MujicaUI/core"
"github.com/ELY-Open-Source/MujicaUI/input"
)
func main() {
var strokes [][]input.SignaturePoint
view := func(c *ui.Context) {
core.Use(c, core.Settings{})
if input.SignaturePad(c, &strokes, input.SignaturePadOptions{}).Changed() {
_ = input.SignaturePath(strokes) // SVG path data to store
}
}
ui.Render(view, 400, 300, 1)
}
Output:
func SignaturePath ¶
func SignaturePath(strokes [][]SignaturePoint) string
SignaturePath writes strokes as SVG path data: "M x y L x y …" per stroke.
func Slider ¶
func Slider(c *ui.Context, value *float64, opts SliderOptions) core.ChoiceResult
Slider sets *value by dragging anywhere on its box, the arrows (one Step), Home and End.
Example ¶
package main
import (
"github.com/egoist/mygo/ui"
"github.com/ELY-Open-Source/MujicaUI/core"
"github.com/ELY-Open-Source/MujicaUI/input"
)
func main() {
volume := 40.0
view := func(c *ui.Context) {
core.Use(c, core.Settings{})
input.Slider(c, &volume, input.SliderOptions{Step: 5, ShowValue: true, Label: "Volume"})
}
ui.Render(view, 400, 300, 1)
}
Output:
func SliderControl ¶
func SliderControl(c *ui.Context, v float64, g SliderGeom, from, to float64) (s ui.Element, next float64, dragged bool)
SliderControl builds a SliderBase on a copy of v and returns where the pointer or a key moves v.
func SliderDecimals ¶
SliderDecimals counts the decimals the shortest form of each value needs.
func SliderThumbPaint ¶
SliderThumbPaint draws the diamond thumb at (x, y), with its focus ring.
func SliderTrackPaint ¶
func SliderTrackPaint(p *ui.Painter, r ui.Rect, g SliderGeom, k theme.Tokens, marks []SliderMark, size, x0, x1 float32)
SliderTrackPaint draws the rail, the filled part from x0 to x1, and the marks.
func Switch ¶
Switch turns *on over by click or Space; Changed reports it, the caller applies it.
Example ¶
package main
import (
"log"
"github.com/egoist/mygo/ui"
"github.com/ELY-Open-Source/MujicaUI/core"
"github.com/ELY-Open-Source/MujicaUI/input"
)
func main() {
wifi := true
view := func(c *ui.Context) {
core.Use(c, core.Settings{})
if input.Switch(c, &wifi, "Wi-Fi", input.SwitchOptions{}).Changed() {
log.Println("Wi-Fi:", wifi)
}
}
ui.Render(view, 400, 300, 1)
}
Output:
func TextInputEditor ¶
func TextInputEditor(c *ui.Context, frame ui.Element, value *string, locked bool, base func(*ui.Context, *string) ui.Element) ui.Element
TextInputEditor builds the MyGo editor; a locked one edits a copy, undone at once.
func Toggle ¶
Toggle is a button that stays pressed while *on. Click or Space flips it; Changed reports it.
Example ¶
package main
import (
"github.com/egoist/mygo/ui"
"github.com/ELY-Open-Source/MujicaUI/core"
"github.com/ELY-Open-Source/MujicaUI/icons"
"github.com/ELY-Open-Source/MujicaUI/input"
)
func main() {
bold := false
view := func(c *ui.Context) {
core.Use(c, core.Settings{})
input.Toggle(c, &bold, "", input.ToggleOptions{Icon: icons.Must("bold"), Label: "Bold"})
}
ui.Render(view, 400, 300, 1)
}
Output:
func ToggleGroup ¶
func ToggleGroup[T comparable](c *ui.Context, value *[]T, items []ToggleItem[T], opts ToggleGroupOptions) core.ChoiceResult
ToggleGroup is a joined row of toggles choosing one item of *value, or several with Multiple.
Example ¶
package main
import (
"github.com/egoist/mygo/ui"
"github.com/ELY-Open-Source/MujicaUI/core"
"github.com/ELY-Open-Source/MujicaUI/input"
)
func main() {
align := []string{"left"}
items := []input.ToggleItem[string]{
{Value: "left", Label: "Left"},
{Value: "center", Label: "Center"},
{Value: "right", Label: "Right"},
}
view := func(c *ui.Context) {
core.Use(c, core.Settings{})
input.ToggleGroup(c, &align, items, input.ToggleGroupOptions{Label: "Align"})
}
ui.Render(view, 400, 300, 1)
}
Output:
func Transfer ¶
func Transfer(c *ui.Context, target *[]string, items []TransferItem, opts TransferOptions) core.ChoiceResult
Transfer moves items between a source list and *target, the chosen IDs in order.
Example ¶
package main
import (
"github.com/egoist/mygo/ui"
"github.com/ELY-Open-Source/MujicaUI/core"
"github.com/ELY-Open-Source/MujicaUI/input"
)
func main() {
chosen := []string{"uika"}
items := []input.TransferItem{{ID: "uika", Label: "Uika"}, {ID: "mutsumi", Label: "Mutsumi"}, {ID: "nyamu", Label: "Nyamu", Disabled: true}}
view := func(c *ui.Context) {
core.Use(c, core.Settings{})
input.Transfer(c, &chosen, items, input.TransferOptions{})
}
ui.Render(view, 400, 300, 1)
}
Output:
func TreeSelect ¶
func TreeSelect(c *ui.Context, selected *[]string, nodes []TreeSelectNode, opts TreeSelectOptions) core.ChoiceResult
TreeSelect chooses one node, or several with Multiple, from a searchable tree in a popup.
Example ¶
package main
import (
"github.com/egoist/mygo/ui"
"github.com/ELY-Open-Source/MujicaUI/core"
"github.com/ELY-Open-Source/MujicaUI/input"
)
func main() {
var roles []string
nodes := []input.TreeSelectNode{
{ID: "court", Label: "Court", Children: []input.TreeSelectNode{
{ID: "king", Label: "King"},
{ID: "queen", Label: "Queen"},
}},
}
view := func(c *ui.Context) {
core.Use(c, core.Settings{})
input.TreeSelect(c, &roles, nodes, input.TreeSelectOptions{Multiple: true, Label: "Roles"})
}
ui.Render(view, 400, 300, 1)
}
Output:
func VerticalSlider ¶
func VerticalSlider(c *ui.Context, value *float64, opts VerticalSliderOptions) core.ChoiceResult
VerticalSlider is a Slider standing up: max at the top, Up and Right raise it.
Example ¶
package main
import (
"github.com/egoist/mygo/ui"
"github.com/ELY-Open-Source/MujicaUI/core"
"github.com/ELY-Open-Source/MujicaUI/input"
)
func main() {
level := 40.0
view := func(c *ui.Context) {
core.Use(c, core.Settings{})
input.VerticalSlider(c, &level, input.VerticalSliderOptions{Step: 10, Label: "Level"})
}
ui.Render(view, 400, 300, 1)
}
Output:
Types ¶
type BannerOptions ¶
type BannerOptions struct {
Severity core.Severity
// Action labels a button after the message; empty shows none.
Action string
}
BannerOptions configure a Banner.
type BulkActionBarOptions ¶
type BulkActionBarOptions struct {
Disabled bool
}
BulkActionBarOptions configure a BulkActionBar.
type ButtonGroupItem ¶
type ButtonGroupItem struct {
Label string
Icon *ui.SVG
// Name names an icon-only item for assistive technology.
Name string
Disabled bool
}
ButtonGroupItem is one button of a ButtonGroup. Give Label, Icon or both; icon-only needs Name.
type ButtonGroupOptions ¶
type ButtonGroupOptions struct {
Vertical bool
// Label names the group for assistive technology.
Label string
Disabled bool
}
ButtonGroupOptions configure a ButtonGroup.
type ButtonGroupResult ¶
ButtonGroupResult is the group element and the item clicked this frame.
func ButtonGroup ¶
func ButtonGroup(c *ui.Context, items []ButtonGroupItem, opts ButtonGroupOptions) ButtonGroupResult
ButtonGroup joins buttons in one bordered strip; arrows move between them.
Example ¶
package main
import (
"fmt"
"github.com/egoist/mygo/ui"
"github.com/ELY-Open-Source/MujicaUI/core"
"github.com/ELY-Open-Source/MujicaUI/input"
)
func main() {
view := func(c *ui.Context) {
core.Use(c, core.Settings{})
items := []input.ButtonGroupItem{{Label: "Day"}, {Label: "Week"}, {Label: "Month"}}
if i := input.ButtonGroup(c, items, input.ButtonGroupOptions{Label: "Range"}).ClickedItem(); i >= 0 {
fmt.Println("chose", items[i].Label)
}
}
ui.Render(view, 400, 300, 1)
}
Output:
func (ButtonGroupResult) ClickedItem ¶
func (r ButtonGroupResult) ClickedItem() int
ClickedItem returns the index of the item clicked this frame, or -1.
type ButtonOptions ¶
type ButtonOptions struct {
Variant ButtonVariant
// Icon goes before the label.
Icon *ui.SVG
Loading bool
Disabled bool
// Label names an icon-only button for assistive technology; required without a label.
Label string
}
ButtonOptions configure a Button.
type ButtonVariant ¶
type ButtonVariant int
ButtonVariant is a button's emphasis. The zero value is Primary.
const ( Primary ButtonVariant = iota Secondary Outline Ghost Danger )
type CascaderLevel ¶
type CascaderLevel struct {
Nodes []CascaderNode
Status CascaderStatus
// Err explains a failed load; it shows beside the retry button.
Err error
}
CascaderLevel is what the caller knows of the children under a path.
type CascaderNode ¶
type CascaderNode struct {
Value, Label string
// Leaf marks a node without children.
Leaf bool
Disabled bool
}
CascaderNode is one choice at a level of a Cascader.
type CascaderOptions ¶
type CascaderOptions struct {
// Level returns the children under path; the empty path is the roots.
Level func(path []string) CascaderLevel
// Load fetches the children under path while Idle and on retry; it marks the level Loading.
Load func(path []string)
// AnyLevel lets branches be chosen too; by default only leaves are.
AnyLevel bool
// Placeholder shows while nothing is chosen; empty uses "Select…".
Placeholder string
Disabled bool
// Label names the field for assistive technology.
Label string
}
CascaderOptions configure a Cascader. Level is required.
type CascaderStatus ¶
type CascaderStatus int
CascaderStatus is how far the caller got loading a level. The zero value is loaded.
const ( CascaderLoaded CascaderStatus = iota // CascaderIdle asks the Cascader to call Load for the level. CascaderIdle CascaderLoading CascaderFailed )
type CheckboxGroupOptions ¶
type CheckboxGroupOptions struct {
Disabled bool
}
CheckboxGroupOptions configure a CheckboxGroup.
type CheckboxItem ¶
CheckboxItem is one box of a CheckboxGroup.
type CheckboxOptions ¶
type CheckboxOptions struct {
// Indeterminate shows the mixed mark; a click then checks the box.
Indeterminate bool
Disabled bool
}
CheckboxOptions configure a Checkbox.
type ChoiceChipsOptions ¶
type ChoiceChipsOptions struct {
// Multiple lets several chips be on; otherwise one or none.
Multiple bool
Disabled bool
// Label names the chip set for assistive technology.
Label string
}
ChoiceChipsOptions configure ChoiceChips.
type ColorPaletteOptions ¶
type ColorPaletteOptions struct {
// Columns is the grid width in swatches; zero is 8.
Columns int
// Custom adds a ColorPicker after the swatches for any other color.
Custom bool
Disabled bool
// Label names the palette for assistive technology.
Label string
}
ColorPaletteOptions configure a ColorPalette.
type ColorPickerOptions ¶
type ColorPickerOptions struct {
// Presets are offered as swatches; nil uses the built-in court palette.
Presets []ui.Color
// Label names the trigger; empty uses the built-in "Color".
Label string
Disabled bool
}
ColorPickerOptions configure a ColorPicker.
type ColorPickerParts ¶
ColorPickerParts are the parts of a ColorPicker.
func ColorPicker ¶
func ColorPicker(c *ui.Context, color *ui.Color, opts ColorPickerOptions) ColorPickerParts
ColorPicker is a swatch button opening a panel that picks *color.
Example ¶
package main
import (
"github.com/egoist/mygo/ui"
"github.com/ELY-Open-Source/MujicaUI/core"
"github.com/ELY-Open-Source/MujicaUI/input"
)
func main() {
tint := ui.Hex("#7D2034")
view := func(c *ui.Context) {
core.Use(c, core.Settings{})
input.ColorPicker(c, &tint, input.ColorPickerOptions{Label: "Tint"})
}
ui.Render(view, 400, 300, 1)
}
Output:
func (ColorPickerParts) Changed ¶
func (p ColorPickerParts) Changed() bool
Changed reports whether the user picked a new color this frame.
type ColorSwatch ¶
ColorSwatch is one preset of a ColorPalette; Name is read out.
type ComboboxOptions ¶
type ComboboxOptions struct {
Placeholder string
// AllowCustom lets typed text that matches no option become the value.
AllowCustom bool
// ExternalFilter shows options as given: the caller already filtered them for Query.
ExternalFilter bool
// Loading shows that the caller is fetching options for Query.
Loading bool
Disabled bool
// Label names the field for assistive technology.
Label string
}
ComboboxOptions configure a Combobox.
type ComboboxResult ¶
type ComboboxResult struct {
core.ChoiceResult
// contains filtered or unexported fields
}
ComboboxResult is a Combobox's field, its value change and its query.
func Combobox ¶
func Combobox(c *ui.Context, value *string, options []string, opts ComboboxOptions) ComboboxResult
Combobox chooses *value by typing to filter options and picking one, or typed text with AllowCustom.
Example ¶
package main
import (
"log"
"github.com/egoist/mygo/ui"
"github.com/ELY-Open-Source/MujicaUI/core"
"github.com/ELY-Open-Source/MujicaUI/input"
)
func main() {
font := ""
fonts := []string{"Garamond", "Georgia", "Didot"}
view := func(c *ui.Context) {
core.Use(c, core.Settings{})
r := input.Combobox(c, &font, fonts, input.ComboboxOptions{AllowCustom: true, Label: "Font"})
if r.QueryChanged() {
log.Println("search:", r.Query())
}
}
ui.Render(view, 400, 300, 1)
}
Output:
func (ComboboxResult) Query ¶
func (r ComboboxResult) Query() string
Query returns the text in the field.
func (ComboboxResult) QueryChanged ¶
func (r ComboboxResult) QueryChanged() bool
QueryChanged reports whether the user typed in this frame: fetch new options then.
type CopyButtonOptions ¶
type CopyButtonOptions struct {
// Label shows beside the icon; empty makes a square icon button.
Label string
Disabled bool
}
CopyButtonOptions configure a CopyButton.
type CurrencyInputOptions ¶
type CurrencyInputOptions struct {
// Symbol goes before the amount, as "$" or "¥"; empty shows none.
Symbol string
// Decimals is the minor unit digits; zero is 2. NoFraction makes it 0, as for JPY.
Decimals int
NoFraction bool
Label string
Disabled bool
// Error marks the value invalid and shows the message below.
Error string
}
CurrencyInputOptions configure a CurrencyInput.
type DockItem ¶
type DockItem struct {
ID, Title string
Build func()
}
DockItem is one dockable panel.
type DockLayout ¶
DockLayout is the caller-held arrangement: panel IDs per zone in tab order, and each zone's shown tab.
type DockPanelOptions ¶
type DockPanelOptions struct {
Disabled bool
}
DockPanelOptions configure a DockPanel.
type DroppedFile ¶
DroppedFile is a file a FileDropZone accepted.
type FileDropZoneOptions ¶
type FileDropZoneOptions struct {
// Extensions lists the accepted extensions without the dot, matched case-insensitively.
Extensions []string
// MaxFiles caps how many files the list holds.
MaxFiles int
// MaxSize caps each file's size in bytes.
MaxSize int64
// Hint replaces the built-in "Drop files here".
Hint string
Disabled bool
}
FileDropZoneOptions configure a FileDropZone. Zero limits accept anything.
type FilePickerOptions ¶
type FilePickerOptions struct {
// Directory picks folders instead of files.
Directory bool
Multiple bool
// Filters limit the files offered by extension, without the dot.
Filters []mygo.FileFilter
// Title is the system dialog's title.
Title string
// Label is the button text; empty uses the built-in "Choose file…" or "Choose folder…".
Label string
// Parent attaches the dialog to a window, as a sheet on macOS.
Parent *mygo.Window
Disabled bool
}
FilePickerOptions configure a FilePicker.
type FilePickerParts ¶
FilePickerParts are the parts of a FilePicker.
func FilePicker ¶
func FilePicker(c *ui.Context, paths *[]string, opts FilePickerOptions) FilePickerParts
FilePicker opens the system file dialog off the UI thread and stores the chosen paths.
Example ¶
package main
import (
"github.com/egoist/mygo"
"github.com/egoist/mygo/ui"
"github.com/ELY-Open-Source/MujicaUI/core"
"github.com/ELY-Open-Source/MujicaUI/input"
)
func main() {
var paths []string
view := func(c *ui.Context) {
core.Use(c, core.Settings{})
input.FilePicker(c, &paths, input.FilePickerOptions{
Multiple: true,
Filters: []mygo.FileFilter{{Name: "Scores", Extensions: []string{"pdf", "mid"}}},
})
}
ui.Render(view, 400, 300, 1)
}
Output:
func (FilePickerParts) Canceled ¶
func (p FilePickerParts) Canceled() bool
Canceled reports whether the user closed the dialog without picking, which is not an error.
func (FilePickerParts) Changed ¶
func (p FilePickerParts) Changed() bool
Changed reports whether the user picked new paths this frame.
type FormFieldOptions ¶
type FormFieldOptions struct {
// Required marks the label; the check itself belongs to the caller or Form.
Required bool
Description string
// Error shows below the control and marks it invalid for assistive technology.
Error string
// Horizontal puts the label beside the control instead of above it.
Horizontal bool
}
FormFieldOptions configure a FormField.
type FormFieldState ¶
type FormFieldState struct {
// contains filtered or unexported fields
}
type FormItemOptions ¶
type FormItemOptions[T any] struct { Label string Required bool Description string // Initial is the value Reset restores. Initial T // Validate returns an error message for v, or ""; cross-field rules read other values here. Validate func(v T) string // Async starts a check of v off the UI thread, finished with FormState.Resolve(name, version, msg). Async func(v T, version uint64) }
FormItemOptions configure one field of a Form.
type FormOptions ¶
type FormOptions struct {
// Horizontal puts labels in a column beside the controls.
Horizontal bool
// SubmitLabel and ResetLabel replace the built-in "Submit" and "Reset".
SubmitLabel, ResetLabel string
}
FormOptions configure a Form.
type FormParts ¶
FormParts are the parts of a Form.
func Form ¶
Form lays out and checks its fields and shows submit and reset buttons.
Example ¶
package main
import (
"github.com/egoist/mygo/ui"
"github.com/ELY-Open-Source/MujicaUI/core"
"github.com/ELY-Open-Source/MujicaUI/input"
)
func main() {
var state input.FormState
name := ""
view := func(c *ui.Context) {
core.Use(c, core.Settings{})
res := input.Form(c, &state, input.FormOptions{}, func(f *input.FormScope) {
input.FormItem(c, f, "name", &name, input.FormItemOptions[string]{Label: "Name", Required: true}, func() ui.Element {
return input.InputGroup(c, &name, input.InputGroupOptions{Invalid: state.Error("name") != ""}).Input
})
})
if res.Submitted() {
state.EndSubmit("") // after saving name
}
}
ui.Render(view, 400, 300, 1)
}
Output:
type FormScope ¶
type FormScope struct {
// contains filtered or unexported fields
}
FormScope registers a Form's fields with FormItem.
type FormState ¶
type FormState struct {
Fields map[string]*FormFieldState
Order []string
Awaiting bool
Requested bool
// contains filtered or unexported fields
}
FormState is a form's check and submit state; use it on the UI thread only.
func (*FormState) EndSubmit ¶
EndSubmit finishes a submit; formError, if any, shows above the buttons and keeps all values.
func (*FormState) Error ¶
Error returns the error name shows now, "" when valid, untouched or pending.
func (*FormState) Resolve ¶
Resolve delivers name's async result for version, "" if valid; stale versions return false.
func (*FormState) Submit ¶
func (s *FormState) Submit()
Submit asks the form to submit in its next frame, as the submit button does.
func (*FormState) Submitting ¶
Submitting reports whether a submit is in progress.
type HoldToConfirmOptions ¶
type HoldToConfirmOptions struct {
// Duration is how long to hold; zero is 1.5 s.
Duration time.Duration
Disabled bool
}
HoldToConfirmOptions configure a HoldToConfirm.
type IconButtonOptions ¶
type IconButtonOptions struct {
// Variant is the emphasis; the zero value is Primary, as for Button.
Variant ButtonVariant
// Tooltip shows on hover; empty uses the button's name.
Tooltip string
Loading bool
Disabled bool
}
IconButtonOptions configure an IconButton.
type InputGroupButton ¶
type InputGroupButton struct {
// Label is shown, or names an icon-only button for assistive technology.
Label string
Icon *ui.SVG
// IconOnly hides Label on screen; Icon is then required.
IconOnly bool
// Leading puts the button before the input.
Leading bool
Disabled bool
}
InputGroupButton is a button joined to an InputGroup's border.
type InputGroupOptions ¶
type InputGroupOptions struct {
// Prefix and Suffix are fixed text beside the input, such as "https://".
Prefix, Suffix string
Buttons []InputGroupButton
Placeholder string
// Label names the input when it is not inside a FormField.
Label string
Disabled bool
// ReadOnly shows the value as selectable text that cannot change.
ReadOnly bool
// Invalid draws the border in the danger color.
Invalid bool
}
InputGroupOptions configure an InputGroup.
type InputGroupParts ¶
type InputGroupParts struct {
Group ui.Element
// Input takes the focus; it is selectable text when ReadOnly.
Input ui.Element
// Clicked is the index in Buttons of the button clicked, or -1.
Clicked int
// contains filtered or unexported fields
}
InputGroupParts are the parts of an InputGroup.
func InputGroup ¶
func InputGroup(c *ui.Context, value *string, opts InputGroupOptions) InputGroupParts
InputGroup joins an input, fixed text and buttons, each its own Tab stop, in one border.
Example ¶
package main
import (
"github.com/egoist/mygo/ui"
"github.com/ELY-Open-Source/MujicaUI/core"
"github.com/ELY-Open-Source/MujicaUI/input"
)
func main() {
site := ""
view := func(c *ui.Context) {
core.Use(c, core.Settings{})
g := input.InputGroup(c, &site, input.InputGroupOptions{
Prefix: "https://", Label: "Site",
Buttons: []input.InputGroupButton{{Label: "Open"}},
})
if g.Clicked == 0 {
c.OpenURL("https://" + site)
}
}
ui.Render(view, 400, 300, 1)
}
Output:
func (InputGroupParts) Changed ¶
func (p InputGroupParts) Changed() bool
Changed reports whether the user edited the value this frame.
func (InputGroupParts) Submitted ¶
func (p InputGroupParts) Submitted() bool
Submitted reports whether Enter was pressed in the input.
type InputResult ¶
type InputResult struct {
Element ui.Element
// Input is the text field inside, for focus and keys.
Input ui.Element
// contains filtered or unexported fields
}
InputResult is a value input's outer element and its events.
func CurrencyInput ¶
func CurrencyInput(c *ui.Context, value *int64, opts CurrencyInputOptions) InputResult
CurrencyInput edits *value, an amount in minor units (cents); it groups thousands while not focused.
Example ¶
package main
import (
"github.com/egoist/mygo/ui"
"github.com/ELY-Open-Source/MujicaUI/core"
"github.com/ELY-Open-Source/MujicaUI/input"
)
func main() {
cents := int64(123450)
view := func(c *ui.Context) {
core.Use(c, core.Settings{})
input.CurrencyInput(c, ¢s, input.CurrencyInputOptions{Symbol: "$", Label: "Price"})
}
ui.Render(view, 400, 300, 1)
}
Output:
func MaskedInput ¶
func MaskedInput(c *ui.Context, value *string, opts MaskedInputOptions) InputResult
MaskedInput edits *value, the characters typed into Mask's slots; an input method's composition commits only when done.
Example ¶
package main
import (
"github.com/egoist/mygo/ui"
"github.com/ELY-Open-Source/MujicaUI/core"
"github.com/ELY-Open-Source/MujicaUI/input"
)
func main() {
phone := ""
view := func(c *ui.Context) {
core.Use(c, core.Settings{})
input.MaskedInput(c, &phone, input.MaskedInputOptions{Mask: "(999) 999-9999", Label: "Phone"})
}
ui.Render(view, 400, 300, 1)
}
Output:
func MentionInput ¶
func MentionInput(c *ui.Context, value *string, mentions *[]Mention, opts MentionInputOptions) InputResult
MentionInput edits *value with "@" mentions kept in *mentions; a mention is deleted and stepped over whole.
Example ¶
package main
import (
"strings"
"github.com/egoist/mygo/ui"
"github.com/ELY-Open-Source/MujicaUI/core"
"github.com/ELY-Open-Source/MujicaUI/input"
)
func main() {
text, mentions := "", []input.Mention(nil)
people := []input.MentionCandidate{{ID: "u1", Name: "Alice"}, {ID: "u2", Name: "Bob"}}
view := func(c *ui.Context) {
core.Use(c, core.Settings{})
input.MentionInput(c, &text, &mentions, input.MentionInputOptions{
Label: "Comment",
Candidates: func(q string) []input.MentionCandidate {
var out []input.MentionCandidate
for _, p := range people {
if strings.HasPrefix(strings.ToLower(p.Name), strings.ToLower(q)) {
out = append(out, p)
}
}
return out
},
})
}
ui.Render(view, 400, 300, 1)
}
Output:
func NewInputResult ¶
func NewInputResult(e, input ui.Element, changed, submitted bool) InputResult
NewInputResult reports a text control built from parts in another component.
func NumberInput ¶
func NumberInput(c *ui.Context, value *float64, opts NumberInputOptions) InputResult
NumberInput edits *value as a number; Up and Down step it.
Example ¶
package main
import (
"fmt"
"github.com/egoist/mygo/ui"
"github.com/ELY-Open-Source/MujicaUI/core"
"github.com/ELY-Open-Source/MujicaUI/input"
)
func main() {
copies := 1.0
view := func(c *ui.Context) {
core.Use(c, core.Settings{})
if input.NumberInput(c, &copies, input.NumberInputOptions{Min: 1, Max: 99, Label: "Copies"}).Changed() {
fmt.Println("copies", copies)
}
}
ui.Render(view, 400, 300, 1)
}
Output:
func PasswordInput ¶
func PasswordInput(c *ui.Context, value *string, opts PasswordInputOptions) InputResult
PasswordInput is a masked field with a show and hide toggle.
Example ¶
package main
import (
"fmt"
"github.com/egoist/mygo/ui"
"github.com/ELY-Open-Source/MujicaUI/core"
"github.com/ELY-Open-Source/MujicaUI/input"
)
func main() {
var password string
view := func(c *ui.Context) {
core.Use(c, core.Settings{})
if input.PasswordInput(c, &password, input.PasswordInputOptions{Label: "Password"}).Submitted() {
fmt.Println("signing in")
}
}
ui.Render(view, 400, 300, 1)
}
Output:
func ScrubInput ¶
func ScrubInput(c *ui.Context, label string, value *float64, opts ScrubInputOptions) InputResult
ScrubInput edits *value by dragging its label sideways, one Step per 4 DIPs, or by typing in its field.
Example ¶
package main
import (
"github.com/egoist/mygo/ui"
"github.com/ELY-Open-Source/MujicaUI/core"
"github.com/ELY-Open-Source/MujicaUI/input"
)
func main() {
opacity := 0.6
view := func(c *ui.Context) {
core.Use(c, core.Settings{})
input.ScrubInput(c, "Opacity", &opacity, input.ScrubInputOptions{Max: 1, Step: 0.1})
}
ui.Render(view, 400, 300, 1)
}
Output:
func TextArea ¶
func TextArea(c *ui.Context, value *string, opts TextAreaOptions) InputResult
TextArea is a multi-line field editing *value.
Example ¶
package main
import (
"fmt"
"github.com/egoist/mygo/ui"
"github.com/ELY-Open-Source/MujicaUI/core"
"github.com/ELY-Open-Source/MujicaUI/input"
)
func main() {
var notes string
view := func(c *ui.Context) {
core.Use(c, core.Settings{})
r := input.TextArea(c, ¬es, input.TextAreaOptions{Label: "Notes", MaxHeight: 160, MaxLength: 200})
if r.Submitted() {
fmt.Println("send", notes)
}
}
ui.Render(view, 400, 300, 1)
}
Output:
func TextInput ¶
func TextInput(c *ui.Context, value *string, opts TextInputOptions) InputResult
TextInput is a single-line field editing *value.
Example ¶
package main
import (
"fmt"
"github.com/egoist/mygo/ui"
"github.com/ELY-Open-Source/MujicaUI/core"
"github.com/ELY-Open-Source/MujicaUI/input"
)
func main() {
var name string
view := func(c *ui.Context) {
core.Use(c, core.Settings{})
r := input.TextInput(c, &name, input.TextInputOptions{Label: "Name", Placeholder: "Your name", Clearable: true})
if r.Submitted() {
fmt.Println("hello", name)
}
}
ui.Render(view, 400, 300, 1)
}
Output:
func (InputResult) Changed ¶
func (r InputResult) Changed() bool
Changed reports that the user changed the value this frame.
func (InputResult) Submitted ¶
func (r InputResult) Submitted() bool
Submitted reports Enter, or the submit shortcut of a TextArea.
type KnobOptions ¶
type KnobOptions struct {
Min, Max float64
// Step snaps the value; zero is continuous, moving 1% per arrow press.
Step float64
// Ticks draws that many evenly spaced marks around the dial; zero draws none.
Ticks int
// Size is the dial diameter; zero is 56.
Size float32
// Format writes the value under the dial; nil prints as many decimals as Min and Step need.
Format func(float64) string
Disabled bool
// Label names the knob and shows above it.
Label string
}
KnobOptions configure a Knob. Min and Max both zero mean 0 to 100.
type MaskedInputOptions ¶
type MaskedInputOptions struct {
// Mask is required: 9 takes a digit, a a letter, * either; anything else shows as is.
Mask string
Label string
Disabled bool
// Error marks the value invalid and shows the message below.
Error string
}
MaskedInputOptions configure a MaskedInput.
type MasonryOptions ¶
type MasonryOptions struct {
// Key is required: a stable, unique key per item.
Key func(i int) string
// ColumnWidth is the narrowest column; zero is 220. Columns fill the width.
ColumnWidth float32
// Gap is between items; zero is 3 spacing units.
Gap float32
// Estimate is the height assumed until an item is measured; zero is 160.
Estimate float32
}
MasonryOptions configure a Masonry.
type Mention ¶
Mention is a whole "@Name" token in a MentionInput's text, at rune offsets [Start, End).
type MentionCandidate ¶
type MentionCandidate struct {
ID, Name string
}
MentionCandidate is someone a MentionInput may mention.
type MentionInputOptions ¶
type MentionInputOptions struct {
// Candidates is required: it returns matches for the text after "@", called when that text changes.
Candidates func(query string) []MentionCandidate
Placeholder string
Label string
Disabled bool
// Error marks the value invalid and shows the message below.
Error string
}
MentionInputOptions configure a MentionInput.
type MultiSelectOptions ¶
type MultiSelectOptions struct {
// Placeholder shows while nothing is chosen; empty uses "Select…".
Placeholder string
// Max limits how many values may be chosen; zero is no limit.
Max int
// MaxTags is how many chosen values show as tags before "+N"; zero is 3.
MaxTags int
Disabled bool
// Label names the field for assistive technology.
Label string
}
MultiSelectOptions configure a MultiSelect.
type NumberInputOptions ¶
type NumberInputOptions struct {
// Min and Max bound the value; equal bounds (the zero value) mean no bounds.
Min, Max float64
// Step is what Up, Down and the buttons add; zero means 1.
Step float64
// Precision is the decimals kept and shown; zero takes the decimals of Step.
Precision int
// AllowEmpty lets the field be empty, which sets the value to NaN.
AllowEmpty bool
// StepperOnly shows the value with step buttons and no typing; it needs bounds.
StepperOnly bool
Placeholder string
// Label names the field for assistive technology.
Label string
Disabled bool
// Error marks the value invalid and shows the message below.
Error string
}
NumberInputOptions configure a NumberInput.
type NumberInputSpec ¶
type NumberInputSpec struct {
// lo and hi are the bounds on the precision grid; min and max the original ones.
Lo, Hi, Step float64
Decimals int
// contains filtered or unexported fields
}
NumberInputSpec is NumberInputOptions resolved.
func NumberInputResolve ¶
func NumberInputResolve(opts NumberInputOptions) NumberInputSpec
func (NumberInputSpec) Round ¶
func (s NumberInputSpec) Round(v float64) float64
Round rounds v to the precision.
type PasswordInputOptions ¶
type PasswordInputOptions struct {
Placeholder string
// Label names the field for assistive technology.
Label string
Disabled bool
// Error marks the value invalid and shows the message below.
Error string
}
PasswordInputOptions configure a PasswordInput.
type PinInputOptions ¶
type PinInputOptions struct {
Length int
// Label names the input; empty uses the built-in "Verification code".
Label string
Disabled bool
// Invalid draws the cells in the danger color.
Invalid bool
}
PinInputOptions configure a PinInput. Length is 6 when zero.
type PinInputParts ¶
PinInputParts are the parts of a PinInput.
func PinInput ¶
func PinInput(c *ui.Context, value *string, opts PinInputOptions) PinInputParts
PinInput edits a fixed-length digit code, one cell per digit, keeping leading zeros.
Example ¶
package main
import (
"fmt"
"github.com/egoist/mygo/ui"
"github.com/ELY-Open-Source/MujicaUI/core"
"github.com/ELY-Open-Source/MujicaUI/input"
)
func main() {
code := ""
view := func(c *ui.Context) {
core.Use(c, core.Settings{})
if input.PinInput(c, &code, input.PinInputOptions{Length: 6}).Completed() {
fmt.Println("verify", code)
}
}
ui.Render(view, 400, 300, 1)
}
Output:
func (PinInputParts) Changed ¶
func (p PinInputParts) Changed() bool
Changed reports whether the user changed the code this frame.
func (PinInputParts) Completed ¶
func (p PinInputParts) Completed() bool
Completed reports whether the user filled the last cell this frame.
type QRCodeOptions ¶
type QRCodeOptions struct {
Level QRLevel
// Size is the side in DIPs with the quiet zone; zero is 160.
Size float32
// Label names the code for assistive technology; empty uses "QR code".
Label string
}
QRCodeOptions configure a QRCode.
type QRLevel ¶
type QRLevel int
QRLevel is a QR code's error correction level. The zero value is QRMedium.
type QRMatrix ¶
QRMatrix is an encoded QR code: Modules[y][x] is true for dark.
type RadioGroupOptions ¶
type RadioGroupOptions struct {
// Horizontal lays the choices in a row; the default is a column.
Horizontal bool
// Label names the group for assistive technology.
Label string
Disabled bool
}
RadioGroupOptions configure a RadioGroup.
type RadioItem ¶
type RadioItem[T comparable] struct { Value T Label string Disabled bool }
RadioItem is one choice of a RadioGroup; Value is its stable identity.
type RangeSliderOptions ¶
type RangeSliderOptions struct {
Min, Max float64
// Step snaps both ends to Min plus multiples of it; zero is continuous.
Step float64
Marks []SliderMark
ShowValue bool
Format func(float64) string
Disabled bool
// Label names the range; the thumbs read "<Label> minimum/maximum, value".
Label string
}
RangeSliderOptions configure a RangeSlider. Min and Max both zero mean 0 to 100.
type RatingOptions ¶
type RatingOptions struct {
Max int
// Step is the smallest change, such as 0.5 for half stars; it must divide 1.
Step float64
ReadOnly bool
Disabled bool
// Label names the rating; empty uses the built-in "Rating".
Label string
// ShowValue prints "3.5 / 5" beside the stars.
ShowValue bool
}
RatingOptions configure a Rating. Max is 5 and Step 1 when zero.
type ResizablePanel ¶
type ResizablePanel struct {
// Label names the panel; dividers read it out.
Label string
// Min is the smallest size in DIPs; zero is 10 spacing units.
Min float32
Collapsible bool
Build func()
}
ResizablePanel is one panel of a ResizablePanelGroup.
type ResizablePanelGroupOptions ¶
type ResizablePanelGroupOptions struct {
// Vertical stacks the panels top to bottom.
Vertical bool
Disabled bool
}
ResizablePanelGroupOptions configure a ResizablePanelGroup.
type ResizablePanelGroupResult ¶
ResizablePanelGroupResult reports a group's changes: Resized while moving, Committed when a change is done, to save.
func ResizablePanelGroup ¶
func ResizablePanelGroup(c *ui.Context, sizes *[]float32, panels []ResizablePanel, opts ResizablePanelGroupOptions) ResizablePanelGroupResult
ResizablePanelGroup lays panels in a row with dividers; *sizes holds their fractions, summing to 1, for the caller to save.
Example ¶
package main
import (
"github.com/egoist/mygo/ui"
"github.com/ELY-Open-Source/MujicaUI/core"
"github.com/ELY-Open-Source/MujicaUI/input"
)
func main() {
var sizes []float32
view := func(c *ui.Context) {
core.Use(c, core.Settings{})
r := input.ResizablePanelGroup(c, &sizes, []input.ResizablePanel{
{Label: "Files", Collapsible: true, Build: func() { ui.Text(c, "Files") }},
{Label: "Editor", Build: func() { ui.Text(c, "Editor") }},
}, input.ResizablePanelGroupOptions{})
if r.Committed {
// save sizes
}
}
ui.Render(view, 400, 300, 1)
}
Output:
type ScrubInputOptions ¶
ScrubInputOptions configure a ScrubInput; the range and step rules are NumberInput's.
type SearchInputOptions ¶
type SearchInputOptions struct {
// Placeholder is empty for the built-in "Search" or "Find".
Placeholder string
// Label names the field; empty uses the placeholder.
Label string
Disabled bool
// Find turns on find-bar mode: match count, previous and next.
Find bool
// Matches is how many matches the caller found for the query.
Matches int
// Current is the chosen match index; Find mode requires it.
Current *int
}
SearchInputOptions configure a SearchInput.
type SearchInputResult ¶
type SearchInputResult struct {
InputResult
// contains filtered or unexported fields
}
SearchInputResult adds find-bar moves to InputResult.
func SearchInput ¶
func SearchInput(c *ui.Context, query *string, opts SearchInputOptions) SearchInputResult
SearchInput is a search field with clear, or a find bar with match navigation.
Example ¶
package main
import (
"fmt"
"strings"
"github.com/egoist/mygo/ui"
"github.com/ELY-Open-Source/MujicaUI/core"
"github.com/ELY-Open-Source/MujicaUI/input"
)
func main() {
var query string
current := 0
text := "rose lys rose crown rose"
view := func(c *ui.Context) {
core.Use(c, core.Settings{})
matches := 0
if query != "" {
matches = strings.Count(text, query)
}
r := input.SearchInput(c, &query, input.SearchInputOptions{Find: true, Matches: matches, Current: ¤t})
if r.Moved() {
fmt.Println("show match", current)
}
}
ui.Render(view, 400, 300, 1)
}
Output:
func (SearchInputResult) Moved ¶
func (r SearchInputResult) Moved() bool
Moved reports that the user went to another match this frame.
type SelectOption ¶
type SelectOption[T comparable] struct { Value T Label string Disabled bool }
SelectOption is one choice of a Select or MultiSelect.
type SelectOptions ¶
type SelectOptions struct {
// Placeholder shows while no option holds the value; empty uses "Select…".
Placeholder string
// Clearable adds a clear button and Backspace/Delete, which set the zero value.
Clearable bool
Disabled bool
// Empty shows in the popup when there are no options; empty uses "No options".
Empty string
// Label names the select for assistive technology.
Label string
}
SelectOptions configure a Select.
type SignaturePadOptions ¶
type SignaturePadOptions struct {
// Height is the drawing area's height; zero is 160. The pad fills its parent's width.
Height float32
// Label names the pad; empty uses "Signature".
Label string
Disabled bool
}
SignaturePadOptions configure a SignaturePad.
type SignaturePoint ¶
type SignaturePoint struct{ X, Y float32 }
SignaturePoint is a point of a stroke, in DIPs from the pad's top left.
type SliderGeom ¶
type SliderGeom struct {
TrackY float32
// contains filtered or unexported fields
}
SliderGeom maps values to x positions across a slider's box; grid holds the step points.
func SliderSetup ¶
func SliderSetup(min, max, step float64, marks []SliderMark, showValue bool, c *ui.Context) (SliderGeom, float32)
type SliderMark ¶
SliderMark is a tick on a slider's track, with an optional caption.
type SliderOptions ¶
type SliderOptions struct {
Min, Max float64
// Step snaps the value to Min plus multiples of it; zero is continuous.
Step float64
Marks []SliderMark
// ShowValue shows the value above the thumb while hovered, dragged or focused.
ShowValue bool
// Format writes the value; nil prints as many decimals as Min and Step need.
Format func(float64) string
Disabled bool
// Label names the slider for assistive technology.
Label string
}
SliderOptions configure a Slider. Min and Max both zero mean 0 to 100.
type SwitchOptions ¶
type SwitchOptions struct {
Disabled bool
// Loading shows a pending result: the switch keeps its place and takes no input.
Loading bool
// Description is read out after the label.
Description string
}
SwitchOptions configure a Switch.
type TagsInputOptions ¶
type TagsInputOptions struct {
// Max caps the number of tags; zero allows any number.
Max int
// Separators split typed and pasted text into tags; empty uses ",;,;" and line breaks.
Separators string
// Validate checks a tag before it is added and returns an error message, or "".
Validate func(tag string) string
Placeholder string
// Label names the input when it is not inside a FormField.
Label string
Disabled bool
// Invalid draws the border in the danger color.
Invalid bool
// Query optionally holds the current editor text.
Query *string
}
TagsInputOptions configure a TagsInput.
type TagsInputParts ¶
type TagsInputParts struct {
Element ui.Element
// Input takes the focus.
Input ui.Element
// contains filtered or unexported fields
}
TagsInputParts are the parts of a TagsInput.
func NewTagsInputParts ¶
func NewTagsInputParts(e, input ui.Element, changed bool) TagsInputParts
NewTagsInputParts reports a tag field built from parts in another component.
func TagsInput ¶
func TagsInput(c *ui.Context, tags *[]string, opts TagsInputOptions) TagsInputParts
TagsInput edits a list of unique tags shown as chips before a text input.
Example ¶
package main
import (
"github.com/egoist/mygo/ui"
"github.com/ELY-Open-Source/MujicaUI/core"
"github.com/ELY-Open-Source/MujicaUI/input"
)
func main() {
tags := []string{"gothic"}
view := func(c *ui.Context) {
core.Use(c, core.Settings{})
input.TagsInput(c, &tags, input.TagsInputOptions{Max: 5, Placeholder: "Add a tag", Label: "Tags"})
}
ui.Render(view, 400, 300, 1)
}
Output:
func (TagsInputParts) Changed ¶
func (p TagsInputParts) Changed() bool
Changed reports whether tags were added or removed this frame.
type TextAreaOptions ¶
type TextAreaOptions struct {
Placeholder string
// Label names the field for assistive technology.
Label string
// MinHeight is the least height in DIPs; zero fits three lines.
MinHeight float32
// MaxHeight caps the height in DIPs, then the text scrolls; zero grows freely.
MaxHeight float32
// MaxLength shows a character count against it; zero hides the count.
MaxLength int
// SubmitKey with SubmitMods submits; a zero key means Cmd+Enter.
SubmitKey ui.Key
SubmitMods ui.Modifiers
Disabled bool
ReadOnly bool
// Error marks the value invalid and shows the message below.
Error string
// Keys sees keys before the editor, for PromptComposer's menus.
Keys func(ui.InputEvent) bool
}
TextAreaOptions configure a TextArea.
type TextInputOptions ¶
type TextInputOptions struct {
Placeholder string
// Label names the field for assistive technology.
Label string
// Leading and Trailing build content inside the field's edges.
Leading func()
Trailing func()
// Clearable shows a clear button while there is text; Escape clears too.
Clearable bool
Disabled bool
// ReadOnly keeps the text selectable and copyable but not editable.
ReadOnly bool
// Error marks the value invalid and shows the message below.
Error string
}
TextInputOptions configure a TextInput.
type ToggleGroupOptions ¶
type ToggleGroupOptions struct {
// Multiple lets several items be pressed at once.
Multiple bool
// AllowEmpty lets the user release the last pressed item.
AllowEmpty bool
Vertical bool
Disabled bool
// Label names the group for assistive technology.
Label string
}
ToggleGroupOptions configure a ToggleGroup.
type ToggleItem ¶
type ToggleItem[T comparable] struct { Value T Label string Icon *ui.SVG // Name names an icon-only item for assistive technology. Name string Disabled bool }
ToggleItem is one button of a ToggleGroup.
type ToggleOptions ¶
type ToggleOptions struct {
// Icon goes before the label.
Icon *ui.SVG
Disabled bool
// Label names an icon-only toggle for assistive technology.
Label string
}
ToggleOptions configure a Toggle.
type TransferItem ¶
TransferItem is one entry of a Transfer; ID must be unique and stable.
type TransferOptions ¶
type TransferOptions struct {
// SourceTitle and TargetTitle replace the built-in "Available" and "Chosen".
SourceTitle, TargetTitle string
// Height of each list in DIPs; 240 when zero.
Height float32
Disabled bool
}
TransferOptions configure a Transfer.
type TreeSelectNode ¶
type TreeSelectNode struct {
ID, Label string
Children []TreeSelectNode
Disabled bool
}
TreeSelectNode is one node of a TreeSelect. IDs must be unique in the tree.
type TreeSelectOptions ¶
type TreeSelectOptions struct {
Multiple bool
Rule TreeSelectRule
// Placeholder shows while nothing is chosen; empty uses "Select…".
Placeholder string
// MaxTags is how many chosen nodes show as tags before "+N"; zero is 3.
MaxTags int
Disabled bool
// Label names the field for assistive technology.
Label string
}
TreeSelectOptions configure a TreeSelect.
type TreeSelectRule ¶
type TreeSelectRule int
TreeSelectRule says how checking a parent affects its children in multiple mode.
const ( // TreeSelectCascade checks a parent's enabled leaves with it; the value holds leaf IDs. TreeSelectCascade TreeSelectRule = iota // TreeSelectIndependent checks each node on its own; the value holds any IDs. TreeSelectIndependent )
type VerticalSliderOptions ¶
type VerticalSliderOptions struct {
Min, Max float64
// Step snaps the value; zero is continuous.
Step float64
Marks []SliderMark
// Height is the track length; zero is 160.
Height float32
// ShowValue shows the value beside the thumb while hovered, dragged or focused.
ShowValue bool
Format func(float64) string
Disabled bool
Label string
}
VerticalSliderOptions configure a VerticalSlider. Min and Max both zero mean 0 to 100.
Source Files
¶
- banner.go
- bulk_action_bar.go
- button.go
- button_group.go
- cascader.go
- checkbox.go
- choice_chips.go
- color_palette.go
- color_picker.go
- combobox.go
- copy_button.go
- currency_input.go
- doc.go
- dock_panel.go
- file_drop_zone.go
- file_picker.go
- form.go
- form_field.go
- hold_to_confirm.go
- icon_button.go
- input_group.go
- knob.go
- masked_input.go
- masonry.go
- mention_input.go
- mention_input_model.go
- multi_select.go
- number_input.go
- password_input.go
- pin_input.go
- qr_code.go
- qr_code_encoder.go
- qr_code_grid.go
- radio_group.go
- range_slider.go
- rating.go
- resizable_panel_group.go
- scrub_input.go
- search_input.go
- select.go
- signature_pad.go
- slider.go
- switch.go
- tags_input.go
- text_area.go
- text_input.go
- toggle.go
- toggle_group.go
- transfer.go
- tree_select.go
- vertical_slider.go