base

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 23, 2026 License: Apache-2.0 Imports: 19 Imported by: 4 modules, 4 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package base holds NSGo's built-in unstyled components: controls, disclosure, progress, popups, menus, dialogs, sheets, navigation, safe areas, resizable panels, a dock and the keyboard. They own behavior and accessibility and take every visual choice from the app.

Index

Constants

View Source
const (
	PanelMinSize core.Points = 100
	PanelMaxSize core.Points = math.MaxFloat32
)

PanelMinSize is the smallest a resizable panel gets by default, and PanelMaxSize what it is unbounded at.

View Source
const HoverNever time.Duration = math.MaxInt64

HoverNever is a HoverCard's delay that never ends: it opens or closes only as the app or a press says.

Variables

This section is empty.

Functions

func Checkerboard

func Checkerboard(color core.Color, size core.Points) core.Node

Checkerboard draws squares of size in color over its parent, under a color with alpha, none while color is 0.

func DatesBetween

func DatesBetween(from, to time.Time) func(time.Time) bool

DatesBetween is a DisabledMatcher of the days from from to to, either zero for no limit.

func DatesOutside

func DatesOutside(before, after time.Time) func(time.Time) bool

DatesOutside is a DisabledMatcher of the days before before and after after, either zero for no limit.

func DaysOfWeek

func DaysOfWeek(days ...int) func(time.Time) bool

DaysOfWeek is a calendar's DisabledMatcher of those days, Sunday 0.

func ISODate

func ISODate(t time.Time) string

ISODate is t as an ISO date, "2026-10-28".

func NewDate

func NewDate(y int, m time.Month, d int, t TimeOfDay) time.Time

NewDate is the day y-m-d at t, in UTC as date values are.

func OnSheet

func OnSheet(cx *core.Scope) bool

OnSheet reports whether cx renders inside a menu, or a Select's, a Combobox's or a DatePicker's dropdown, presented as a sheet, for a styled form's look: a sheet's rows are taller, for instance.

func ParseISODate

func ParseISODate(text string) (time.Time, bool)

ParseISODate reads an ISO date.

func SetScrollbarTheme

func SetScrollbarTheme(cx *core.Scope, theme *ScrollbarTheme)

SetScrollbarTheme draws the bar of every scroll view, list and multiline input that shows its indicator with a Scrollbar of theme; nil gives them the platform's back. A view with a Bar of its own keeps it.

func ShowAlertDialog

func ShowAlertDialog(cx *core.Scope, d AlertDialog, done func(label string))

ShowAlertDialog shows d and calls done with the label of the action chosen, or "" when it was dismissed without one.

Types

type Accordion

type Accordion struct {
	Value func() []string
	// Multiple leaves the others open as one opens.
	Multiple func() bool
	// Disabled disables every item.
	Disabled func() bool
	// OnChange receives the open values as they would be.
	OnChange  func(value []string)
	Class     string
	Style     core.Style
	StyleFunc func() core.Style
	Children  []core.Node
	Label     string
	TestID    string
	// OnLayout and Tooltip are its view's, as a core.View's.
	OnLayout func(core.Bounds)
	Tooltip  core.Node
}

Accordion is stacked sections that each expand and collapse under a header, one at a time or, with Multiple, several. Value holds the open AccordionItems' values: a trigger's press reports the next ones with OnChange. It has no look, and assistive technology hears a group. Each trigger is a Tab stop of its own, as gpui-base's are.

func (Accordion) Render

func (a Accordion) Render(cx *core.Scope) core.Node

Render implements core.Node.

type AccordionHeader

type AccordionHeader struct {
	// Level is its level among the page's headings, 3 when 0.
	Level     int
	Class     string
	Style     core.Style
	StyleFunc func() core.Style
	Children  []core.Node
	TestID    string
	// OnLayout and Tooltip are its view's, as a core.View's.
	OnLayout func(core.Bounds)
	Tooltip  core.Node
}

AccordionHeader is the heading of an AccordionItem around its AccordionTrigger, which assistive technology moves between by level.

func (AccordionHeader) Render

func (h AccordionHeader) Render(*core.Scope) core.Node

Render implements core.Node.

type AccordionItem

type AccordionItem struct {
	// Value identifies it in the accordion's: the app's, never its title.
	Value string
	// Disabled stops its trigger; it stays as the accordion's Value says.
	Disabled  func() bool
	Class     string
	Style     core.Style
	StyleFunc func() core.Style
	Children  []core.Node
	TestID    string
	// OnLayout and Tooltip are its view's, as a core.View's.
	OnLayout func(core.Bounds)
	Tooltip  core.Node
}

AccordionItem is one section of an Accordion: an AccordionHeader with its AccordionTrigger and an AccordionPanel, open while the accordion's Value holds its Value. It has no look or role of its own.

func (AccordionItem) Render

func (i AccordionItem) Render(cx *core.Scope) core.Node

Render implements core.Node.

type AccordionPanel

type AccordionPanel struct {
	// Reveal opens and closes it as a Collapsible's Reveal does. The panel
	// is in the layout while closed, zero high, so its padding and borders
	// belong on a view of its content.
	Reveal func() bool
	// KeepMounted keeps the content in the tree while closed, out of
	// sight, of the focus and of assistive technology: a video keeps its
	// place. Without it the content leaves as the panel closes and comes
	// back as it was.
	KeepMounted func() bool
	Class       string
	Style       core.Style
	StyleFunc   func() core.Style
	Children    []core.Node
	Label       string
	TestID      string
	// OnLayout and Tooltip are its view's, as a core.View's.
	OnLayout func(core.Bounds)
	Tooltip  core.Node
}

AccordionPanel is the content of an AccordionItem, shown while it is open: a region for assistive technology, hidden from it while closed.

func (AccordionPanel) Render

func (p AccordionPanel) Render(cx *core.Scope) core.Node

Render implements core.Node.

type AccordionTrigger

type AccordionTrigger struct {
	Class     string
	Style     core.Style
	StyleFunc func() core.Style
	Children  []core.Node
	Label     string
	Hint      string
	TestID    string
	// OnLayout and Tooltip are its view's, as a core.View's.
	OnLayout func(core.Bounds)
	Tooltip  core.Node
}

AccordionTrigger is the button in an AccordionHeader that expands and collapses its item, reporting the accordion's next Value. Style.Expanded styles it while open.

func (AccordionTrigger) Render

func (t AccordionTrigger) Render(cx *core.Scope) core.Node

Render implements core.Node.

type AlertDialog

type AlertDialog struct {
	Title       string
	Description string
	Actions     []core.AlertAction
	// Presentation is an alert in the middle, or a sheet of actions from
	// the bottom (UIAlertController's action sheet, a list dialog on
	// Android, stacked buttons elsewhere).
	Presentation AlertPresentation
	// CloseOnEscape lets Escape and back close it without an action, and
	// CloseOnBackdropPress a press outside; both are off for an alert and
	// on for an action sheet when unset.
	CloseOnEscape, CloseOnBackdropPress core.Toggle
}

AlertDialog is the system's alert or action sheet: a title, a description and its actions, which the platform places and draws by their roles.

type AlertPresentation

type AlertPresentation uint8

AlertPresentation is how an AlertDialog presents itself.

const (
	// AlertPresentAlert is an alert in the middle.
	AlertPresentAlert AlertPresentation = iota
	// AlertPresentActionSheet is a sheet of actions from the bottom.
	AlertPresentActionSheet
)

type Avatar

type Avatar struct {
	// Src is the picture; an empty URI is none.
	Src     core.ImageSource
	SrcFunc func() core.ImageSource
	// Name is what assistive technology says, unless Label does, and the
	// fallback's initials when Fallback is nil.
	Name string
	// Label is what assistive technology says, over Name.
	Label string
	// Decorative hides it from assistive technology, a picture beside the
	// name it shows, as HTML's alt="".
	Decorative bool
	// FallbackDelay is how long the fallback waits while the image loads,
	// so one that loads within it shows without the fallback flashing
	// first; math.Inf(1) is no fallback while it loads. In milliseconds,
	// as TSX's fallbackDelay.
	FallbackDelay float64
	// OnStatusChange hears the image's status change.
	OnStatusChange func(status AvatarStatus)
	Fallback       core.Node
	Class          string
	Style          core.Style
	StyleFunc      func() core.Style
	ImageClass     string
	ImageStyle     core.Style
	// ImageResizeMode is how the image fills the avatar.
	ImageResizeMode core.ResizeMode
	FallbackClass   string
	FallbackStyle   core.Style
	Children        []core.Node
	TestID          string
	// OnLayout and Tooltip are its view's, as a core.View's.
	OnLayout func(core.Bounds)
	Tooltip  core.Node
}

Avatar is a person's picture, or a fallback while it loads, when it fails and when there is none. Its parts are the fallback and the image over it, both as large as the avatar, then its children, what shows over the picture. The image is transparent until it has loaded, then the fallback goes, so loading lays nothing out again. It is one image for assistive technology, labelled with the person's name, and sizes, shapes and colors are the app's.

func (Avatar) Render

func (a Avatar) Render(cx *core.Scope) core.Node

Render implements core.Node.

type AvatarGroup

type AvatarGroup struct {
	// Limit is how many of its avatars show, 3 when 0 and none when
	// negative; the others make no views.
	Limit int
	// Total is how many people it stands for when the app passes only the
	// first; 0 is its children's number.
	Total int
	// Overflow stands for the people not shown; the app writes the count.
	Overflow core.Node
	// OverflowLabel is what assistive technology says of it; without it,
	// its content.
	OverflowLabel string
	OverflowClass string
	OverflowStyle core.Style
	Class         string
	Style         core.Style
	StyleFunc     func() core.Style
	Children      []core.Node
	Label         string
	TestID        string
	// OnLayout and Tooltip are its view's, as a core.View's.
	OnLayout func(core.Bounds)
	Tooltip  core.Node
}

AvatarGroup is a row of avatars that shows the first few and stands for the rest with Overflow, after them while more people are in it. Its overlap, rings and the overflow's shape are the app's, and assistive technology hears a group.

func (AvatarGroup) Render

func (g AvatarGroup) Render(*core.Scope) core.Node

Render implements core.Node.

type AvatarStatus

type AvatarStatus uint8

AvatarStatus is where an Avatar's image is.

const (
	// AvatarIdle has no image.
	AvatarIdle AvatarStatus = iota
	AvatarLoading
	AvatarLoaded
	AvatarError
)

type Axis

type Axis uint8

Axis is the axis resizable panels are laid out and resized along.

const (
	// Horizontal lays panels out side by side, their handles dragged left
	// and right.
	Horizontal Axis = iota
	// Vertical stacks them, their handles dragged up and down.
	Vertical
)

type Button

type Button struct {
	// Invalid is core.View.Invalid, for accessibility and aria-invalid styles.
	Invalid    func() bool
	Ref        *core.Ref
	LabelledBy []*core.Ref
	// OnPress is the button's action. Without it the button still takes presses and is a keyboard stop, as a button with no action yet; for a look inside a view that takes the presses itself, such as a Popover's Trigger, use a plain core.View.
	OnPress     func(core.PressEvent)
	OnLongPress func(core.PressEvent)
	// OnPressDown and OnPressUp follow a press going down on the button
	// and ending, released, moved away or cancelled, for the app's own
	// press feedback.
	OnPressDown func(core.PressEvent)
	OnPressUp   func(core.PressEvent)
	// Disabled stops presses and is reported to assistive technology.
	Disabled func() bool
	// Busy says the button's action is still loading.
	Busy func() bool
	// Selected marks a toggled trigger or the current item: assistive
	// technology says so, and Style.Selected applies.
	Selected func() bool
	// Expanded makes the button expandable, as a disclosure, and expanded
	// while it returns true.
	Expanded func() bool
	// Role is what it is for assistive technology; RoleButton when 0.
	Role core.Role
	// Class is Tailwind CSS classes under Style, as core.View's, as each
	// part's class is under its style.
	Class     string
	Style     core.Style
	StyleFunc func() core.Style
	Label     string
	LabelFunc func() string
	// Hint says what pressing the button does, for assistive technology.
	Hint     string
	HintFunc func() string
	// Tooltip shows above the button once the pointer rests over it on
	// desktops, as core.View's.
	Tooltip core.Node
	TestID  string
	// HitSlop is how far outside the button presses count.
	HitSlop core.Edges
	// NoFocus keeps it out of the Tab stops, for a button of a row the
	// keyboard reaches another way.
	NoFocus bool
	// AutoFocus moves the keyboard focus here once it mounts on desktops, the web, Android and iOS/tvOS, unless NoFocus or Disabled keeps it out of the keyboard stops.
	AutoFocus bool
	// AccessibilityElementsHidden hides it from assistive technology while
	// it returns true, as a leaf's chevron.
	AccessibilityElementsHidden func() bool
	// OnLayout is its view's, as a core.View's.
	OnLayout func(core.Bounds)
	// Desktop holds the props only desktops have, as a core.View's.
	Desktop  core.DesktopViewProps
	Children []core.Node
}

Button is a pressable container with the button role. Its look is the style and children the app gives it, its states included.

func (Button) Render

func (b Button) Render(cx *core.Scope) core.Node

Render implements core.Node.

type Calendar

type Calendar struct {
	// Invalid is core.View.Invalid, for accessibility and aria-invalid styles.
	Invalid      func() bool
	Value        func() DateValue
	DefaultValue DateValue
	// Range picks a start and an end.
	Range bool
	CalendarConfig
	OnChange func(value DateValue)
	Class    string
	Style    core.Style
	TestID   string
	// OnLayout and Tooltip are its view's, as a core.View's.
	OnLayout func(core.Bounds)
	Tooltip  core.Node
}

Calendar is months of days to pick a date or a range from, as React Aria's. Value makes the value controlled, with its own from DefaultValue otherwise; a range reports once both ends are picked. The toggles turn the header into months and years to jump to, and the days are one Tab stop whose arrows, Home, End and Page keys move the cursor, turning the months. It has no look: the app styles each part or draws the items.

func (Calendar) Render

func (c Calendar) Render(cx *core.Scope) core.Node

Render implements core.Node.

type CalendarConfig

type CalendarConfig struct {
	// NumberOfMonths shown side by side, one when 0.
	NumberOfMonths int
	// FirstDayOfWeek starts the weeks: 1 for Monday to 7 for Sunday, as
	// ISO 8601 numbers them, or the user's when 0, the day they set, else
	// their region's (i18n.Regional).
	FirstDayOfWeek int
	// DisabledMatcher says which days take no press, following what it
	// reads.
	DisabledMatcher func(day time.Time) bool
	// YearRange is the years to pick from, the end excluded, 50 years
	// each way from today when zero.
	YearRange [2]int
	// PreviousLabel and NextLabel name the buttons that turn the months.
	PreviousLabel, NextLabel string

	HeaderClass string
	HeaderStyle core.Style
	BodyClass   string
	BodyStyle   core.Style
	MonthClass  string
	MonthStyle  core.Style
	RowClass    string
	RowStyle    core.Style
	ItemClass   string
	ItemStyle   core.Style
	// ItemStyleOf is the style of a kind of item, following what it
	// reads.
	ItemStyleOf func(CalendarItemKind) core.Style
	RenderItem  func(CalendarEntry) core.Node
}

CalendarConfig is what a Calendar and a DatePicker's calendar take.

type CalendarEntry

type CalendarEntry struct {
	Kind CalendarItemKind
	// Value is a day's number, a month's, a year or a weekday, Sunday 0.
	Value int
	// Date is a day's, as an ISO date.
	Date           string
	Year, Month    int
	Today, Outside bool
}

CalendarEntry is what RenderItem draws: what an item is, never its state, which is the item's Selected and Disabled styles and its range-start, range-end, range-middle, today and outside data styles.

type CalendarItemKind

type CalendarItemKind uint8

CalendarItemKind is what an item of a calendar is.

const (
	CalendarDay CalendarItemKind = iota
	CalendarPrevious
	CalendarMonthToggle
	CalendarYearToggle
	CalendarNext
	CalendarWeekday
	CalendarMonth
	CalendarYear
)
type Carousel struct {
	// Index is the slide shown; the app owns it, a change being reported
	// with OnChange. Without it the carousel keeps its own, from
	// DefaultIndex. A swipe's slide shows until the app has answered.
	Index        func() int
	DefaultIndex int
	// Axis is the way the slides follow each other. Read as it is made.
	Axis Axis
	// Looping goes around the ends, seamlessly while the slides span the
	// viewport and one slide more. Read as it is made.
	Looping  bool
	OnChange func(index int)
	// OnDragStart and OnDragEnd follow the user dragging the content.
	OnDragStart, OnDragEnd func()
	// OnFocus and OnBlur follow the focus coming into the carousel, a
	// control or a slide's content, and leaving it.
	OnFocus, OnBlur func()
	Class           string
	Style           core.Style
	StyleFunc       func() core.Style
	Children        []core.Node
	Label           string
	TestID          string
	// OnLayout and Tooltip are its view's, as a core.View's.
	OnLayout func(core.Bounds)
	Tooltip  core.Node
}

Carousel is slides shown one place at a time, moved by swiping, the wheel or the touchpad, the previous and next controls, the pagination and the keyboard. The content is a native scroll view that snaps to the slides' starts, so a swipe follows the finger on the platform's main thread and rests one slide on; the carousel holds which slide shows and has no look. A region for assistive technology, its slides groups, and a Tab stop: while it, a control or a pagination item has the focus the arrows along Axis, swapped right to left, and Home and End move.

func (Carousel) Render

func (a Carousel) Render(cx *core.Scope) core.Node

Render implements core.Node.

type CarouselContent

type CarouselContent struct {
	Class     string
	Style     core.Style
	StyleFunc func() core.Style
	Children  []core.Node
	TestID    string
	// OnLayout is its scroll view's.
	OnLayout func(core.Bounds)
	// OffsetValues follow its offset on the platform's main thread, for
	// slides that scale as they near the middle. A looping carousel's
	// offset runs over its periods.
	OffsetValues core.AnimatedXY
}

CarouselContent is the viewport the slides scroll in: a native scroll view along the carousel's axis with no scroll bar. Its class and style size it and lay the slides out as a track: a gap between them, padding that shows a peek of the slides beside the one in view.

func (CarouselContent) Render

func (a CarouselContent) Render(cx *core.Scope) core.Node

Render implements core.Node.

type CarouselItem

type CarouselItem struct {
	Class     string
	Style     core.Style
	StyleFunc func() core.Style
	Children  []core.Node
	Label     string
	TestID    string
	Tooltip   core.Node
}

CarouselItem is one slide, a child of the CarouselContent: a group for assistive technology. Its class and style size it along the axis; where it is laid out is a snap point. In a carousel that loops it is drawn in the period nearest the viewport's center, a translation of its own that the app's transform must not set.

func (CarouselItem) Render

func (a CarouselItem) Render(cx *core.Scope) core.Node

Render implements core.Node.

type CarouselNext

type CarouselNext CarouselPrevious

CarouselNext is a button that moves to the next slide, in the Carousel, disabled on the last unless it loops.

func (CarouselNext) Render

func (a CarouselNext) Render(cx *core.Scope) core.Node

Render implements core.Node.

type CarouselPagination

type CarouselPagination struct {
	IndicatorClass string
	IndicatorStyle core.Style
	Class          string
	Style          core.Style
	StyleFunc      func() core.Style
	Children       []core.Node
	Label          string
	TestID         string
	OnLayout       func(core.Bounds)
	Tooltip        core.Node
}

CarouselPagination is the pagination of a Carousel: a group of CarouselPaginationItems, one per slide, and an optional indicator that follows the item of the slide shown natively, as Tabs' does.

func (CarouselPagination) Render

func (a CarouselPagination) Render(cx *core.Scope) core.Node

Render implements core.Node.

type CarouselPaginationItem

type CarouselPaginationItem struct {
	Index int
	// HitSlop is how far outside it presses count.
	HitSlop   core.Edges
	Class     string
	Style     core.Style
	StyleFunc func() core.Style
	Children  []core.Node
	Label     string
	TestID    string
	OnLayout  func(core.Bounds)
	Tooltip   core.Node
}

CarouselPaginationItem is a button that moves to its slide, selected while that slide shows.

func (CarouselPaginationItem) Render

func (a CarouselPaginationItem) Render(cx *core.Scope) core.Node

Render implements core.Node.

type CarouselPrevious

type CarouselPrevious struct {
	Class     string
	Style     core.Style
	StyleFunc func() core.Style
	Children  []core.Node
	Label     string
	TestID    string
	OnLayout  func(core.Bounds)
	Tooltip   core.Node
}

CarouselPrevious is a button that moves to the previous slide, in the Carousel, disabled on the first unless it loops.

func (CarouselPrevious) Render

func (a CarouselPrevious) Render(cx *core.Scope) core.Node

Render implements core.Node.

type Checkbox

type Checkbox struct {
	// Ref and LabelledBy are the control view's, as a core.View's.
	Ref        *core.Ref
	LabelledBy []*core.Ref
	// Invalid is core.View.Invalid, for accessibility and aria-invalid styles.
	Invalid func() bool
	Checked func() bool
	// Indeterminate is neither checked nor unchecked, over Checked while
	// it holds; a press then asks for checked.
	Indeterminate func() bool
	Disabled      func() bool
	// OnChange receives the value a press asks for: true from unchecked
	// and indeterminate, false from checked. The checkbox shows what
	// Checked returns.
	OnChange func(checked bool)
	// OnChangeEvent receives the requested value and the originating press, including its modifier keys. When set, it replaces OnChange.
	OnChangeEvent func(checked bool, press core.PressEvent)
	// Role is what it is for assistive technology; RoleCheckbox when 0.
	Role core.Role

	Class              string
	Style              core.Style
	StyleFunc          func() core.Style
	IndicatorClass     string
	IndicatorStyle     core.Style
	IndicatorStyleFunc func() core.Style
	// Indicator is the mark inside the indicator, which the app shows by
	// the value it owns.
	Indicator core.Node
	Children  []core.Node
	Label     string
	LabelFunc func() string
	Hint      string
	HintFunc  func() string
	TestID    string
	// HitSlop is how far outside the checkbox presses count.
	HitSlop core.Edges
	// OnLayout and Tooltip are its view's, as a core.View's.
	OnLayout func(core.Bounds)
	Tooltip  core.Node
}

Checkbox is checked, unchecked or indeterminate: an option, an item of a selection, a "select all". Its parts are the indicator, the box holding the app's Indicator mark, then its children, the label assistive technology reads.

func (Checkbox) Render

func (c Checkbox) Render(*core.Scope) core.Node

Render implements core.Node.

type Collapsible

type Collapsible struct {
	Open func() bool
	// Reveal opens and closes it with a clipped height that springs, in a
	// region that is there while closed too, zero high, so a gap of the
	// collapsible's comes before it, and what follows moves with it. The
	// content comes into the tree first, so the spring takes longer the
	// taller it is, and stays until the region has closed. With reduced
	// motion it comes and goes at once. Read as it is made.
	Reveal    func() bool
	Content   core.Node
	Class     string
	Style     core.Style
	StyleFunc func() core.Style
	Children  []core.Node
	TestID    string
	// OnLayout and Tooltip are its view's, as a core.View's.
	OnLayout func(core.Bounds)
	Tooltip  core.Node
}

Collapsible is a region whose Content expands and collapses: a "show more", a section of settings. Its children show either way, among them the app's trigger that flips Open (a Button with Expanded). Content is made the first time it opens and kept while closed, out of layout and hidden from assistive technology, so what is inside keeps its state.

func (Collapsible) Render

func (c Collapsible) Render(cx *core.Scope) core.Node

Render implements core.Node.

type ColorArea

type ColorArea struct {
	// Invalid is core.View.Invalid, for accessibility and aria-invalid styles.
	Invalid    func() bool
	Disabled   func() bool
	PanelClass string
	PanelStyle core.Style
	// PanelStyleFunc follows what it reads; the panel shows Focused while
	// the keyboard is on the area.
	PanelStyleFunc func() core.Style
	ThumbClass     string
	ThumbStyle     core.Style
	// ThumbStyleFunc follows what it reads; the thumb shows data-dragging
	// while it moves.
	ThumbStyleFunc func() core.Style
	FillThumb      bool
	Class          string
	Style          core.Style
	Label          string
	TestID         string
	// OnLayout and Tooltip are its view's, as a core.View's.
	OnLayout func(core.Bounds)
	Tooltip  core.Node
}

ColorArea picks the saturation and brightness of HSB under a draggable thumb, over the hue's color. It has no size or look of its own: the app styles the panel and the thumb, and FillThumb fills it with the color.

func (ColorArea) Render

func (a ColorArea) Render(cx *core.Scope) core.Node

Render implements core.Node.

type ColorChannel

type ColorChannel uint8

ColorChannel is a channel of a color. A ColorSlider's zero is its space's hue, or its first channel; a ColorField's is the whole color.

const (
	ChannelNone ColorChannel = iota
	ChannelRed
	ChannelGreen
	ChannelBlue
	ChannelHue
	ChannelSaturation
	ChannelLightness
	ChannelBrightness
	ChannelChroma
	ChannelAlpha
)

type ColorChannels

type ColorChannels struct {
	// Number draws each field, as ColorField's.
	Number func(NumberInput) core.Node
	Class  string
	Style  core.Style
	TestID string
}

ColorChannels is a ColorField of each of the three channels of the notation the picker around it spells the color in, which ColorNotationMenu chooses, each with its letter as a scrub handle.

func (ColorChannels) Render

func (c ColorChannels) Render(cx *core.Scope) core.Node

Render implements core.Node.

type ColorChoice

type ColorChoice struct {
	Text string
	// Checked marks the one in use, nil in a menu of actions.
	Checked  func() bool
	OnSelect func()
}

ColorChoice is a row of a color's menu.

type ColorCopyMenu

type ColorCopyMenu struct {
	Draw func(ColorMenuParts) core.Node
}

ColorCopyMenu copies the color in a notation or as hex. Draw draws the menu, a plain one when nil.

func (ColorCopyMenu) Render

func (m ColorCopyMenu) Render(cx *core.Scope) core.Node

Render implements core.Node.

type ColorEyeDropper

type ColorEyeDropper struct {
	// Invalid is core.View.Invalid, for accessibility and aria-invalid styles.
	Invalid   func() bool
	Disabled  func() bool
	OnPick    func(color core.Color)
	Children  []core.Node
	Class     string
	Style     core.Style
	StyleFunc func() core.Style
	Label     string
	TestID    string
	// OnLayout and Tooltip are its view's, as a core.View's.
	OnLayout func(core.Bounds)
	Tooltip  core.Node
}

ColorEyeDropper is a button picking a color on the screen with the system's sampler, for the picker around it and OnPick; disabled where the platform has none (core.Env.CanPickScreenColor).

func (ColorEyeDropper) Render

func (e ColorEyeDropper) Render(cx *core.Scope) core.Node

Render implements core.Node.

type ColorField

type ColorField struct {
	// Invalid is core.View.Invalid, for accessibility and aria-invalid styles.
	Invalid    func() bool
	Channel    ColorChannel
	ColorSpace ColorSpace
	Format     ColorFormat
	// Digits writes the color as six hex digits in capitals, with no # or
	// alpha, and takes six or eight as they are typed; six keep the alpha.
	Digits      bool
	Disabled    func() bool
	Placeholder string
	Class       string
	Style       core.Style
	// Letter is a Channel's scrub handle, a step a point, such as "R".
	Letter string
	// Field draws the input, and Number a Channel's, as a styled form does.
	Field  func(core.Input) core.Node
	Number func(NumberInput) core.Node
	Label  string
	TestID string
}

ColorField is the color as text in any CSS form, read as it is submitted or left, or with Channel that channel in a NumberInput: what is typed shows at once, the keys step it, and the change ends as the field is left. Label says the channel's name when empty.

func (ColorField) Render

func (f ColorField) Render(cx *core.Scope) core.Node

Render implements core.Node.

type ColorFormat

type ColorFormat uint8

ColorFormat is how a picker writes a color as text.

const (
	ColorFormatHex ColorFormat = iota
	ColorFormatRGB
	ColorFormatHSL
	ColorFormatHSB
	ColorFormatOKLCH
)

type ColorMenuParts

type ColorMenuParts struct {
	// Label names the menu; Current is what its trigger says, nil for an
	// action's.
	Label   string
	Current func() string
	Choices []ColorChoice
}

ColorMenuParts are what a color's menu draws.

type ColorNotationMenu

type ColorNotationMenu struct {
	Draw func(ColorMenuParts) core.Node
}

ColorNotationMenu chooses the notation ColorChannels spell the color in, which leaves the color as it is. Draw draws the menu, a plain one when nil.

func (ColorNotationMenu) Render

func (m ColorNotationMenu) Render(cx *core.Scope) core.Node

Render implements core.Node.

type ColorPicker

type ColorPicker struct {
	// Invalid is core.View.Invalid, for accessibility and aria-invalid styles.
	Invalid      func() bool
	Value        func() core.Color
	DefaultValue core.Color
	Format       ColorFormat
	// NoAlpha names the notations without their alpha, for a picker with
	// no opacity part.
	NoAlpha     bool
	Disabled    func() bool
	OnChange    func(value core.Color, formatted string)
	OnChangeEnd func(value core.Color, formatted string)
	Children    []core.Node
	Class       string
	Style       core.Style
	TestID      string
	// OnLayout and Tooltip are its view's, as a core.View's.
	OnLayout func(core.Bounds)
	Tooltip  core.Node
}

ColorPicker holds a color for its parts, ColorArea, ColorSlider, ColorField, ColorChannels, ColorSwatch, ColorEyeDropper, ColorNotationMenu and ColorCopyMenu, which the app lays out inside it. Value makes the color controlled, with its own from DefaultValue otherwise, black when 0. It keeps a color in every space, so a gray keeps its hue. OnChange reports each change and OnChangeEnd its end, with the color written as Format says, which is also the notation ColorChannels start in.

func (ColorPicker) Render

func (p ColorPicker) Render(cx *core.Scope) core.Node

Render implements core.Node.

type ColorSlider

type ColorSlider struct {
	// Invalid is core.View.Invalid, for accessibility and aria-invalid styles.
	Invalid    func() bool
	ColorSpace ColorSpace
	Channel    ColorChannel
	// Horizontal unless Axis says Vertical.
	Axis       Axis
	Disabled   func() bool
	TrackClass string
	TrackStyle core.Style
	ThumbClass string
	ThumbStyle core.Style
	// ThumbStyleFunc follows what it reads; the thumb shows data-dragging
	// while it moves.
	ThumbStyleFunc func() core.Style
	FillThumb      bool
	// CheckerboardColor shows squares CheckerboardSize wide, 4 when 0.
	CheckerboardColor core.Color
	CheckerboardSize  core.Points
	Class             string
	Style             core.Style
	Label             string
	TestID            string
	// OnLayout and Tooltip are its view's, as a core.View's.
	OnLayout func(core.Bounds)
	Tooltip  core.Node
}

ColorSlider picks a channel of the color in any space along a track of what each of its values gives. It has no size or look of its own: the app styles the track and the thumb. An alpha track shows CheckerboardColor squares under it.

func (ColorSlider) Render

func (c ColorSlider) Render(cx *core.Scope) core.Node

Render implements core.Node.

type ColorSpace

type ColorSpace uint8

ColorSpace is a way of writing a color by channels.

const (
	ColorHSB ColorSpace = iota
	ColorRGB
	ColorHSL
	ColorOKLCH
)

type ColorSwatch

type ColorSwatch struct {
	Color func() core.Color
	// CheckerboardColor shows squares CheckerboardSize wide, 4 when 0.
	CheckerboardColor core.Color
	CheckerboardSize  core.Points
	Children          []core.Node
	Class             string
	Style             core.Style
	StyleFunc         func() core.Style
	Label             string
	TestID            string
	// OnLayout and Tooltip are its view's, as a core.View's.
	OnLayout func(core.Bounds)
	Tooltip  core.Node
}

ColorSwatch shows a color: Color, or the picker's around it without one.

func (ColorSwatch) Render

func (s ColorSwatch) Render(cx *core.Scope) core.Node

Render implements core.Node.

type Combobox

type Combobox struct {
	// Invalid is core.View.Invalid, for accessibility and aria-invalid styles.
	Invalid      func() bool
	Items        func() []SelectItem
	Multiple     bool
	Value        func() []string
	DefaultValue []string
	Open         func() bool
	DefaultOpen  bool
	Disabled     func() bool
	// Query makes the typed text the app's, nil for the field's own, which
	// each opening starts at DefaultQuery.
	Query        func() *string
	DefaultQuery string
	Placeholder  string
	// Cleanable shows a button while a value is chosen, which clears it.
	Cleanable bool

	// Presentation is a popup under the box, or a sheet.
	Presentation Presentation
	Placement    core.Placement
	// Align lines the list up with its box, at its start when 0.
	Align          core.Align
	Offset, Margin core.Points

	// Class and Style are the box's, around the input and its buttons.
	Class      string
	Style      core.Style
	StyleFunc  func() core.Style
	InputClass string
	InputStyle core.Style
	// Field draws the input, as a styled form does.
	Field          func(core.Input) core.Node
	PopupClass     string
	PopupStyle     core.Style
	PopupStyleFunc func() core.Style
	BackdropClass  string
	BackdropStyle  core.Style
	ListClass      string
	ListStyle      core.Style
	ItemClass      string
	ItemStyle      core.Style
	// ItemStyleFunc is each row's style following what it reads.
	ItemStyleFunc  func() core.Style
	GroupClass     string
	GroupStyle     core.Style
	GroupStyleFunc func() core.Style
	FooterClass    string
	FooterStyle    core.Style

	ClearButtonClass string
	ClearButtonStyle core.Style
	ClearButton      core.Node
	ClearButtonLabel string

	// Prefix and Suffix go before the input and after its buttons.
	Prefix, Suffix core.Node
	// TriggerButton opens and closes the list, hidden from screen readers.
	TriggerButton      core.Node
	TriggerButtonClass string
	TriggerButtonStyle core.Style
	Empty, Footer      core.Node
	RenderItem         func(SelectEntry) core.Node
	RenderGroup        func(SelectGroup) core.Node

	OnChange      func(value []string)
	OnConfirm     func(value []string)
	OnQueryChange func(query string)
	OnOpenChange  func(open bool, reason Reason)
	OnOpen        func()
	OnClose       func()
	OnCancel      func()
	Label         string
	TestID        string
	// OnLayout and Tooltip are its view's, as a core.View's.
	OnLayout func(core.Bounds)
	Tooltip  core.Node
}

Combobox is a text input over the same list as Select's: typing opens the list and filters it, and a press chooses. It holds one value that a choice replaces, closing the list, or with Multiple several that a choice toggles, leaving it open. OnConfirm reports the value on every close; Mod+Return closes it as it is. It has no look.

func (Combobox) Render

func (c Combobox) Render(cx *core.Scope) core.Node

Render implements core.Node.

type Command

type Command struct {
	Items func() []CommandItem
	// Query makes the query the app's, nil for the field's own, from
	// DefaultQuery.
	Query        func() *string
	DefaultQuery string
	// NoSearch shows no field, and every item.
	NoSearch bool
	// NoFilter leaves the items to the app, as a search it answers itself.
	NoFilter bool
	// Filter replaces FilterCommands for a search of the items at hand: it
	// gets them and the query, and must not change them.
	Filter      func(items []CommandItem, query string) []CommandItem
	Placeholder string
	AutoFocus   bool
	// ExpandOnSearch shows no rows, nor Empty, Pending or the error, until
	// the query holds more than spaces, and ExpandedClass and ExpandedStyle
	// join the command's from then on, for a height the rows fill.
	ExpandOnSearch bool
	ExpandedClass  string
	ExpandedStyle  core.Style
	// Loading says a search is under way: the list is busy and Empty waits.
	Loading func() bool
	// Pending takes the rows' place while Loading, and nothing can be
	// chosen. Without it the rows stay as they were.
	Pending core.Node
	// Error says why there are no rows, empty while there is nothing to
	// say: they go and nothing can be chosen, and RenderError draws it.
	Error       func() string
	RenderError func(message string) core.Node
	// InputSource and KeepInputSource are the search field's, as
	// core.Input's: "com.apple.keylayout.ABC" selects Latin commands on
	// macOS each time the field takes the focus.
	InputSource     string
	KeepInputSource bool
	// NoSeparator leaves the separators between sections out.
	NoSeparator bool
	// SearchLabel names the field for assistive technology, over Label.
	SearchLabel string
	Ref         *CommandRef

	Class          string
	Style          core.Style
	StyleFunc      func() core.Style
	SearchBarClass string
	SearchBarStyle core.Style
	// SearchBarStyleFunc is the bar's style following what it reads.
	SearchBarStyleFunc func() core.Style
	SearchClass        string
	SearchStyle        core.Style
	// SearchField draws the search field, as a styled form does.
	SearchField func(core.Input) core.Node
	ListClass   string
	ListStyle   core.Style
	ItemClass   string
	ItemStyle   core.Style
	// ItemStyleFunc is each row's style following what it reads, and so
	// are GroupStyleFunc and SeparatorStyleFunc.
	ItemStyleFunc      func() core.Style
	GroupClass         string
	GroupStyle         core.Style
	GroupStyleFunc     func() core.Style
	SeparatorClass     string
	SeparatorStyle     core.Style
	SeparatorStyleFunc func() core.Style

	Header, Footer, Empty      core.Node
	SearchPrefix, SearchSuffix core.Node
	RenderItem                 func(CommandEntry) core.Node
	RenderGroup                func(CommandGroup) core.Node

	OnSelect          func(id string)
	OnHighlightChange func(highlighted *string)
	OnQueryChange     func(query string)
	OnCancel          func()
	Label             string
	TestID            string
	// OnLayout and Tooltip are its view's, as a core.View's.
	OnLayout func(core.Bounds)
	Tooltip  core.Node
}

Command is a command palette: a search field over the app's commands matched natively by FilterCommands, or the app's Filter, in a virtualized list under their sections' headers, a section showing where its best match ranks. The first enabled match is highlighted while the field keeps the keyboard focus, so Up, Down, Page Up and Down move it, Return chooses and Escape clears the query, then reports OnCancel. Without a search field, Home, End, Space and letters by typeahead work too. The rows' Focused and Checked styles are the app's: it has no look.

func (Command) Render

func (c Command) Render(cx *core.Scope) core.Node

Render implements core.Node.

type CommandEntry

type CommandEntry struct {
	ID, Label         string
	Description       string
	Keywords          []string
	Group             string
	Shortcut          string
	ShortcutLabel     string
	Icon              *core.SVG
	Leading, Trailing core.Node
	Disabled, Checked bool
}

CommandEntry is what RenderItem draws: what the item is, with its shortcut as this platform shows it.

type CommandGroup

type CommandGroup struct{ Heading string }

CommandGroup is what RenderGroup draws.

type CommandItem

type CommandItem struct {
	ID, Label string
	// Description says more of it, for the app's row to draw. Queries do
	// not match it.
	Description string
	// Keywords are found as its Label is, without showing.
	Keywords []string
	// Group is the section it is in: the items of one group show together
	// under one header, wherever they are among the items.
	Group string
	// Shortcut shows as what it is pressed with: "mod+n". The app binds it.
	Shortcut string
	// Icon is the glyph for the app's row to draw, and Leading content to
	// draw in its place. Trailing is content for the row's end. Queries
	// match none of them.
	Icon              *core.SVG
	Leading, Trailing core.Node
	Disabled, Checked bool
}

CommandItem is a command of a Command.

func FilterCommands

func FilterCommands(items []CommandItem, query string) []CommandItem

FilterCommands is the items the query's words all match, ignoring case, without changing items: exact labels first, then labels they start, labels holding them and last keywords holding them, ties in the items' order. No words match every item.

type CommandRef

type CommandRef struct {
	// contains filtered or unexported fields
}

CommandRef is a Command's ref.

func (*CommandRef) Focus

func (r *CommandRef) Focus()

Focus puts the keyboard on the search field, or the command without one.

func (*CommandRef) Highlight

func (r *CommandRef) Highlight(id string) bool

Highlight highlights the item of id, reporting whether it is shown and enabled.

func (*CommandRef) MatchedCount

func (r *CommandRef) MatchedCount() int

MatchedCount is how many items show.

type ContextMenu

type ContextMenu struct {
	Open         func() bool
	OnOpenChange func(open bool, reason Reason)
	OnOpen       func()
	OnClose      func()
	OnCancel     func()
	// OnPosition reports where the popup went, as Popover's.
	OnPosition func(core.OverlayPosition)
	Disabled   bool
	// Presentation is a popup at the pointer, or a sheet.
	Presentation Presentation

	// Offset and Margin place the popup beside the pointer.
	Offset, Margin core.Points
	Class          string // the content's
	Style          core.Style
	StyleFunc      func() core.Style
	PopupClass     string
	PopupStyle     core.Style
	PopupStyleFunc func() core.Style
	// StartingStyle and EndingStyle are Menu's.
	StartingClass     string
	StartingStyle     core.Style
	EndingClass       string
	EndingStyle       core.Style
	BackdropClass     string
	BackdropStyle     core.Style
	BackdropStyleFunc func() core.Style
	Trigger           core.Node
	Children          []core.Node
	TestID            string
	// OnLayout and Tooltip are its view's, as a core.View's.
	OnLayout func(core.Bounds)
	Tooltip  core.Node
}

ContextMenu opens a menu of MenuItems about its trigger, at the pointer or as a sheet as Presentation says: a secondary click opens it, and on touch screens a finger resting 400 ms on the trigger, while the trigger's own presses and the scroll views around it go on.

func (ContextMenu) Render

func (m ContextMenu) Render(cx *core.Scope) core.Node

Render implements core.Node.

type DatePicker

type DatePicker struct {
	// Invalid is core.View.Invalid, for accessibility and aria-invalid styles.
	Invalid      func() bool
	Value        func() DateValue
	DefaultValue DateValue
	Range        bool
	Open         func() bool
	DefaultOpen  bool
	Disabled     func() bool
	// DateFormat is strftime's, for what assistive technology hears.
	DateFormat    string
	TimePrecision TimePrecision
	HourCycle     HourCycle
	DefaultTime   TimeOfDay
	Cleanable     bool
	Presets       []DatePreset
	CalendarConfig

	// Presentation is a popup at the trigger, or a sheet.
	Presentation Presentation
	Placement    core.Placement
	// Align lines the popup up with its trigger, at its start when 0.
	Align          core.Align
	Offset, Margin core.Points

	Class     string // the trigger's
	Style     core.Style
	StyleFunc func() core.Style
	// RootClass and RootStyle are the view around the trigger and its
	// clear button.
	RootClass      string
	RootStyle      core.Style
	PopupClass     string
	PopupStyle     core.Style
	PopupStyleFunc func() core.Style
	BackdropClass  string
	BackdropStyle  core.Style
	ContentClass   string
	ContentStyle   core.Style
	PresetsClass   string
	PresetsStyle   core.Style
	PresetClass    string
	PresetStyle    core.Style
	// PresetStyleFunc is each preset's style following what it reads.
	PresetStyleFunc func() core.Style
	CalendarClass   string
	CalendarStyle   core.Style
	TimeClass       string
	TimeStyle       core.Style
	TimeLabel       core.Node
	TimeFieldClass  string
	TimeFieldStyle  core.Style
	// TimeFieldStyleFunc is the time field's style following what it
	// reads, and SegmentStyleFunc each segment's.
	TimeFieldStyleFunc func() core.Style
	SegmentStyleFunc   func() core.Style
	TimeFieldLabel     string
	SegmentClass       string
	SegmentStyle       core.Style
	SeparatorClass     string
	SeparatorStyle     core.Style
	RenderSegment      func(TimeFieldSegmentEntry) core.Node
	ClearButtonClass   string
	ClearButtonStyle   core.Style
	ClearButton        core.Node
	ClearButtonLabel   string
	Trigger            core.Node

	OnChange     func(value DateValue)
	OnOpenChange func(open bool, reason Reason)
	OnOpen       func()
	OnClose      func()
	OnCancel     func()
	Label        string
	TestID       string
	// OnLayout and Tooltip are its view's, as a core.View's.
	OnLayout func(core.Bounds)
	Tooltip  core.Node
}

DatePicker is a date, a range, or with TimePrecision a date and time picked in a popup at its trigger, or a sheet as Presentation says. A complete date is the value and closes it. With a time the popup stays on desktops, each edit reported, until the selected day is pressed again; a tap on a touch screen picks the day at its time and closes. Return opens and closes it from the focused trigger, Delete and Backspace clear.

func (DatePicker) Render

func (d DatePicker) Render(cx *core.Scope) core.Node

Render implements core.Node.

type DatePreset

type DatePreset struct {
	Label string
	Value DateValue
}

DatePreset is a labelled value a DatePicker offers beside its calendar.

type DateValue

type DateValue struct {
	Range      bool
	Start, End time.Time
}

DateValue is a calendar's or a date picker's value: one date, or with Range a start and an end. A zero time is unset. A calendar holds days at midnight UTC, and a date picker's also hold their time of day.

func (DateValue) Complete

func (d DateValue) Complete() bool

Complete reports whether it is a date, or a range with both ends.

func (DateValue) Format

func (d DateValue) Format(format string) string

Format is the value as format says, strftime's, a range's ends joined by " - "; empty until it is complete.

func (DateValue) IsSet

func (d DateValue) IsSet() bool

IsSet reports whether it holds a date, a range's start.

type Dialog

type Dialog struct {
	Open         func() bool
	DefaultOpen  bool
	OnOpenChange func(open bool, reason Reason)
	OnOpen       func()
	OnClose      func()
	OnCancel     func()
	// OnConfirm, when set, is the default action: Return runs it while the dialog is the topmost modal, then asks to close with ReasonSelect, once however often Return is pressed as it goes. A focused button, menu row or text input inside keeps Return for itself (core.KeyAuto). Without it Return does what it did.
	OnConfirm func()

	Animation core.ModalAnimation
	// TransitionShader, when set, is how the dialog comes and goes
	// instead of Animation, where the platform draws it.
	TransitionShader       *core.TransitionShader
	NoCloseOnEscape        bool
	NoCloseOnBackdropPress bool
	// Presentation and NoCloseOnSwipe are iOS's, IOS and Android hold the
	// props only one of them has, and StatusBar is set over the app's
	// while the dialog is open, as core.Modal's are.
	Presentation   core.ModalPresentation
	NoCloseOnSwipe bool
	IOS            core.IOSModalProps
	Android        core.AndroidModalProps
	StatusBar      core.StatusBarSetting
	StatusBarFunc  func() core.StatusBarSetting
	// BackdropClass, BackdropStyle or BackdropStyleFunc, when set, draws a
	// backdrop whose press asks to close; BackdropTestID names it.
	BackdropClass     string
	BackdropStyle     core.Style
	BackdropStyleFunc func() core.Style
	BackdropTestID    string
	PopupClass        string
	PopupStyle        core.Style
	PopupStyleFunc    func() core.Style
	// StartingStyle styles the popup in its first frame and EndingStyle as
	// it goes (popupMotion), as Popover's, so a Transition in its style
	// comes in and goes in the tree, with the modal held until it went;
	// BackdropStartingStyle and BackdropEndingStyle style the backdrop in
	// those phases. Without them Animation is the platform's entrance.
	StartingClass         string
	StartingStyle         core.Style
	EndingClass           string
	EndingStyle           core.Style
	BackdropStartingClass string
	BackdropStartingStyle core.Style
	BackdropEndingClass   string
	BackdropEndingStyle   core.Style
	// Before and After are laid out in the layer around the popup, such
	// as spacers that place it off center.
	Before, After []core.Node
	// LayerClass and LayerStyle style the layer that holds the backdrop
	// and the popup, over its default, which centers the popup.
	LayerClass string
	LayerStyle core.Style
	Children   []core.Node
	// Label names the dialog for screen readers, which announce it with
	// its role as it opens, a dialog or with Role an alert dialog, and
	// AccessibilityDescription after it, as a confirmation's message.
	Label                        string
	LabelFunc                    func() string
	Role                         core.Role
	AccessibilityDescription     string
	AccessibilityDescriptionFunc func() string
	TestID                       string
}

Dialog is a modal layer over the app: an optional backdrop and a popup centered on it.

func (Dialog) Render

func (d Dialog) Render(cx *core.Scope) core.Node

Render implements core.Node.

type Emoji

type Emoji struct {
	// Emoji is the Unicode sequence for this emoji, with any active skin tone
	// applied.
	Emoji string
	// Name is the emoji's localized CLDR short name in the active language.
	Name string
	// Keywords are the emoji's localized search keywords.
	Keywords []string
	// Category is the emoji's Unicode category.
	Category EmojiCategory
	// HasSkinTones reports whether skin tone variants exist for this emoji.
	HasSkinTones bool
	// Skins holds the supported skin tone variants, including mixed tones for
	// emoji with more than one person, when HasSkinTones is true.
	Skins []string
}

Emoji is one entry of the Unicode emoji catalog.

func EmojiByString

func EmojiByString(s string, languages ...string) (Emoji, bool)

EmojiByString looks up an emoji (base or skin-toned) by its Unicode string and returns its localized metadata.

func EmojisInCategory

func EmojisInCategory(category EmojiCategory, languages ...string) []Emoji

EmojisInCategory returns every emoji in category with its name and keywords localized in the first supported language of languages (defaulting to English).

func SearchEmojis

func SearchEmojis(query string, languages ...string) []Emoji

SearchEmojis searches every Unicode emoji by its names, keywords and shortcodes across languages (BCP 47 tags such as "zh-Hans", "ja", "de", falling back to English). An empty query returns every emoji in Unicode order.

func (Emoji) WithSkinTone

func (e Emoji) WithSkinTone(tone EmojiSkinTone) Emoji

WithSkinTone returns a copy of e with tone applied when e supports skin tones.

type EmojiCategory

type EmojiCategory uint8

EmojiCategory is a Unicode emoji group, or EmojiRecent for recently used emoji when EmojiPicker.Recent supplies some.

const (
	EmojiSmileys EmojiCategory = iota
	EmojiPeople
	EmojiAnimals
	EmojiFood
	EmojiTravel
	EmojiActivities
	EmojiObjects
	EmojiSymbols
	EmojiFlags
	// EmojiRecent is the virtual category shown before the Unicode groups when
	// EmojiPicker.Recent is non-empty.
	EmojiRecent
)

func EmojiCategories

func EmojiCategories() []EmojiCategory

EmojiCategories returns the nine standard Unicode emoji categories in order.

func (EmojiCategory) IconEmoji

func (c EmojiCategory) IconEmoji() string

IconEmoji returns a representative emoji for the category.

func (EmojiCategory) Label

func (c EmojiCategory) Label(cx *core.Scope) string

Label returns the category's localized name in the language the app shows under cx (base/locales).

type EmojiPicker

type EmojiPicker struct {
	// Query makes the search query controlled, nil for internal state seeded
	// from DefaultQuery.
	Query         func() *string
	DefaultQuery  string
	OnQueryChange func(query string)
	// NoSearch hides the search field.
	NoSearch bool
	// Placeholder and SearchLabel override base/locales defaults for the
	// search field.
	Placeholder     string
	PlaceholderFunc func() string
	SearchLabel     string
	SearchLabelFunc func() string
	AutoFocus       bool
	InputSource     string
	KeepInputSource bool

	// Category makes the active category controlled, nil for internal state
	// seeded from DefaultCategory.
	Category         func() EmojiCategory
	DefaultCategory  EmojiCategory
	OnCategoryChange func(EmojiCategory)
	// Categories restricts and orders the Unicode categories shown; nil shows
	// all nine standard categories (plus EmojiRecent first when Recent is
	// non-empty).
	Categories []EmojiCategory
	// NoCategories hides the category tab bar.
	NoCategories bool

	// SkinTone makes the active skin tone controlled, nil for internal state
	// seeded from DefaultSkinTone.
	SkinTone         func() EmojiSkinTone
	DefaultSkinTone  EmojiSkinTone
	OnSkinToneChange func(EmojiSkinTone)
	// NoSkinTone hides the skin tone selector bar.
	NoSkinTone bool

	// Recent supplies recently used emoji strings (e.g. "🔥", "👍"). When
	// non-empty and no search query is active, they appear first under
	// EmojiRecent.
	Recent func() []string

	// Languages explicitly chooses the BCP 47 languages searched for emoji
	// names and keywords (with English fallback). When empty, the picker
	// follows the app's language (i18n.Language) and locale (Env.Locale).
	Languages     []string
	LanguagesFunc func() []string

	// Columns is how many emoji sit in each virtualized grid row; 8 when <= 0.
	Columns int

	Disabled          func() bool
	Invalid           func() bool
	OnSelect          func(Emoji)
	OnHighlightChange func(*Emoji)
	// OnCancel runs on Escape when the search query is empty.
	OnCancel func()
	Ref      *EmojiPickerRef

	Class              string
	Style              core.Style
	StyleFunc          func() core.Style
	SearchBarClass     string
	SearchBarStyle     core.Style
	SearchBarStyleFunc func() core.Style
	SearchClass        string
	SearchStyle        core.Style
	SearchStyleFunc    func() core.Style
	// SearchField wraps or styles the search core.Input.
	SearchField          func(core.Input) core.Node
	CategoriesClass      string
	CategoriesStyle      core.Style
	CategoriesStyleFunc  func() core.Style
	CategoryClass        string
	CategoryStyle        core.Style
	CategoryStyleFunc    func() core.Style
	ListClass            string
	ListStyle            core.Style
	ListStyleFunc        func() core.Style
	SectionClass         string
	SectionStyle         core.Style
	SectionStyleFunc     func() core.Style
	RowClass             string
	RowStyle             core.Style
	RowStyleFunc         func() core.Style
	ItemClass            string
	ItemStyle            core.Style
	ItemStyleFunc        func() core.Style
	EmptyClass           string
	EmptyStyle           core.Style
	EmptyStyleFunc       func() core.Style
	SkinToneBarClass     string
	SkinToneBarStyle     core.Style
	SkinToneBarStyleFunc func() core.Style
	SkinToneClass        string
	SkinToneStyle        core.Style
	SkinToneStyleFunc    func() core.Style
	PreviewClass         string
	PreviewStyle         core.Style
	PreviewStyleFunc     func() core.Style
	FooterBarClass       string
	FooterBarStyle       core.Style
	FooterBarStyleFunc   func() core.Style

	Header, Footer, Empty      core.Node
	SearchPrefix, SearchSuffix core.Node
	RenderItem                 func(Emoji) core.Node
	RenderSection              func(category EmojiCategory, label string) core.Node
	RenderCategory             func(category EmojiCategory, label string) core.Node
	RenderSkinTone             func(tone EmojiSkinTone, label string) core.Node
	RenderPreview              func(emoji *Emoji) core.Node

	Label     string
	LabelFunc func() string
	TestID    string
	// OnLayout and Tooltip are its root view's, as a core.View's.
	OnLayout func(core.Bounds)
	Tooltip  core.Node
}

EmojiPicker is an unstyled emoji picker: a search field matching every Unicode emoji by its localized CLDR names, keywords and shortcodes in the app's languages, a category tab bar, a virtualized grid of emoji rows, and optional skin tone and preview parts. All default UI words and category labels come from base/locales. Emoji data is loaded lazily on first render so apps that never use EmojiPicker link none of it.

func (EmojiPicker) Render

func (p EmojiPicker) Render(cx *core.Scope) core.Node

Render implements core.Node.

type EmojiPickerRef

type EmojiPickerRef struct {
	// contains filtered or unexported fields
}

EmojiPickerRef is an EmojiPicker's imperative handle.

func (*EmojiPickerRef) Focus

func (r *EmojiPickerRef) Focus()

Focus moves keyboard focus to the search field, or the picker root when NoSearch is set.

func (*EmojiPickerRef) MatchedCount

func (r *EmojiPickerRef) MatchedCount() int

MatchedCount reports how many emoji are currently shown.

func (*EmojiPickerRef) Query

func (r *EmojiPickerRef) Query() string

Query returns the current search query, or an empty string while unmounted.

func (*EmojiPickerRef) SetCategory

func (r *EmojiPickerRef) SetCategory(c EmojiCategory)

SetCategory jumps to category, clearing any active search query.

func (*EmojiPickerRef) SetQuery

func (r *EmojiPickerRef) SetQuery(query string)

SetQuery requests a new search query, as typing in the field does.

type EmojiSkinTone

type EmojiSkinTone uint8

EmojiSkinTone is a Fitzpatrick skin tone modifier applied to emoji that support skin tones. The zero value is the default (yellow/neutral) tone.

const (
	SkinToneDefault EmojiSkinTone = iota
	SkinToneLight
	SkinToneMediumLight
	SkinToneMedium
	SkinToneMediumDark
	SkinToneDark
)

func EmojiSkinTones

func EmojiSkinTones() []EmojiSkinTone

EmojiSkinTones returns all six skin tone choices in order.

func (EmojiSkinTone) Label

func (t EmojiSkinTone) Label(cx *core.Scope) string

Label returns the skin tone's localized name in the language the app shows under cx (base/locales).

type HandleEdge

type HandleEdge uint8

HandleEdge is where a ResizeHandle sits on its container.

const (
	// HandleCentered straddles the boundary it sits on.
	HandleCentered HandleEdge = iota
	// HandleLeading hugs the container's leading edge from inside: its
	// left, or top across.
	HandleLeading
	// HandleTrailing hugs its trailing edge from inside.
	HandleTrailing
)

type HourCycle

type HourCycle uint8

HourCycle is a clock's hours.

const (
	// HourCycleUser is the hours the user reads: the 12- or 24-hour time
	// they set, else their region's (i18n.Regional).
	HourCycleUser HourCycle = iota
	HourCycle23
	HourCycle12
)

type HoverCard

type HoverCard struct {
	Open         func() bool
	DefaultOpen  bool
	OnOpenChange func(open bool, reason Reason)
	OnOpen       func()
	OnClose      func()
	// OnPosition reports where the popup went, as Popover's.
	OnPosition func(core.OverlayPosition)
	// OpenDelay is how long the pointer rests or the focus stays before
	// the card opens, 600 ms when 0; CloseDelay how long both are away
	// before it closes, 300 ms when 0. HoverNever waits for good.
	OpenDelay, CloseDelay time.Duration

	Placement      core.Placement
	Align          core.Align
	Offset, Margin core.Points

	PopupClass     string
	PopupStyle     core.Style
	PopupStyleFunc func() core.Style
	// StartingStyle and EndingStyle are the popup's, as Popover's.
	StartingClass string
	StartingStyle core.Style
	EndingClass   string
	EndingStyle   core.Style
	// Trigger keeps its own role, presses and look.
	Trigger  core.Node
	Children []core.Node
	TestID   string
	// OnLayout and Tooltip are its view's, as a core.View's.
	OnLayout func(core.Bounds)
	Tooltip  core.Node
}

HoverCard previews what its trigger points at. On desktops it opens once the pointer rested on the trigger for OpenDelay or the keyboard focus came to it, stays while the pointer or the focus is on the trigger or the card, and closes CloseDelay after both left; Escape and a press outside close it at once. On touch screens a press on the trigger opens and closes it and a press outside closes it. The card takes presses and looks like nothing.

func (HoverCard) Render

func (h HoverCard) Render(cx *core.Scope) core.Node

Render implements core.Node.

type Input

type Input = core.Input

Input is the platform's text field, a single line unless Multiline: a control the core mounts natively. With Value it is controlled: the app updates the value in OnChange.

type Link struct {
	// Invalid is core.View.Invalid, for accessibility and aria-invalid styles.
	Invalid func() bool
	// Href is where it goes, a URL or a path of the app's, never shown.
	Href     string
	HrefFunc func() string
	// OpenWith says who opens Href on a press; OnOpen hears it either way.
	OpenWith LinkOpenWith
	Disabled func() bool
	// OnOpen hears it open its Href, before OnPress.
	OnOpen func(href string)
	// OnPress hears the press, after it opened its Href.
	OnPress   func(core.PressEvent)
	Class     string
	Style     core.Style
	StyleFunc func() core.Style
	Children  []core.Node
	Label     string
	Hint      string
	TestID    string
	// HitSlop and HitSlopFunc are how far outside it presses count.
	HitSlop     core.Edges
	HitSlopFunc func() core.Edges
	// OnLayout and Tooltip are its view's, as a core.View's.
	OnLayout func(core.Bounds)
	Tooltip  core.Node
}

Link is content that goes somewhere when pressed, with the link role and no look of its own. In a Toolbar it is one of its items.

func (Link) Render

func (l Link) Render(cx *core.Scope) core.Node

Render implements core.Node.

type LinkOpenWith

type LinkOpenWith uint8

LinkOpenWith is how a Link opens its Href.

const (
	// LinkOpenSystem opens a URL of another app or site outside the app
	// (core.Scope.OpenURL); any other Href, a path of the app's, is only
	// reported.
	LinkOpenSystem LinkOpenWith = iota
	// LinkOpenApp opens nothing: OnOpen is how it opens.
	LinkOpenApp
)

type List

type List struct {
	// Invalid is core.View.Invalid, for accessibility and aria-invalid styles.
	Invalid func() bool
	Count   func() int
	// Key returns row i's identity, a comparable value such as an ID,
	// which the selection holds; without it, the selection holds indexes.
	Key func(i int) any
	// Row builds a row's content: a cell is built once and shows other
	// rows as it scrolls, so read row's index as a signal.
	Row       func(cx *core.Scope, row core.ListRow) core.Node
	Selection *Selection
	// OnSelectionChange receives the Selection once a press, a key or typeahead has changed which rows it holds. It does not run when the app changes Selection itself, nor when only the cursor moves or the rows stay the same, such as a press on the row already chosen alone.
	OnSelectionChange func(s *Selection)
	// OnActivate receives the row Enter or a double click activates, or
	// on touch screens a tap in a list that is not Multiple.
	OnActivate func(i int)
	// TapSelects has a tap only select on touch screens, and a second
	// activate, for rows a tap should not leave.
	TapSelects bool
	// RowLabel is what assistive technology reads for row i, its text
	// when nil, and what typeahead matches.
	RowLabel func(i int) string
	// Columns lays rows side by side, 1 when 0; the arrows then move
	// along a line and between lines.
	Columns int
	// EstimatedSize is a row's expected height, 20 when 0.
	EstimatedSize core.Points
	Gap           core.Points
	Header        core.Node
	Footer        core.Node
	// Empty shows while Count is 0.
	Empty core.Node
	// OnLoadMore runs as the end of the rows comes near, for the next page.
	OnLoadMore func()
	// Label names the list for assistive technology.
	Label string
	// Ref is the list of rows', for the app's scrolls.
	Ref       *core.Ref
	TestID    string
	Class     string
	Style     core.Style
	StyleFunc func() core.Style
	// ListClass and ListStyle are the list of rows', whose padding is the content's. ListStyleFunc merges over ListStyle whenever what it reads changes, restyling the list in place: its scroll offset, cells, keyboard focus and keys stay.
	ListClass     string
	ListStyle     core.Style
	ListStyleFunc func() core.Style
	ItemClass     string
	ItemStyle     core.Style
	// ItemStyleFunc is each row's style following what it reads.
	ItemStyleFunc func() core.Style
}

List is a long run of the app's rows over core.List, built only near what shows, side by side in Columns for a grid. It looks like nothing: the app sizes it and styles its rows (ItemClass, ItemStyle), whose Selected and Focused states say what is chosen and where the keyboard's cursor is.

With a Selection its rows are chosen by a press and by the keyboard: arrows, Home, End and the page keys move the cursor, Shift extends a multiple selection and Mod+A chooses every row, Space toggles the cursor's row in one, letters move it by typeahead over RowLabel, and Enter or a double click activate a row. The list takes these keys while it has the keyboard focus, or after a press on a row until another list takes them.

func (List) Render

func (l List) Render(cx *core.Scope) core.Node

Render implements core.Node.

type Menu struct {
	Open         func() bool
	DefaultOpen  bool
	OnOpenChange func(open bool, reason Reason)
	OnOpen       func()
	OnClose      func()
	OnCancel     func()
	// OnPosition reports where the popup went, as Popover's.
	OnPosition func(core.OverlayPosition)
	// Presentation is a popup at the trigger, or a sheet.
	Presentation Presentation

	// Placement, Align, Offset and Margin place the popup; Align lines it
	// up with its trigger, at its start when 0.
	Placement      core.Placement
	Align          core.Align
	Offset, Margin core.Points

	Class     string // the trigger's
	Style     core.Style
	StyleFunc func() core.Style
	// PopupStyle styles the popup or the sheet, and its submenus'
	// popups.
	PopupClass     string
	PopupStyle     core.Style
	PopupStyleFunc func() core.Style
	// StartingStyle and EndingStyle are the popup's, as Popover's; a
	// sheet has its own motion.
	StartingClass string
	StartingStyle core.Style
	EndingClass   string
	EndingStyle   core.Style
	// BackdropStyle styles the backdrop behind the sheet.
	BackdropClass     string
	BackdropStyle     core.Style
	BackdropStyleFunc func() core.Style
	Trigger           core.Node
	// Children are the items, made on each opening.
	Children  []core.Node
	Label     string
	LabelFunc func() string
	TestID    string
	// OnLayout and Tooltip are its view's, as a core.View's.
	OnLayout func(core.Bounds)
	Tooltip  core.Node
}

Menu opens a list of MenuItems when its trigger is pressed, beside the trigger or as a sheet as Presentation says. Choosing an item closes it, as do a press outside or on the backdrop, Escape and back, which OnCancel hears.

func (m Menu) Render(cx *core.Scope) core.Node

Render implements core.Node.

type MenuItem struct {
	OnSelect        func()
	Disabled        func() bool
	NoCloseOnSelect bool
	// Checked, when set, makes it a RoleMenuItemCheckbox, or the Role it
	// gives, reporting what Checked returns.
	Checked func() bool
	// Role is what it is for assistive technology, over RoleMenuItem or a
	// checkable item's RoleMenuItemCheckbox.
	Role core.Role
	// Indicator, the app's mark, shows before Children in a part of its
	// own that takes the item's checked and disabled states, styled by
	// IndicatorClass and IndicatorStyle, so its Checked style shows it.
	Indicator      core.Node
	IndicatorClass string
	IndicatorStyle core.Style
	Class          string
	Style          core.Style
	StyleFunc      func() core.Style
	Children       []core.Node
	Label          string
	LabelFunc      func() string
	TestID         string
	// OnLayout and Tooltip are its view's, as a core.View's.
	OnLayout func(core.Bounds)
	Tooltip  core.Node
}

MenuItem is one choice of a menu: pressing it reports OnSelect and closes the menu. Its look is the app's, with its state styles. With Checked it is a checkable item, a setting or by its Role one choice of a group: the value is the app's, and OnSelect is the press.

func (i MenuItem) Render(cx *core.Scope) core.Node

Render implements core.Node.

type MenuSeparator struct {
	Class     string
	Style     core.Style
	StyleFunc func() core.Style
	TestID    string
	// OnLayout and Tooltip are its view's, as a core.View's.
	OnLayout func(core.Bounds)
	Tooltip  core.Node
}

MenuSeparator separates groups of items, shown with its level's.

func (s MenuSeparator) Render(cx *core.Scope) core.Node

Render implements core.Node.

type Nav[R any] struct {
	// contains filtered or unexported fields
}

Nav is a navigation stack of routes of type R: pushing a route adds a screen, popping removes it. The same route pushed twice is two pages.

func NewNav

func NewNav[R any](cx *core.Scope, routes ...R) *Nav[R]

NewNav returns a stack holding routes, the first at the bottom.

func (n *Nav[R]) Depth() int

Depth returns how many routes are above the first.

func (n *Nav[R]) Pop(count int)

Pop removes up to count routes from the top, keeping the first.

func (n *Nav[R]) PopToRoot()

PopToRoot keeps only the first route.

func (n *Nav[R]) Push(route R)

Push adds route on top.

func (n *Nav[R]) Remove(match func(R) bool)

Remove takes away the routes match reports, with their pages.

func (n *Nav[R]) Replace(route R)

Replace replaces the top route.

func (n *Nav[R]) Routes() []R

Routes returns the routes, bottom first.

func (n *Nav[R]) SetRoutes(routes ...R)

SetRoutes replaces every route.

func (n *Nav[R]) SetRoutesKeeping(same func(a, b R) bool, routes ...R)

SetRoutesKeeping replaces every route, a route same says is one there already keeping its page, the first such one in order.

func (n *Nav[R]) Stack(style core.Style, page func(cx *core.Scope, route R, depth func() int) NavPage) core.Node

Stack renders the routes as a stack of pages, one each. A page the user pops goes from the routes before its OnDismiss runs.

type NavPage = core.Screen

NavPage is one page of a Nav's stack, filling it. On iOS and Android the platform draws the system header, a navigation bar or a toolbar, from its title and header options; elsewhere its Header, when set, is drawn at the top.

type NumberInput

type NumberInput struct {
	// Ref is the field's; LabelledBy is a core.Input's.
	Ref        *core.Ref
	LabelledBy []*core.Ref
	// Invalid is core.View.Invalid, for accessibility and aria-invalid styles.
	Invalid func() bool
	// Value makes it controlled once it returns a number; nil is an empty
	// field. Without it the input keeps its own, from DefaultValue.
	Value        func() *float64
	DefaultValue *float64
	// Min and Max bound it, nil for none. Steps stop there; a typed value
	// is held to them as the field is left or Enter is pressed.
	Min, Max func() *float64
	// Step is how far a step goes, 1 when unset or not positive.
	Step     func() float64
	Disabled func() bool
	// Readonly can be selected and copied but not changed.
	Readonly    func() bool
	Placeholder func() string
	// Label is what assistive technology says for the field.
	Label string
	// LabelFunc binds a changing Label.
	LabelFunc func() string
	// ControlsRight is read as it is made.
	ControlsRight bool
	// Format writes a value it did not type, the shortest text that reads back as it when nil; Parse reads the field, as a number when nil. Changes to signals Format reads refresh the shown value outside editing.
	Format func(value float64) string
	Parse  func(text string) (float64, bool)
	// OnCommit leaves the field's text alone as the user types and takes
	// it as it is left or Return pressed, for a Format of the app's.
	OnCommit bool
	// Live, with OnCommit, also reports what is typed as soon as it reads
	// as a number in range, leaving the text alone until the field is left.
	Live bool
	// Snap rounds what is committed to Precision, or Step while that is 0,
	// from Min.
	Snap      bool
	Precision float64
	// IncrementLabel and DecrementLabel name the buttons for assistive
	// technology, which otherwise steps the field itself.
	IncrementLabel, DecrementLabel string
	// Scrub is a handle a drag across steps the value with, a step each
	// ScrubDistance points, 4 when 0.
	Scrub          core.Node
	ScrubDistance  core.Points
	ScrubClass     string
	ScrubStyle     core.Style
	ScrubStyleFunc func() core.Style
	ScrubTestID    string
	// OnChange receives the number the field reads as, nil while it reads
	// as none, as the user types and steps.
	OnChange func(value *float64)
	// OnChangeEnd follows the OnChange calls of one change: a step, a
	// scrub's release, or the field left or submitted after typing.
	OnChangeEnd func()
	// OnSubmit receives its value on Return, held to Min and Max.
	OnSubmit func(value *float64)
	// OnFocus and OnBlur follow the field.
	OnFocus, OnBlur func()
	Class           string
	Style           core.Style
	StyleFunc       func() core.Style
	InputClass      string
	InputStyle      core.Style
	InputStyleFunc  func() core.Style
	// ButtonLook is both buttons' style following what it reads.
	ButtonLook           func() core.Style
	DecrementButton      core.Node
	DecrementButtonClass string
	DecrementButtonStyle core.Style
	IncrementButton      core.Node
	IncrementButtonClass string
	IncrementButtonStyle core.Style
	ControlsClass        string
	ControlsStyle        core.Style
	Prefix, Suffix       core.Node
	TestID               string
	// OnLayout and Tooltip are its view's, as a core.View's.
	OnLayout func(core.Bounds)
	Tooltip  core.Node
}

NumberInput is a field for a number with buttons that step it. It owns what the field takes as the user types, other keyboards' digits included, the step and its decimals, held to Min and Max, WAI-ARIA's spin button keys while the field edits, and its role and value for assistive technology, and has no look. Its parts are the decrement button, the field between Prefix and Suffix, and the increment button; with ControlsRight the field between them and a column with the increment over the decrement.

func (NumberInput) Render

func (n NumberInput) Render(cx *core.Scope) core.Node

Render implements core.Node.

type OtpInput

type OtpInput struct {
	// Invalid is core.View.Invalid, for accessibility and aria-invalid styles.
	Invalid func() bool
	Length  int
	// Value makes the code controlled, shown as it is; DefaultValue starts
	// its own.
	Value        func() string
	DefaultValue string
	// Masked shows bullets, in a secure field.
	Masked   bool
	Disabled func() bool
	// Groups is how many groups the cells split into, as evenly as they
	// go.
	Groups int
	// Label is what assistive technology says for the field.
	Label string
	// LabelFunc binds a changing Label.
	LabelFunc func() string
	// OnChange receives the code the user made; a Value the app passes is
	// never reported. OnComplete receives it once full, after OnChange.
	OnChange, OnComplete func(value string)
	OnFocus, OnBlur      func()
	// Ref's Focus takes the keyboard focus.
	Ref       *OtpInputRef
	Class     string
	Style     core.Style
	StyleFunc func() core.Style
	CellClass string
	CellStyle core.Style
	// CellStyleFunc and CaretStyleFunc are the parts' styles following
	// what they read.
	CellStyleFunc  func() core.Style
	GroupClass     string
	GroupStyle     core.Style
	CaretClass     string
	CaretStyle     core.Style
	CaretStyleFunc func() core.Style
	TestID         string
	// OnLayout and Tooltip are its view's, as a core.View's.
	OnLayout func(core.Bounds)
	Tooltip  core.Node
}

OtpInput is a fixed number of digits entered into cells, a code from a text message. One native field, transparent and over the cells, owns the keyboard: typing, input methods, paste, the system's code autofill and what assistive technology knows; the cells only show the code, so the caret stays at the end and nothing is edited in the middle. The code is the app's (Value) or its own (DefaultValue), and the look is the app's: focus styles the cell that takes the next digit, data-filled those that hold one. A press anywhere on it focuses it.

func (OtpInput) Render

func (o OtpInput) Render(cx *core.Scope) core.Node

Render implements core.Node.

type OtpInputRef

type OtpInputRef struct {
	// contains filtered or unexported fields
}

OtpInputRef is an OtpInput's ref.

func (*OtpInputRef) Focus

func (r *OtpInputRef) Focus()

Focus takes the keyboard focus, showing the software keyboard.

type Pagination

type Pagination struct {
	Page       func() int
	TotalPages func() int
	// VisiblePages is the most pages shown at once, at least 5, the
	// default.
	VisiblePages int
	Compact      func() bool
	Disabled     func() bool
	// PreviousLabel and NextLabel are what assistive technology says for
	// Previous and Next, and their content without RenderItem, else ‹ and ›.
	PreviousLabel string
	NextLabel     string
	OnChange      func(page int)
	// RenderItem draws each item's content from its state.
	RenderItem func(item PaginationItem) core.Node
	ItemClass  string
	ItemStyle  core.Style
	// ItemStyleFunc is the items' style following what it reads.
	ItemStyleFunc func() core.Style
	Class         string
	Style         core.Style
	StyleFunc     func() core.Style
	Children      []core.Node
	Label         string
	TestID        string
	// OnLayout and Tooltip are its view's, as a core.View's.
	OnLayout func(core.Bounds)
	Tooltip  core.Node
}

Pagination is the pages of a set to move among, a navigation landmark: a row of Previous, the pages around the current one, ellipses for the runs left out, its children and Next; Compact keeps Previous, the children and Next. Page is the app's: a press reports the page it goes to with OnChange. It looks like nothing: the app styles the items (ItemClass, its selected: on the current page) or draws them (RenderItem). The row is made once, a place for each item it can hold, so a page change changes what the places show and makes no view.

func (Pagination) Render

func (p Pagination) Render(cx *core.Scope) core.Node

Render implements core.Node.

type PaginationItem

type PaginationItem struct {
	Kind PaginationItemKind
	// Page is a page's number; for Previous and Next the page they go to,
	// the current one at the ends; for an ellipsis the first it leaves out.
	Page int
	// Start and End are an ellipsis' pages, End past the last.
	Start, End int
	// Current is the current page.
	Current bool
	// Disabled takes no press: everything of a disabled pagination,
	// Previous on the first page and Next on the last.
	Disabled bool
}

PaginationItem is an item as RenderItem draws it.

type PaginationItemKind

type PaginationItemKind uint8

PaginationItemKind is what a Pagination's item is.

const (
	PaginationPage PaginationItemKind = iota
	PaginationPrevious
	PaginationEllipsis
	PaginationNext
)

type Popover

type Popover struct {
	Open         func() bool
	DefaultOpen  bool
	OnOpenChange func(open bool, reason Reason)
	OnOpen       func()
	OnClose      func()
	// OnCancel hears every attempt to close it, allowed or not.
	OnCancel func()
	// OnPosition reports where the popup went: the other side of Placement
	// when only that one had room, its frame and the room on that side.
	OnPosition func(core.OverlayPosition)

	Placement             core.Placement
	Align                 core.Align
	Offset, Margin        core.Points
	NoCloseOnEscape       bool
	NoCloseOnPressOutside bool

	Class          string // the trigger's
	Style          core.Style
	StyleFunc      func() core.Style
	PopupClass     string
	PopupStyle     core.Style
	PopupStyleFunc func() core.Style
	// StartingStyle styles the popup in its first frame and EndingStyle
	// as it goes (popupMotion); they merge over PopupStyle, and their
	// classes are important.
	StartingClass string
	StartingStyle core.Style
	EndingClass   string
	EndingStyle   core.Style
	Trigger       core.Node
	Children      []core.Node
	Label         string
	LabelFunc     func() string
	TestID        string
	// OnLayout and Tooltip are its view's, as a core.View's.
	OnLayout func(core.Bounds)
	Tooltip  core.Node
}

Popover shows content beside its trigger: pressing the trigger opens it, pressing outside or Escape closes it. On desktops a press outside goes on to what is under the pointer; on touch screens a transparent backdrop takes it, so it only closes the popover.

func (Popover) Render

func (p Popover) Render(cx *core.Scope) core.Node

Render implements core.Node.

type Presentation

type Presentation uint8

Presentation is how a Menu, a ContextMenu, a Select, a Combobox or a DatePicker shows what it opens. Its zero value, the popup, is their form on every device: base changes it by none, and the app chooses the sheet where it wants one, as on a touch screen.

const (
	// PresentPopup opens a popup at the trigger, or at the pointer for a
	// context menu, never past the room on its side, its submenus
	// cascading beside it.
	PresentPopup Presentation = iota
	// PresentSheet opens a sheet at the bottom of the window over a
	// backdrop, as touch screens show menus: submenus replace the items,
	// and a search field waits for a tap before the keyboard comes.
	PresentSheet
)

type Progress

type Progress struct {
	// Value is a percentage from 0 to 100, clamped; NaN is none yet.
	Value func() float32
	// Axis is the direction of the track: the indicator fills it from the
	// start, or from the bottom of a vertical one; Inverted fills it from
	// the other end, the end of a horizontal track or the top of a
	// vertical one. Both are read as it is made.
	Axis     Axis
	Inverted bool
	// Indeterminate leaves the indicator's width and motion to the app,
	// and reports no value.
	Indeterminate      func() bool
	Class              string
	Style              core.Style
	StyleFunc          func() core.Style
	TrackClass         string
	TrackStyle         core.Style
	TrackStyleFunc     func() core.Style
	IndicatorClass     string
	IndicatorStyle     core.Style
	IndicatorStyleFunc func() core.Style
	// ValueText is what assistive technology reads as the value, the
	// number when nil.
	ValueText func(value float32) string
	Children  []core.Node
	Label     string
	LabelFunc func() string
	TestID    string
	// OnLayout and Tooltip are its view's, as a core.View's.
	OnLayout func(core.Bounds)
	Tooltip  core.Node
}

Progress is a linear progress bar: how far a task of a known extent is, or that one of an unknown extent is under way. Its parts are a track and an indicator inside it, as long as Value's share of the track while determinate, then its children, which assistive technology reads.

func (Progress) Render

func (p Progress) Render(*core.Scope) core.Node

Render implements core.Node.

type Radio

type Radio struct {
	// Ref and LabelledBy are the control view's, as a core.View's.
	Ref        *core.Ref
	LabelledBy []*core.Ref
	// Invalid is core.View.Invalid, for accessibility and aria-invalid styles.
	Invalid  func() bool
	Checked  func() bool
	Disabled func() bool
	// OnChange receives true when an unchecked radio is pressed: the app
	// checks it and unchecks the others. A checked radio reports nothing,
	// as a radio cannot uncheck itself.
	OnChange  func(checked bool)
	Class     string
	Style     core.Style
	StyleFunc func() core.Style
	Children  []core.Node
	Label     string
	LabelFunc func() string
	Hint      string
	HintFunc  func() string
	TestID    string
	// HitSlop is how far outside the radio presses count.
	HitSlop core.Edges
	// OnLayout and Tooltip are its view's, as a core.View's.
	OnLayout func(core.Bounds)
	Tooltip  core.Node
}

Radio is one option of a set the user picks exactly one of, in a RadioGroup with the others. Its children are the app's indicator and label; a GroupStyle under Style.Group follows the radio's Checked.

func (Radio) Render

func (r Radio) Render(cx *core.Scope) core.Node

Render implements core.Node.

type RadioGroup

type RadioGroup struct {
	// Invalid is core.View.Invalid, for accessibility and aria-invalid styles.
	Invalid   func() bool
	Class     string
	Style     core.Style
	StyleFunc func() core.Style
	Children  []core.Node
	Label     string
	TestID    string
	// OnLayout and Tooltip are its view's, as a core.View's.
	OnLayout func(core.Bounds)
	Tooltip  core.Node
}

RadioGroup holds a set of Radios, which assistive technology hears as one set and the keyboard focus as one Tab stop: the checked radio, else the first enabled one. Up and Left, Down and Right move to the previous and next enabled radio, around the ends, and check it. It holds no value: each radio is told whether it is checked.

func (RadioGroup) Render

func (g RadioGroup) Render(cx *core.Scope) core.Node

Render implements core.Node.

type Reason

type Reason uint8

Reason is why a popup asks to open or close.

const (
	ReasonTriggerPress Reason = iota + 1
	ReasonPressOutside
	ReasonBackdropPress
	ReasonCancel
	ReasonSelect
	ReasonHover
	ReasonLongPress
	ReasonContextMenu
	// ReasonSwipe is a sheet swiped down: base.Sheet's, or an iOS
	// dialog's.
	ReasonSwipe
	// ReasonFocus is a hover card's or a tooltip's trigger gaining or
	// losing the keyboard's focus.
	ReasonFocus
	// ReasonInputChange is typing in a combobox's input.
	ReasonInputChange
)

func (Reason) String

func (r Reason) String() string

type ResizablePanel

type ResizablePanel struct {
	// Size is the size the panel wants along the group, within its
	// range; a new one from the app replaces what the user dragged it to.
	// Without it, or while it returns 0, the panel shares what the others
	// leave.
	Size func() core.Points
	// MinSize and MaxSize bound it: PanelMinSize when MinSize is 0 and
	// none when it is negative, unbounded when MaxSize is 0.
	MinSize, MaxSize core.Points
	// Fixed keeps its size while the group is too small for the panels.
	Fixed bool
	// Visible hides the panel while it returns false; it comes back at
	// the size it wanted.
	Visible func() bool
	// OnResize receives its size after a drag or a step changed it.
	OnResize  func(size core.Points)
	Class     string
	Style     core.Style
	StyleFunc func() core.Style
	Children  []core.Node
	TestID    string
	// OnLayout and Tooltip are its view's, as a core.View's.
	OnLayout func(core.Bounds)
	Tooltip  core.Node
}

ResizablePanel is one panel of a ResizablePanelGroup.

type ResizablePanelGroup

type ResizablePanelGroup struct {
	Axis   Axis
	Panels []ResizablePanel
	// OnResize receives every visible panel's size after a drag or a
	// screen reader's step changed them, never after the group resized.
	OnResize func(sizes []core.Points)
	Disabled func() bool

	Class     string
	Style     core.Style
	StyleFunc func() core.Style
	// HandleStyle styles each handle's line: 1 point across and as long
	// as the boundary unless it says otherwise.
	HandleClass     string
	HandleStyle     core.Style
	HandleStyleFunc func() core.Style
	// HandleThumbClass or HandleThumbStyle, when set, styles a grip
	// centered on the line, drawn upright as on a vertical line and
	// turned a quarter on a horizontal one.
	HandleThumbClass     string
	HandleThumbStyle     core.Style
	HandleThumbStyleFunc func() core.Style
	// RenderHandle renders what is inside each handle's line, told which
	// handle it is and how far the pointer has gone with it; it is drawn
	// again when the handle's state changes, never as a drag moves.
	RenderHandle func(cx *core.Scope, h ResizeHandleContext) core.Node
	// HandleLabel names the handles for assistive technology.
	HandleLabel string
	TestID      string
	// OnLayout and Tooltip are its view's, as a core.View's.
	OnLayout func(core.Bounds)
	Tooltip  core.Node
}

ResizablePanelGroup lays out its Panels along Axis, each visible one at the size it wants: the size the user last dragged it to, else its Size. Panels without a size share what is left; when every panel has one, they share what is left over in proportion. A group too small for them shrinks them, fixed ones aside, and they come back as room returns; one too short for their minimums shares its length in proportion to them.

A handle sits on each boundary between two visible panels: a band with the resize cursor and the adjustable role, whose drag resizes the panel before it, taking from the panels after it, nearest first, as far as their minimums let it. Screen readers move it 10 points a step. The band is a group (Style.Group "resize-handle"), so the app's HandleStyle and HandleThumbStyle follow its hover and press with a GroupStyle.

func (ResizablePanelGroup) Render

func (g ResizablePanelGroup) Render(cx *core.Scope) core.Node

Render implements core.Node.

type ResizeHandle

type ResizeHandle struct {
	// Axis is the axis it moves along.
	Axis Axis
	Edge HandleEdge
	// OnDragStart, OnDragMove and OnDragEnd follow a drag, with its
	// offset along Axis since it started.
	OnDragStart   func()
	OnDragMove    func(offset core.Points)
	OnDragEnd     func(offset core.Points)
	OnDoublePress func()
	Disabled      func() bool
	// OnStateChange follows the pointer's progression with the handle.
	OnStateChange func(ResizeHandleState)
	// Value is what assistive technology says the handle is at.
	Value          func() core.AccessibilityValue
	Class          string // the line's
	Style          core.Style
	StyleFunc      func() core.Style
	ThumbClass     string
	ThumbStyle     core.Style
	ThumbStyleFunc func() core.Style
	Label          string
	// Children are the app's, inside the line.
	Children []core.Node
	TestID   string
}

ResizeHandle is a handle's band on its own, on a container's edge (Edge) or straddling a boundary: it reports a drag, and the app resizes what it edges. Screen readers' steps report as a drag of 10 points. OnDoublePress hears a double click or tap, which apps take to restore what it edges to its default size.

func (ResizeHandle) Render

func (r ResizeHandle) Render(cx *core.Scope) core.Node

Render implements core.Node.

type ResizeHandleContext

type ResizeHandleContext struct {
	// Index is the boundary after the Index'th visible panel.
	Index int
	Axis  Axis
	State ResizeHandleState
}

ResizeHandleContext is what RenderHandle is told about a handle.

type ResizeHandleState

type ResizeHandleState uint8

ResizeHandleState is how far the pointer has gone with a handle. A drag takes the pointer off the band within a point or two, so the handle follows its progression itself rather than its hover.

const (
	// HandleIdle is a handle the pointer is elsewhere from.
	HandleIdle ResizeHandleState = iota
	// HandleHovered is one the pointer is over.
	HandleHovered
	// HandlePressed is one the pointer went down on and has not dragged.
	HandlePressed
	// HandleDragging is one being dragged.
	HandleDragging
)

func (ResizeHandleState) Active

func (s ResizeHandleState) Active() bool

Active reports whether the pointer holds the handle: pressed on it or dragging it.

func (ResizeHandleState) String

func (s ResizeHandleState) String() string

type Scrollbar

type Scrollbar struct {
	// Scroll is the view it follows and moves, read in every commit.
	Scroll func() *core.Ref
	// Horizontal says the target scrolls sideways; read as it is made.
	Horizontal bool
	Mode       func() ScrollbarMode
	Motion     func() ScrollbarMotion
	// MinThumbLength is the shortest the thumb gets, 48 when 0.
	MinThumbLength func() core.Points
	Class          string
	Style          core.Style
	StyleFunc      func() core.Style
	ThumbClass     string
	ThumbStyle     core.Style
	// ThumbStyleFunc is the thumb's style following what it reads.
	ThumbStyleFunc func() core.Style
	Label          string
	TestID         string
}

Scrollbar is a bar of the app's look for a scroll view or list it names, placed by the app like any other view. It owns the thumb's length and place, which follow the target's content, viewport and offset, dragging the thumb or pressing the track, which scrolls the target, and when it shows; it has no look of its own. Hidden, it takes no presses. Turn the target's own indicator off with HideIndicator.

func (Scrollbar) Render

func (s Scrollbar) Render(cx *core.Scope) core.Node

Render implements core.Node.

type ScrollbarEntrance

type ScrollbarEntrance uint8

ScrollbarEntrance is how a Scrollbar comes in.

const (
	// ScrollbarFade fades it in without moving.
	ScrollbarFade ScrollbarEntrance = iota
	// ScrollbarSlideAndFade slides it in from its edge while it fades.
	ScrollbarSlideAndFade
)

type ScrollbarLook

type ScrollbarLook struct {
	Class          string
	Style          core.Style
	ThumbClass     string
	ThumbStyle     core.Style
	ThumbStyleFunc func() core.Style
	Label          string
}

ScrollbarLook is the look of the built-in bars of one axis, placed in the view's viewport (absolute inset-y-0 right-0 w-4 p-1).

type ScrollbarMode

type ScrollbarMode uint8

ScrollbarMode is when a Scrollbar shows. A drag of its thumb keeps it shown in every mode, and it never shows while the content fits.

const (
	// ScrollbarScrolling shows it while the target scrolls, until Idle
	// after it stops; the pointer on the bar while it shows keeps it.
	ScrollbarScrolling ScrollbarMode = iota
	// ScrollbarHover also shows it while the pointer is over it.
	ScrollbarHover
	// ScrollbarAlways shows it always.
	ScrollbarAlways
)

type ScrollbarMotion

type ScrollbarMotion struct {
	// Idle is how long it stays after the last scroll, drag or hover, in
	// milliseconds, 2000 when 0.
	Idle float64
	// Enter and Exit are how long it takes to appear and to go, in
	// milliseconds; 0 snaps.
	Enter, Exit float64
	Entrance    ScrollbarEntrance
	// ThumbHoverEntrance is how it comes in when the pointer on its hidden
	// thumb shows it.
	ThumbHoverEntrance ScrollbarEntrance
}

ScrollbarMotion is how a Scrollbar shows and hides, natively.

type ScrollbarTheme

type ScrollbarTheme struct {
	Mode           ScrollbarMode
	Motion         ScrollbarMotion
	MinThumbLength core.Points
	Vertical       *ScrollbarLook
	Horizontal     *ScrollbarLook
}

ScrollbarTheme draws built-in bars in place of the platform's indicator, for every view with SetScrollbarTheme, or for one as its Scroll.Bar. An axis with no look keeps the platform's.

func (*ScrollbarTheme) Scrollbar

func (t *ScrollbarTheme) Scrollbar(_ *core.Scope, target *core.Ref, horizontal bool) core.Node

Scrollbar implements core.ScrollbarMaker.

type Select

type Select struct {
	// Ref and LabelledBy are the trigger view's, as a core.View's.
	Ref        *core.Ref
	LabelledBy []*core.Ref
	// Invalid is core.View.Invalid, for accessibility and aria-invalid styles.
	Invalid      func() bool
	Items        func() []SelectItem
	Value        func() *string
	DefaultValue string
	Open         func() bool
	DefaultOpen  bool
	Disabled     func() bool
	// Searchable shows a field above the rows that filters them by title.
	Searchable        func() bool
	SearchPlaceholder string
	// SearchPlaceholderFunc and SearchLabelFunc bind the search field’s words.
	SearchPlaceholderFunc func() string
	SearchLabel           string
	SearchLabelFunc       func() string
	// Cleanable shows a button while an item is chosen, which clears the
	// value and reports nil.
	Cleanable bool

	// Presentation is a popup at the trigger, or a sheet.
	Presentation Presentation
	Placement    core.Placement
	// Align lines the list up with its trigger, at its start when 0.
	Align          core.Align
	Offset, Margin core.Points

	Class     string // the trigger's
	Style     core.Style
	StyleFunc func() core.Style
	// RootClass and RootStyle are the view around the trigger and its
	// clear button.
	RootClass      string
	RootStyle      core.Style
	PopupClass     string
	PopupStyle     core.Style
	PopupStyleFunc func() core.Style
	// BackdropClass and BackdropStyle are the sheet's.
	BackdropClass string
	BackdropStyle core.Style
	ListClass     string
	ListStyle     core.Style
	ItemClass     string
	ItemStyle     core.Style
	// ItemStyleFunc is each row's style following what it reads.
	ItemStyleFunc  func() core.Style
	GroupClass     string
	GroupStyle     core.Style
	GroupStyleFunc func() core.Style
	SearchClass    string
	SearchStyle    core.Style
	// SearchField draws the search field, as a styled form does.
	SearchField func(core.Input) core.Node

	ClearButtonClass string
	ClearButtonStyle core.Style
	ClearButton      core.Node
	ClearButtonLabel string

	Trigger core.Node
	// Empty shows in the list's place while no item matches.
	Empty core.Node
	// RenderItem draws what a row is, and RenderGroup a header: a move of
	// the highlight or a choice draws nothing again.
	RenderItem  func(SelectEntry) core.Node
	RenderGroup func(SelectGroup) core.Node

	OnChange     func(value *string)
	OnOpenChange func(open bool, reason Reason)
	OnOpen       func()
	OnClose      func()
	OnCancel     func()
	Label        string
	LabelFunc    func() string
	TestID       string
	// OnLayout and Tooltip are its view's, as a core.View's.
	OnLayout func(core.Bounds)
	Tooltip  core.Node
}

Select picks one value from a list it opens under its trigger, the selected item over the trigger, or as a sheet as Presentation says. Value makes the value controlled, nil for none, with its own from DefaultValue otherwise. The list has no look: the app styles each part, a row's Focused style following the highlight, its Selected style the value. Up, Down, Return and Space open it from the focused trigger, and letters choose by typeahead.

func (Select) Render

func (s Select) Render(cx *core.Scope) core.Node

Render implements core.Node.

type SelectEntry

type SelectEntry struct {
	Value, Title string
	Disabled     bool
	Group        string
	Index        int
}

SelectEntry is what RenderItem draws: what the item is, and its Index among the items.

type SelectGroup

type SelectGroup struct{ Title string }

SelectGroup is what RenderGroup draws.

type SelectItem

type SelectItem struct {
	Value, Title string
	Disabled     bool
	// Group is the section it is in: adjacent items of one group show
	// under one header.
	Group string
}

SelectItem is an item of a Select or a Combobox.

type Selection

type Selection struct {
	// contains filtered or unexported fields
}

Selection is the rows a Tree or a List has chosen, by key, and the row its keyboard cursor is on. The app makes it with NewSelection and keeps it with the rest of its state: it reads it as it reads a signal, and sets it as the list does.

func NewSelection

func NewSelection(cx *core.Scope, multiple bool) *Selection

NewSelection returns an empty selection of one row, or with multiple of any number.

func (*Selection) Anchor

func (s *Selection) Anchor() any

Anchor returns the key of the row a range from Shift starts at, nil for none.

func (*Selection) Clear

func (s *Selection) Clear()

Clear chooses no row and leaves the cursor where it is.

func (*Selection) Cursor

func (s *Selection) Cursor() any

Cursor returns the key of the row the keyboard is on, nil for none.

func (*Selection) Has

func (s *Selection) Has(key any) bool

Has reports whether the row of key is chosen.

func (*Selection) Keys

func (s *Selection) Keys() []any

Keys returns the chosen rows' keys in the order they were chosen.

func (*Selection) Len

func (s *Selection) Len() int

Len returns how many rows are chosen.

func (*Selection) Multiple

func (s *Selection) Multiple() bool

Multiple reports whether the selection holds any number of rows.

func (*Selection) Set

func (s *Selection) Set(keys ...any)

Set chooses the rows of keys alone, only the last of them in a selection of one, and moves the cursor to the last.

func (*Selection) SetCursor

func (s *Selection) SetCursor(key any)

SetCursor moves the keyboard to the row of key without choosing it.

func (*Selection) SetRange

func (s *Selection) SetRange(anchor, cursor any, keys ...any)

SetRange chooses the rows of keys alone, as a range from anchor that reaches cursor.

func (*Selection) Toggle

func (s *Selection) Toggle(key any)

Toggle chooses the row of key, or unchooses it when chosen, and moves the cursor to it. A selection of one keeps no other row.

type Sheet

type Sheet struct {
	Open         func() bool
	DefaultOpen  bool
	OnOpenChange func(open bool, reason Reason)
	OnOpen       func()
	OnClose      func()
	OnCancel     func()
	// OnConfirm is the default action, as Dialog's: Return runs it while the sheet is open, then asks to close with ReasonSelect.
	OnConfirm func()

	// Side is the edge the panel sits on; the bottom by default.
	Side                   core.Placement
	NoCloseOnEscape        bool
	NoCloseOnBackdropPress bool
	CloseOnSwipe           bool
	// BackdropStyle styles the backdrop, which fades with the panel: give
	// it a translucent background.
	BackdropClass     string
	BackdropStyle     core.Style
	BackdropStyleFunc func() core.Style
	PopupClass        string
	PopupStyle        core.Style
	PopupStyleFunc    func() core.Style
	// StartingStyle and EndingStyle style the panel while it enters and leaves; include a Transition in the style for custom timing.
	StartingClass string
	StartingStyle core.Style
	EndingClass   string
	EndingStyle   core.Style
	// Class and Style style the layer that holds the backdrop and the
	// panel, which covers the root view.
	Class     string
	Style     core.Style
	StyleFunc func() core.Style
	// Children are the content, made on each opening.
	Children []core.Node
	// Label names the sheet for screen readers, a dialog, and AccessibilityDescription is read after it.
	Label                        string
	LabelFunc                    func() string
	AccessibilityDescription     string
	AccessibilityDescriptionFunc func() string
	// Role is what screen readers announce it as, RoleDialog when 0 or RoleAlertDialog for one asking for an answer, as Dialog's.
	Role   core.Role
	TestID string
}

Sheet is a panel at an edge of the app (Side) over a backdrop that covers the rest and takes its presses, on top of everything in its root view, the same on every device. It slides in from its edge as the backdrop fades in, and back out as it closes, at once when the user asked for less motion; OnOpen and OnClose follow the motion's end. A press on the backdrop, Escape and back close it, and with CloseOnSwipe a bottom sheet follows a downward drag and closes on a release past 30% of its height or 800 points a second.

func (Sheet) Render

func (s Sheet) Render(cx *core.Scope) core.Node

Render implements core.Node.

type Slider

type Slider struct {
	// Invalid is core.View.Invalid, for accessibility and aria-invalid styles.
	Invalid func() bool
	// Value makes it controlled; without it the slider keeps its own, from
	// DefaultValue.
	Value        func() SliderValue
	DefaultValue SliderValue
	// Min, Max and Step follow the bounds and step as they change, defaulting to 0, 100 and 1. A step of 0 takes any value.
	Min, Max func() float64
	Step     func() float64
	Scale    func() SliderScale
	// Axis is the direction of the track, min at the start, or at the
	// bottom of a vertical one; Inverted puts min at the other end, the
	// end of a horizontal track or the top of a vertical one, and the
	// arrow keys along the track follow. Both are read as it is made.
	Axis     Axis
	Inverted bool
	Disabled func() bool
	// LabelledBy applies to both thumbs, as a core.View's.
	LabelledBy []*core.Ref
	// Label is what assistive technology says for the thumb, on a range the
	// end's; StartLabel for a range's start, Label by default.
	Label          string
	LabelFunc      func() string
	StartLabel     string
	StartLabelFunc func() string
	// OnChange receives the value asked for, as many times as it changes
	// during a drag; OnChangeEnd the value it ended at, once.
	OnChange       func(value SliderValue)
	OnChangeEnd    func(value SliderValue)
	Class          string
	Style          core.Style
	StyleFunc      func() core.Style
	TrackClass     string
	TrackStyle     core.Style
	IndicatorClass string
	IndicatorStyle core.Style
	RangeClass     string
	RangeStyle     core.Style
	ThumbClass     string
	ThumbStyle     core.Style
	// IndicatorStyleFunc, RangeStyleFunc and ThumbStyleFunc are the parts'
	// styles following what they read.
	IndicatorStyleFunc func() core.Style
	RangeStyleFunc     func() core.Style
	ThumbStyleFunc     func() core.Style
	// ValueText is what assistive technology reads as a value, the number
	// by its step's decimals when nil.
	ValueText func(value float64) string
	// Marks show on the indicator, under the range and the thumbs: a
	// stepped slider's ticks, placed by the app in percents of its length.
	Marks    []core.Node
	Children []core.Node
	TestID   string
	// ThumbRef is the thumb's, on a range the end's.
	ThumbRef *core.Ref
	// StartThumbRef is a range's start thumb.
	StartThumbRef *core.Ref
	// ThumbTestID and StartThumbTestID name the thumb, on a range the
	// end's, and a range's start.
	ThumbTestID, StartThumbTestID string
	// OnLayout and Tooltip are its view's, as a core.View's.
	OnLayout func(core.Bounds)
	Tooltip  core.Node
}

Slider picks a value, or a range of two, along a track. It owns the presses and drags, WAI-ARIA's slider keys on each thumb, the step and the scale, and each thumb's role, label and value for assistive technology, and has no look. Its parts are a track, the indicator inside it whose length the values map onto, the range and the thumbs on it, then its children.

func (Slider) Render

func (s Slider) Render(cx *core.Scope) core.Node

Render implements core.Node.

type SliderScale

type SliderScale uint8

SliderScale is how values spread along a slider's track.

const (
	// SliderLinear spreads them evenly.
	SliderLinear SliderScale = iota
	// SliderLogarithmic spreads them by orders of magnitude, for a volume,
	// a frequency, a zoom. It needs Min above 0, else it is linear.
	SliderLogarithmic
)

type SliderValue

type SliderValue struct {
	// Start is a range's start, End a range's end or a single value.
	Start, End float64
	Range      bool
}

SliderValue is a slider's value: one number, or a range of two with a thumb each, whose start is never past its end.

func RangeValue

func RangeValue(start, end float64) SliderValue

RangeValue is a range of two values, a thumb each.

func SingleValue

func SingleValue(v float64) SliderValue

SingleValue is one value, one thumb.

type Submenu struct {
	Disabled func() bool
	// Style styles the item that opens it.
	Class     string
	Style     core.Style
	StyleFunc func() core.Style
	// PopupClass or PopupStyle, when set, styles its popup instead of the
	// menu's.
	PopupClass     string
	PopupStyle     core.Style
	PopupStyleFunc func() core.Style
	Trigger        core.Node
	// Back is the row above its items in a sheet that returns to the
	// items it is among, as Escape and back do: the app's, as every
	// label is.
	Back      core.Node
	BackClass string
	BackStyle core.Style
	Children  []core.Node
	Label     string
	TestID    string
	// OnLayout and Tooltip are its view's, as a core.View's.
	OnLayout func(core.Bounds)
	Tooltip  core.Node
}

Submenu is an item that opens more items: on desktops a popup beside it, opened as the pointer comes over it or presses it; on touch screens a press shows its items in the sheet in place of the ones around it, with Back first. Its popups take the menu's PopupStyle unless it has its own. Choosing one of its items closes the whole menu.

func (s Submenu) Render(cx *core.Scope) core.Node

Render implements core.Node.

type SuggestItem

type SuggestItem struct {
	ID, Label, Detail string
	// Insert replaces the trigger and the query as the row is accepted; Label does when it is empty.
	Insert   string
	Disabled bool
}

SuggestItem is a row of a SuggestList, which shows the rows in the app's order and filters none.

type SuggestList

type SuggestList struct {
	Suggest *core.Suggest
	// Items returns the rows for a query. It runs untracked on the engine goroutine, once per query while the query is open; an app may memoize it.
	Items func(query string) []SuggestItem

	// Placement, Align, Offset and Margin place the overlay beside the caret, as core.Overlay's.
	Placement      core.Placement
	Align          core.Align
	Offset, Margin core.Points

	PopupClass     string
	PopupStyle     core.Style
	PopupStyleFunc func() core.Style
	ListClass      string
	ListStyle      core.Style
	ItemClass      string
	ItemStyle      core.Style
	// ItemStyleFunc is each row's style following what it reads: the highlighted row's Focused state among them.
	ItemStyleFunc func() core.Style
	// RenderItem draws row index of what Items returned, a text of its Label when nil.
	RenderItem func(item SuggestItem, index int) core.Node

	// OnOpen and OnClose hear the rows show and go.
	OnOpen, OnClose func()
	// Label names the rows' list for screen readers, apart from the field.
	Label  string
	TestID string
}

SuggestList shows the rows Items returns for a core.Suggest's query in an overlay at the caret, beside the field the Suggest follows, while the query is open and has rows, on the list Select and Combobox open. While it shows and no input method composes in the field, Up and Down move the highlight over the enabled rows and around the ends, Page Up and Page Down by a page, stopping at the ends, Return and Tab accept the highlighted row and Escape closes the query; the field keeps its own keys otherwise. A press accepts a row, on a desktop as the button goes down. The rows take no focus and a tap on them keeps the software keyboard up, so the field keeps the focus, and a highlight the keys move is announced while a screen reader runs. Give the field the combobox role, with Expanded following OnOpen and OnClose. It has no look.

func (SuggestList) Render

func (l SuggestList) Render(cx *core.Scope) core.Node

Render implements core.Node.

type Switch

type Switch struct {
	// Ref and LabelledBy are the control view's, as a core.View's.
	Ref        *core.Ref
	LabelledBy []*core.Ref
	// Invalid is core.View.Invalid, for accessibility and aria-invalid styles.
	Invalid  func() bool
	Checked  func() bool
	Disabled func() bool
	// OnChange receives the value a press asks for, the opposite of
	// Checked's.
	OnChange func(checked bool)

	Class          string
	Style          core.Style
	StyleFunc      func() core.Style
	TrackClass     string
	TrackStyle     core.Style
	TrackStyleFunc func() core.Style
	ThumbClass     string
	ThumbStyle     core.Style
	ThumbStyleFunc func() core.Style
	Children       []core.Node
	Label          string
	LabelFunc      func() string
	Hint           string
	TestID         string
	// HitSlop is how far outside the switch presses count.
	HitSlop core.Edges
	// OnLayout and Tooltip are its view's, as a core.View's.
	OnLayout func(core.Bounds)
	Tooltip  core.Node
}

Switch is on or off and takes effect at once, as a setting. Its parts are a track and a thumb inside it, then its children, the label.

func (Switch) Render

func (s Switch) Render(*core.Scope) core.Node

Render implements core.Node.

type Tab

type Tab struct {
	// Invalid is core.View.Invalid, for accessibility and aria-invalid styles.
	Invalid  func() bool
	Selected func() bool
	Disabled func() bool
	// OnPress runs on every press, the selected tab's included.
	OnPress   func(core.PressEvent)
	Class     string
	Style     core.Style
	StyleFunc func() core.Style
	Children  []core.Node
	Label     string
	// LabelFunc keeps the accessible label bound while the tab stays mounted.
	LabelFunc          func() string
	AccessibilityValue func() core.AccessibilityValue
	Hint               string
	HintFunc           func() string
	TestID             string
	// OnLayout and Tooltip are its view's, as a core.View's.
	OnLayout func(core.Bounds)
	Tooltip  core.Node
}

Tab is one tab of a tab list, in Tabs with the others. The app keeps which is selected and shows its content beside the list.

func (Tab) Render

func (t Tab) Render(cx *core.Scope) core.Node

Render implements core.Node.

type Table

type Table struct {
	Label     string
	Class     string
	Style     core.Style
	StyleFunc func() core.Style
	Children  []core.Node
	TestID    string
	// OnLayout and Tooltip are its view's, as a core.View's.
	OnLayout func(core.Bounds)
	Tooltip  core.Node
}

Table is a static table of the app's own rows and cells, with a table's roles for screen readers and no look of its own, as gpui-base's Table and its parts: TableHeader, TableBody and TableFooter around TableRows of TableHeads and TableCells, and a TableCaption. Label is what screen readers call it; a caption is content the app shows. For many rows, sorting, selection and resizing, DataTable is the table.

func (Table) Render

func (t Table) Render(*core.Scope) core.Node

Render implements core.Node.

type TableBody

type TableBody TablePart

TableBody is a Table's body group: its rows of data.

func (TableBody) Render

func (p TableBody) Render(*core.Scope) core.Node

Render implements core.Node.

type TableCaption

type TableCaption TablePart

TableCaption is content the app shows about a Table: a title, a note under it.

func (TableCaption) Render

func (p TableCaption) Render(*core.Scope) core.Node

Render implements core.Node.

type TableCell

type TableCell TablePart

TableCell is a cell of a TableRow.

func (TableCell) Render

func (p TableCell) Render(*core.Scope) core.Node

Render implements core.Node.

type TableFooter

type TableFooter TablePart

TableFooter is a Table's footer group: totals, a summary row.

func (TableFooter) Render

func (p TableFooter) Render(*core.Scope) core.Node

Render implements core.Node.

type TableHead

type TableHead TablePart

TableHead is a column's header cell, in a TableHeader's row.

func (TableHead) Render

func (p TableHead) Render(*core.Scope) core.Node

Render implements core.Node.

type TableHeader

type TableHeader TablePart

TableHeader is a Table's header group: the rows of column headers.

func (TableHeader) Render

func (p TableHeader) Render(*core.Scope) core.Node

Render implements core.Node.

type TablePart

type TablePart struct {
	Class     string
	Style     core.Style
	StyleFunc func() core.Style
	Children  []core.Node
	TestID    string
	// OnLayout and Tooltip are its view's, as a core.View's.
	OnLayout func(core.Bounds)
	Tooltip  core.Node
}

TablePart holds a part of a Table: Children, styled by Class, Style and StyleFunc.

type TableRow

type TableRow TablePart

TableRow is a row of a Table: its cells side by side.

func (TableRow) Render

func (p TableRow) Render(*core.Scope) core.Node

Render implements core.Node.

type Tabs

type Tabs struct {
	// Invalid is core.View.Invalid, for accessibility and aria-invalid styles.
	Invalid   func() bool
	Class     string
	Style     core.Style
	StyleFunc func() core.Style
	// IndicatorClass and IndicatorStyle draw the list's indicator, a view
	// behind the tabs and absolutely positioned among them, with neither
	// no indicator. Along the list's main axis it spans the selected tab,
	// inside its own margins on that axis, and across it they place it;
	// a change of tab moves it there natively. It is hidden while no tab
	// is selected and takes no presses or focus.
	IndicatorClass string
	IndicatorStyle core.Style
	Children       []core.Node
	Label          string
	LabelFunc      func() string
	TestID         string
	// OnLayout and Tooltip are its view's, as a core.View's.
	OnLayout func(core.Bounds)
	Tooltip  core.Node
}

Tabs is the tab list around a set of Tabs, which assistive technology hears as one list and the keyboard focus as one Tab stop: the selected tab, else the first enabled one. Left and Up, Right and Down move to the previous and next enabled tab, around the ends, Home and End to the first and last, and the tab reached reports a press. It holds no value and no content.

func (Tabs) Render

func (t Tabs) Render(cx *core.Scope) core.Node

Render implements core.Node.

type TimeField

type TimeField struct {
	// Invalid is core.View.Invalid, for accessibility and aria-invalid styles.
	Invalid      func() bool
	Value        func() TimeOfDay
	DefaultValue TimeOfDay
	Precision    TimePrecision
	HourCycle    HourCycle
	Disabled     func() bool
	Label        string

	Class        string
	Style        core.Style
	StyleFunc    func() core.Style
	SegmentClass string
	SegmentStyle core.Style
	// SegmentStyleFunc is each segment's style following what it reads.
	SegmentStyleFunc func() core.Style
	SeparatorClass   string
	SeparatorStyle   core.Style
	RenderSegment    func(TimeFieldSegmentEntry) core.Node

	OnChange func(value TimeOfDay)
	TestID   string
	// OnLayout and Tooltip are its view's, as a core.View's.
	OnLayout func(core.Bounds)
	Tooltip  core.Node
}

TimeField is a time of day edited a segment at a time: the hour, the minute, with TimeSecond the second, with HourCycle12 AM or PM. The keys edit the selected segment and move between them, and a press selects one. The app lays the field out and styles its parts, or draws them.

func (TimeField) Render

func (t TimeField) Render(cx *core.Scope) core.Node

Render implements core.Node.

type TimeFieldSegmentEntry

type TimeFieldSegmentEntry struct {
	Segment TimeSegment
	Value   int
	Label   string
}

TimeFieldSegmentEntry is what RenderSegment draws.

type TimeOfDay

type TimeOfDay struct{ Hour, Minute, Second int }

TimeOfDay is a time of day.

func ParseTimeOfDay

func ParseTimeOfDay(text string) (TimeOfDay, bool)

ParseTimeOfDay reads "09:30" or "09:30:15".

func (TimeOfDay) Format

func (t TimeOfDay) Format(p TimePrecision) string

Format is the time at p.

func (TimeOfDay) String

func (t TimeOfDay) String() string

String is "09:30", or "09:30:15" with seconds.

type TimePrecision

type TimePrecision uint8

TimePrecision is how fine a time is: a DatePicker's zero holds none, and a TimeField's is TimeMinute.

const (
	TimeNone TimePrecision = iota
	TimeMinute
	TimeSecond
)

type TimeSegment

type TimeSegment uint8

TimeSegment is a part of a TimeField.

const (
	SegmentHour TimeSegment = iota
	SegmentMinute
	SegmentSecond
	SegmentPeriod
)

type Toggle

type Toggle struct {
	// Invalid is core.View.Invalid, for accessibility and aria-invalid styles.
	Invalid  func() bool
	Pressed  func() bool
	Disabled func() bool
	// OnChange receives the value a press asks for, the opposite of
	// Pressed's.
	OnChange  func(pressed bool)
	Class     string
	Style     core.Style
	StyleFunc func() core.Style
	Children  []core.Node
	Label     string
	Hint      string
	TestID    string
	// HitSlop and HitSlopFunc are how far outside it presses count.
	HitSlop     core.Edges
	HitSlopFunc func() core.Edges
	// OnLayout and Tooltip are its view's, as a core.View's.
	OnLayout func(core.Bounds)
	Tooltip  core.Node
}

Toggle is a button that is on or off (bold, a favorite, a view option), alone or in a ToggleGroup. It holds no value: a press reports the next one with OnChange and it shows what Pressed returns. Style.Pressed and GroupStyle.Pressed style it and its content while it is on.

func (Toggle) Render

func (t Toggle) Render(cx *core.Scope) core.Node

Render implements core.Node.

type ToggleGroup

type ToggleGroup struct {
	// Invalid is core.View.Invalid, for accessibility and aria-invalid styles.
	Invalid  func() bool
	Disabled func() bool
	// Label names it for assistive technology.
	Label     string
	Class     string
	Style     core.Style
	StyleFunc func() core.Style
	Children  []core.Node
	TestID    string
	// OnLayout and Tooltip are its view's, as a core.View's.
	OnLayout func(core.Bounds)
	Tooltip  core.Node
}

ToggleGroup is the toolbar around a set of Toggles: assistive technology hears one toolbar, the keyboard focus one Tab stop, at the first pressed toggle, else the first enabled one. The arrows move the focus around the ends, Home and End to the first and last, without pressing, and Space and Return press. It holds no value; the app keeps which are pressed, any number of them or exactly one. Inside a Toolbar it is one of the toolbar's groups, whose stop it shares.

func (ToggleGroup) Render

func (t ToggleGroup) Render(cx *core.Scope) core.Node

Render implements core.Node.

type Toolbar

type Toolbar struct {
	// Axis is the way its items run, read as it is made.
	Axis Axis
	// Disabled disables every item, whatever its own.
	Disabled  func() bool
	Class     string
	Style     core.Style
	StyleFunc func() core.Style
	Children  []core.Node
	Label     string
	TestID    string
	// OnLayout and Tooltip are its view's, as a core.View's.
	OnLayout func(core.Bounds)
	Tooltip  core.Node
}

Toolbar is a bar of controls: assistive technology hears one toolbar, each control still an element of its own, and the keyboard focus one Tab stop, the item it last left, else the first enabled one. The arrows along Axis move the focus around the ends, Home and End to the first and last, without pressing, and Space and Return press. Its items are the Buttons, Toggles and Links inside it, those of its ToolbarGroups and ToggleGroups too; other controls stay stops of their own and keep their arrows. It lays its children out along Axis and has no look.

func (Toolbar) Render

func (t Toolbar) Render(cx *core.Scope) core.Node

Render implements core.Node.

type ToolbarGroup

type ToolbarGroup struct {
	// Disabled disables every item of the group, whatever its own.
	Disabled  func() bool
	Class     string
	Style     core.Style
	StyleFunc func() core.Style
	Children  []core.Node
	Label     string
	TestID    string
	// OnLayout and Tooltip are its view's, as a core.View's.
	OnLayout func(core.Bounds)
	Tooltip  core.Node
}

ToolbarGroup is a run of related items in a Toolbar (undo and redo): assistive technology hears the group and its label; its items are the toolbar's, and it lays them out along the toolbar's Axis.

func (ToolbarGroup) Render

func (t ToolbarGroup) Render(cx *core.Scope) core.Node

Render implements core.Node.

type ToolbarSeparator

type ToolbarSeparator struct {
	Class     string
	Style     core.Style
	StyleFunc func() core.Style
	TestID    string
}

ToolbarSeparator is a line between runs of a Toolbar's items, a view the app styles, never a stop of the keyboard focus.

func (ToolbarSeparator) Render

func (t ToolbarSeparator) Render(*core.Scope) core.Node

Render implements core.Node.

type Tooltip

type Tooltip struct {
	Open         func() bool
	DefaultOpen  bool
	OnOpenChange func(open bool, reason Reason)
	OnOpen       func()
	OnClose      func()

	// Placement defaults to above the trigger.
	Placement core.Placement
	Align     core.Align
	// Offset and Margin are 4 when 0.
	Offset, Margin core.Points
	// Delay before it opens on hover; half a second when 0.
	Delay    time.Duration
	Disabled bool

	Class          string // the trigger's
	Style          core.Style
	StyleFunc      func() core.Style
	PopupClass     string
	PopupStyle     core.Style
	PopupStyleFunc func() core.Style
	// StartingStyle and EndingStyle are the popup's, as Popover's.
	StartingClass string
	StartingStyle core.Style
	EndingClass   string
	EndingStyle   core.Style
	Trigger       core.Node
	Children      []core.Node
	TestID        string
}

Tooltip shows a hint beside its trigger while the pointer rests on it (on desktops), at once while the focus the keyboard moved is on it or inside it (Tab, an arrow, a shortcut, the app's Focus after a key), in every idiom, until it leaves or Escape is pressed, or while the app opens it, the only other way on touch screens. A press that focuses the trigger leaves it to the pointer, as focus-visible: does. It never takes the pointer. A View's Tooltip is the shorter form, with the defaults.

func (Tooltip) Hint

func (t Tooltip) Hint(cx *core.Scope, anchor *core.Ref) (core.Node, func(core.HintChange))

Hint implements core.HintTooltip: given as a view's Tooltip, the tooltip shows against that view, Trigger left out.

func (Tooltip) Render

func (t Tooltip) Render(cx *core.Scope) core.Node

Render implements core.Node.

type Tree

type Tree struct {
	// Invalid is core.View.Invalid, for accessibility and aria-invalid styles.
	Invalid func() bool
	Items   func() []TreeItem
	// Expanded makes the expanded items controlled.
	Expanded        func() []string
	DefaultExpanded []string
	// Selected makes the selected item controlled, nil for none.
	Selected        func() *string
	DefaultSelected string
	Disabled        func() bool
	// Reveal springs the rows after an item to their places as it expands
	// and collapses, as Collapsible's Reveal does.
	Reveal bool
	// Label is what assistive technology calls the tree.
	Label string
	// ListClass and ListStyle are the scrolled rows', whose padding is the content's. ListStyleFunc merges over ListStyle whenever what it reads changes, restyling the rows in place: their scroll offset, the keyboard focus and keys stay.
	ListClass     string
	ListStyle     core.Style
	ListStyleFunc func() core.Style
	ItemClass     string
	ItemStyle     core.Style
	// ItemStyleFunc is each row's style following what it reads.
	ItemStyleFunc func() core.Style
	// RenderItem draws an item's row, for the rows in view; Row does with
	// what the row follows, so its views stay as the cell shows other
	// items.
	RenderItem func(entry TreeEntry) core.Node
	Row        func(cx *core.Scope, row TreeRow) core.Node
	// EstimatedSize is a row's expected height, 20 when 0; Empty shows
	// while there are no items.
	EstimatedSize core.Points
	Empty         core.Node
	// ListRef is the list of rows', for the app's scrolls.
	ListRef *core.Ref
	// OnExpandedChange receives the expanded ids as they would be, then
	// OnExpand or OnCollapse the item.
	OnExpandedChange func(expanded []string)
	OnSelectedChange func(selected string)
	OnExpand         func(id string)
	OnCollapse       func(id string)
	// OnAction hears Return on a selected leaf, or a double press on any
	// item, after the press's own events.
	OnAction func(id string)
	// Ref's Focus and RevealItem are the tree's.
	Ref       *TreeRef
	Class     string
	Style     core.Style
	StyleFunc func() core.Style
	TestID    string
	// OnLayout and Tooltip are its view's, as a core.View's.
	OnLayout func(core.Bounds)
	Tooltip  core.Node
}

Tree is items that hold items, virtualized: only the rows in view are made, and the children of a collapsed item never are. The expanded items are Expanded and OnExpandedChange, or its own from DefaultExpanded, the selected one Selected and OnSelectedChange, or its own. A press selects a row and expands or collapses a folder; a double press acts on it (OnAction). It is one Tab stop: Up and Down move the selection between the rows shown, past disabled items, around the ends, Right expands a folder and then moves to its first enabled child, Left collapses it and then moves to its parent, Home and End go to the first and last row, Return and Space expand or collapse a folder, Return acts on a leaf, and letters select by typeahead. It looks like nothing: the app sizes it and styles the rows (ItemClass) or draws them (RenderItem).

func (Tree) Render

func (t Tree) Render(cx *core.Scope) core.Node

Render implements core.Node.

type TreeEntry

type TreeEntry struct {
	ID, Label string
	// Depth is 0 at the top, 1 under a top item.
	Depth    int
	Folder   bool
	Disabled bool
}

TreeEntry is an item's row as RenderItem draws it: what the item is, never its state, which is the row's own.

type TreeItem

type TreeItem struct {
	// ID identifies it in Expanded, Selected and the events: unique in the
	// tree, never its label.
	ID string
	// Label is what its row shows, what assistive technology says and
	// what typeahead matches.
	Label string
	// Children make it a folder that expands and collapses.
	Children []TreeItem
	// Disabled can't be selected, expanded or collapsed by the user.
	Disabled bool
}

TreeItem is an item of a Tree, with the items under it.

type TreeRef

type TreeRef struct {
	// contains filtered or unexported fields
}

TreeRef is a Tree's ref.

func (*TreeRef) Focus

func (r *TreeRef) Focus()

Focus takes the keyboard focus.

func (*TreeRef) RevealItem

func (r *TreeRef) RevealItem(id string)

RevealItem brings the item of id into view: the items above it are expanded, as OnExpandedChange and OnExpand report, and its row is scrolled to once it shows.

type TreeRow

type TreeRow struct {
	Row core.ListRow
	// Entry is what the item is.
	Entry func() TreeEntry
	// Expanded says it is expanded, and Toggle expands or collapses it.
	Expanded func() bool
	Toggle   func()
	// TakeKeys has the keys go on from a press the row's content took, as
	// from a press on the row.
	TakeKeys func()
}

TreeRow is the item a cell of a Tree shows, as signals.

Directories

Path Synopsis
Package camera is a plane the user pans and zooms, such as a design canvas or a board of diagrams: the app lays its content out at its own size on the plane, and the view shows it through a camera that moves and scales it on the platform's frame clock.
Package camera is a plane the user pans and zooms, such as a design canvas or a board of diagrams: the app lays its content out at its own size on the plane, and the view shows it through a camera that moves and scales it on the platform's frame clock.
Package commitgraph lays out and draws a Git history's revision graph: the lanes commits sit in and the lines joining them to their parents.
Package commitgraph lays out and draws a Git history's revision graph: the lanes commits sit in and the lines joining them to their parents.
Package diagram draws Mermaid diagrams natively, with limu (github.com/firede/limu), which reads every diagram type Pele, the Obsidian team's Mermaid renderer, draws and lays it out: flowcharts, sequence, class, state and entity relationship diagrams, Gantt charts, pies, mind maps, timelines and more.
Package diagram draws Mermaid diagrams natively, with limu (github.com/firede/limu), which reads every diagram type Pele, the Obsidian team's Mermaid renderer, draws and lays it out: flowcharts, sequence, class, state and entity relationship diagrams, Gantt charts, pies, mind maps, timelines and more.
locales
Package locales says what base/diagram's diagrams read as, to assistive technology, in the language the app shows.
Package locales says what base/diagram's diagrams read as, to assistive technology, in the language the app shows.
Package diff is base's DiffView, a port of NSH's: the changes between two texts, or the files of a patch, side by side or one over the other, the words changed within lines marked, the unchanged lines between changes collapsed into separators that expand, and the text colored by the Editor's highlighting.
Package diff is base's DiffView, a port of NSH's: the changes between two texts, or the files of a patch, side by side or one over the other, the words changed within lines marked, the unchanged lines between changes collapsed into separators that expand, and the text colored by the Editor's highlighting.
Package dragdrop transfers application values between views in one window.
Package dragdrop transfers application values between views in one window.
Package editor is base's code editor, a port of NSH's Editor (and GPUI Kit's): syntax highlighting, line numbers, several carets, folding, soft wrap, find and replace, diagnostics and decorations, completion and go to definition, with the keys of code editors.
Package editor is base's code editor, a port of NSH's Editor (and GPUI Kit's): syntax highlighting, line numbers, several carets, folding, soft wrap, find and replace, diagnostics and decorations, completion and go to definition, with the keys of code editors.
Package flow draws a directed diagram, such as a workflow, a dependency graph or a plan of tasks, and lays it out automatically: nodes fall into ranks along the edges' direction, ranks are ordered to avoid crossings and edges run between them as orthogonal lines.
Package flow draws a directed diagram, such as a workflow, a dependency graph or a plan of tasks, and lays it out automatically: nodes fall into ranks along the edges' direction, ranks are ordered to avoid crossings and edges run between them as orthogonal lines.
Package formula typesets math, written in TeX or Typst, with Untie (github.com/caelyreth/untie), and draws it in the font size and the text color it inherits: inline, on its text's baseline, or as a display formula of its own.
Package formula typesets math, written in TeX or Typst, with Untie (github.com/caelyreth/untie), and draws it in the font size and the text color it inherits: inline, on its text's baseline, or as a display formula of its own.
locales
Package locales says what base/formula's formulas read as, to assistive technology, in the language the app shows.
Package locales says what base/formula's formulas read as, to assistive technology, in the language the app shows.
internal
diagramlayout
Package diagramlayout carries a diagram block's viewport width across its text attachment, which otherwise lays out in unbounded space.
Package diagramlayout carries a diagram block's viewport width across its text attachment, which otherwise lays out in unbounded space.
emoji
Package emoji holds the Unicode emoji catalog and multi-language CLDR names and keywords for base.EmojiPicker, generated from emojibase-data by go generate (internal/gen).
Package emoji holds the Unicode emoji catalog and multi-language CLDR names and keywords for base.EmojiPicker, generated from emojibase-data by go generate (internal/gen).
emoji/internal/gen command
Command gen writes emoji.bin, the Unicode emoji catalog and multi-language CLDR names and keywords for package base/internal/emoji, from a pinned release of emojibase-data: go generate ./base/internal/emoji runs it.
Command gen writes emoji.bin, the Unicode emoji catalog and multi-language CLDR names and keywords for package base/internal/emoji, from a pinned release of emojibase-data: go generate ./base/internal/emoji runs it.
mathlayout
Package mathlayout carries a display formula's viewport across its text attachment.
Package mathlayout carries a display formula's viewport across its text attachment.
parts
Package parts is what base's components share to style their parts.
Package parts is what base's components share to style their parts.
sheet
Package sheet is the sheet base's dialogs, menus and docks come up as: a panel from an edge of the window over a fading backdrop.
Package sheet is the sheet base's dialogs, menus and docks come up as: a panel from an edge of the window over a fading backdrop.
syntax
Package syntax is what code highlighting in base shares: the kinds of tokens, chroma's token types mapped onto them and NSH's palette, Allsum's, in light and dark.
Package syntax is what code highlighting in base shares: the kinds of tokens, chroma's token types mapped onto them and NSH's palette, Allsum's, in light and dark.
window
Package window is the rows a virtualized view of base makes: a table's, an editor's.
Package window is the rows a virtualized view of base makes: a table's, an editor's.
Package locales says base's own messages in the language the app shows.
Package locales says base's own messages in the language the app shows.
Package richeditor is a rich text editor after ProseMirror's architecture (NSH's RichEditor, nsh/docs/dev/rich-editor.md): a document whose structure a Schema defines, changes as invertible, mappable steps grouped into transactions, immutable states, commands and plugins.
Package richeditor is a rich text editor after ProseMirror's architecture (NSH's RichEditor, nsh/docs/dev/rich-editor.md): a document whose structure a Schema defines, changes as invertible, mappable steps grouped into transactions, immutable states, commands and plugins.
Package terminal is a terminal for NSGo apps: a View that runs the user's shell, or any program, in a pseudo-terminal, with Ghostty's terminal emulator, libghostty-vt, loaded at run time with no cgo.
Package terminal is a terminal for NSGo apps: a View that runs the user's shell, or any program, in a pseudo-terminal, with Ghostty's terminal emulator, libghostty-vt, loaded at run time with no cgo.
internal/library
Package library finds libghostty-vt for the terminal: the file $NSGO_GHOSTTY_VT names, the one the nsgo tool put into the app, or on desktops the build for the platform the package embeds, written once into the user's cache.
Package library finds libghostty-vt for the terminal: the file $NSGO_GHOSTTY_VT names, the one the nsgo tool put into the app, or on desktops the build for the platform the package embeds, written once into the user's cache.
internal/pty
Package pty runs processes in pseudo-terminals, in pure Go: /dev/ptmx on macOS and Linux, ConPTY on Windows.
Package pty runs processes in pseudo-terminals, in pure Go: /dev/ptmx on macOS and Linux, ConPTY on Windows.
internal/vt
Package vt binds libghostty-vt, Ghostty's terminal emulator, through purego on native targets and an embedded WebAssembly module in a browser: no cgo.
Package vt binds libghostty-vt, Ghostty's terminal emulator, through purego on native targets and an embedded WebAssembly module in a browser: no cgo.
locales
Package locales says the terminal's own messages in the language the app shows.
Package locales says the terminal's own messages in the language the app shows.
Package textview shows a document of Markdown or the app's own blocks with the primitives: texts with spans, views, scroll views and images.
Package textview shows a document of Markdown or the app's own blocks with the primitives: texts with spans, views, scroll views and images.
highlight
Package highlight colors the code blocks of a TextView with chroma's lexers and NSH's reading palette, light and dark.
Package highlight colors the code blocks of a TextView with chroma's lexers and NSH's reading palette, light and dark.
locales
Package locales says the text view's own messages in the language the app shows.
Package locales says the text view's own messages in the language the app shows.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL