Documentation
¶
Overview ¶
Package mygoui provides native MyGo components following coss ui.
Apply theme.Apply at the start of a view. Callers own model values and widget state per window; constructors consume a build-scoped *ui.Context and return build-scoped ui.Element values. Retain ui.Handle for persistent focus and geometry, never elements or custom parts from an earlier build.
Composition uses typed options, content callbacks and keyed collections. Related controls live in form, navigation, overlay, date, data and other family packages. A card composes ordinary native children:
mygoui.Card(c, mygoui.CardOptions{}, func() {
mygoui.CardHeader(c, func() {
mygoui.CardTitle(c, "Project")
})
mygoui.CardContent(c, func() {
mygoui.Paragraph(c, "Ready to deploy", false)
})
})
Colors are read live through theme.Colors. Host preferences configure semantic roles, radii and body/heading/mono families; applications register their own fonts explicitly. Importing this library does not initialize an application or start I/O or background jobs.
ScrollArea wraps native scrolling. ScrollFade provides subtree alpha masking, shadow and opaque-surface edge treatments through native paint and effects. docs/components.md maps the coss catalog and native limits, docs/theme.md describes customization, and docs/references.md records source provenance.
Index ¶
- func Alert(c *ui.Context, o AlertOptions) ui.Element
- func Avatar(c *ui.Context, o AvatarOptions) ui.Element
- func AvatarGroup(c *ui.Context, o AvatarGroupOptions) ui.Element
- func Badge(c *ui.Context, o BadgeOptions) ui.Element
- func BadgeAnchor(c *ui.Context, o BadgeAnchorOptions, body func()) ui.Element
- func Button(c *ui.Context, o ButtonOptions) ui.Element
- func ButtonGroup(c *ui.Context, o ButtonGroupOptions, buttons ...ButtonOptions) ui.Element
- func Card(c *ui.Context, o CardOptions, body func()) ui.Element
- func CardContent(c *ui.Context, body func()) ui.Element
- func CardDescription(c *ui.Context, text string) ui.Element
- func CardFooter(c *ui.Context, body func()) ui.Element
- func CardFrame(c *ui.Context, o CardFrameOptions, body func()) ui.Element
- func CardFrameDescription(c *ui.Context, text string) ui.Element
- func CardFrameFooter(c *ui.Context, body func()) ui.Element
- func CardFrameHeader(c *ui.Context, body func()) ui.Element
- func CardFrameTitle(c *ui.Context, title string) ui.Element
- func CardHeader(c *ui.Context, body func()) ui.Element
- func CardTitle(c *ui.Context, text string) ui.Element
- func Chip(c *ui.Context, o ChipOptions) ui.Element
- func CloseButton(c *ui.Context, o CloseButtonOptions) ui.Element
- func Code(c *ui.Context, text string) ui.Element
- func EmptyState(c *ui.Context, o EmptyStateOptions) ui.Element
- func Frame(c *ui.Context, o FrameOptions, body func()) ui.Element
- func FrameDescription(c *ui.Context, text string) ui.Element
- func FrameFooter(c *ui.Context, body func()) ui.Element
- func FrameHeader(c *ui.Context, body func()) ui.Element
- func FramePanel(c *ui.Context, body func()) ui.Element
- func FrameTitle(c *ui.Context, title string) ui.Element
- func Group(c *ui.Context, o GroupOptions, items ...GroupItem) ui.Element
- func GuideCard(c *ui.Context, o GuideCardOptions) ui.Element
- func Header(c *ui.Context, o HeaderOptions) ui.Element
- func Heading(c *ui.Context, level int, text string) ui.Element
- func Image(c *ui.Context, o ImageOptions) ui.Element
- func Kbd(c *ui.Context, o KbdOptions) ui.Element
- func KbdGroup(c *ui.Context, o KbdOptions) ui.Element
- func Link(c *ui.Context, o LinkOptions) ui.Element
- func LinkButton(c *ui.Context, o LinkButtonOptions) ui.Element
- func ListGroup(c *ui.Context, o ListGroupOptions, body func()) ui.Element
- func ListGroupItem(c *ui.Context, o ListGroupItemOptions) ui.Element
- func Meter(c *ui.Context, o MeterOptions) ui.Element
- func Paragraph(c *ui.Context, text string, small bool) ui.Element
- func PressableFeedback(c *ui.Context, o PressableFeedbackOptions, body func()) ui.Element
- func ProgressBar(c *ui.Context, o ProgressOptions) ui.Element
- func ProgressCircle(c *ui.Context, o ProgressCircleOptions) ui.Element
- func Prose(c *ui.Context, body func()) ui.Element
- func ResizablePanel(c *ui.Context, o ResizablePanelOptions, body func()) ui.Element
- func Result(c *ui.Context, o ResultOptions) ui.Element
- func ScrollArea(c *ui.Context, state *ui.ScrollState, o ScrollAreaOptions, body func()) ui.Element
- func ScrollFade(c *ui.Context, viewport ui.Element, state *ui.ScrollState, o ScrollFadeOptions) ui.Element
- func ScrollShadow(c *ui.Context, s *ui.ScrollState, o ScrollShadowOptions, body func()) ui.Element
- func Separator(c *ui.Context, o SeparatorOptions) ui.Element
- func Sidebar(c *ui.Context, o SidebarOptions) ui.Element
- func Skeleton(c *ui.Context, o SkeletonOptions) ui.Element
- func SkeletonGroup(c *ui.Context, o SkeletonGroupOptions, body func()) ui.Element
- func Spinner(c *ui.Context, o SpinnerOptions) ui.Element
- func StatusIcon(color StatusColor) *ui.SVG
- func Surface(c *ui.Context, o SurfaceOptions, body func()) ui.Element
- func Tag(c *ui.Context, o TagOptions) ui.Element
- func TagGroup(c *ui.Context, o TagGroupOptions, tags []TagOptions) ui.Element
- func ToggleButton(c *ui.Context, o ToggleButtonOptions) ui.Element
- func ToggleButtonGroup(c *ui.Context, o ToggleButtonGroupOptions, buttons ...ToggleButtonOptions) ui.Element
- func Typography(c *ui.Context, text string, o TypographyOptions) ui.Element
- type AlertOptions
- type Align
- type AvatarGroupOptions
- type AvatarOptions
- type AvatarSize
- type BadgeAnchorOptions
- type BadgeOptions
- type BadgePlacement
- type BadgeSize
- type BadgeVariant
- type ButtonAlign
- type ButtonGroupOptions
- type ButtonGroupOrientation
- type ButtonOptions
- type ButtonVariant
- type CardFrameOptions
- type CardOptions
- type CardVariant
- type ChipOptions
- type ChipSize
- type ChipVariant
- type CloseButtonOptions
- type EmptyStateOptions
- type FlyoutHost
- type FrameOptions
- type GroupItem
- type GroupOptions
- type GuideCardOptions
- type HeaderOptions
- type ImageFit
- type ImageOptions
- type ImageStatus
- type IndicatorColor
- type KbdOptions
- type LinkButtonOptions
- type LinkOptions
- type ListGroupItemOptions
- type ListGroupOptions
- type MeterOptions
- type Orientation
- type PanelSide
- type Placement
- type PressableFeedbackOptions
- type ProgressCircleOptions
- type ProgressOptions
- type ProgressSize
- type ResizablePanelOptions
- type ResultOptions
- type ScrollAreaOptions
- type ScrollAxis
- type ScrollFadeEdges
- type ScrollFadeMode
- type ScrollFadeOptions
- type ScrollShadowOptions
- type ScrollShadowOrientation
- type SeparatorColor
- type SeparatorOptions
- type Side
- type SidebarGroupOptions
- type SidebarItemOptions
- type SidebarOptions
- type SkeletonAnimation
- type SkeletonGroupOptions
- type SkeletonOptions
- type SpinnerOptions
- type SpinnerSize
- type StatusColor
- type StatusPalette
- type SurfaceOptions
- type SurfaceVariant
- type TagGroupOptions
- type TagGroupState
- type TagOptions
- type TagSelection
- type TagSize
- type TagVariant
- type ToggleButtonGroupOptions
- type ToggleButtonOptions
- type ToggleButtonVariant
- type TypographyOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Alert ¶
func Alert(c *ui.Context, o AlertOptions) ui.Element
Alert renders a status callout with an optional icon and action. It exposes ui.RoleStatus; MyGo does not have a separate alert role.
func Avatar ¶
func Avatar(c *ui.Context, o AvatarOptions) ui.Element
Avatar shows an already-loaded image or initials. It never fetches.
func AvatarGroup ¶
func AvatarGroup(c *ui.Context, o AvatarGroupOptions) ui.Element
AvatarGroup overlaps avatars by 30% of the group size and optionally adds background-colored rings. A Total above the displayed count adds overflow.
func Badge ¶
func Badge(c *ui.Context, o BadgeOptions) ui.Element
Badge renders a compact COSS status label with a size-dependent minimum.
func BadgeAnchor ¶
func BadgeAnchor(c *ui.Context, o BadgeAnchorOptions, body func()) ui.Element
BadgeAnchor places a badge at one corner without changing the content's layout. The badge can extend beyond the box and follows ancestor clipping.
func Button ¶
func Button(c *ui.Context, o ButtonOptions) ui.Element
Button builds a coss action on MyGo's native focusable button base. The pending spinner overlays invisible content, preserving the button width.
func ButtonGroup ¶
func ButtonGroup(c *ui.Context, o ButtonGroupOptions, buttons ...ButtonOptions) ui.Element
ButtonGroup builds buttons with only the outer corners rounded, as coss ui does. The caller supplies complete button options, avoiding an ambient context and keeping each action independently focusable. Separators paint a half-height divider at each shared edge instead of taking layout width. Adjacent outline edges are removed, and buttons do not scale on press.
func Card ¶
func Card(c *ui.Context, o CardOptions, body func()) ui.Element
Card is a bordered rounded surface. Each section owns its padding.
func CardContent ¶
CardContent grows to fill the card, with horizontal padding and a 4 DIP gap. Standalone content can set vertical padding on the returned element.
func CardDescription ¶
CardDescription renders coss ui's 14/20 muted card description.
func CardFooter ¶
CardFooter aligns actions in a wrapping row.
func CardFrame ¶
func CardFrame(c *ui.Context, o CardFrameOptions, body func()) ui.Element
CardFrame builds a muted, bordered container for cards and frame sections.
func CardFrameDescription ¶
CardFrameDescription renders secondary frame text.
func CardFrameFooter ¶
CardFrameFooter hosts frame-level content below its cards.
func CardFrameHeader ¶
CardFrameHeader groups frame metadata above its cards.
func CardFrameTitle ¶
CardFrameTitle renders a compact semibold frame title.
func CardHeader ¶
CardHeader groups a title and description.
func Chip ¶
func Chip(c *ui.Context, o ChipOptions) ui.Element
Chip renders a compact status label. Its icon follows the label size.
func CloseButton ¶
func CloseButton(c *ui.Context, o CloseButtonOptions) ui.Element
CloseButton is a 24 DIP dismiss button with a native focus ring and an animated hover face.
func EmptyState ¶
func EmptyState(c *ui.Context, o EmptyStateOptions) ui.Element
EmptyState centers an icon, title, description and optional recovery action. With no content it shows the localized empty placeholder.
func Frame ¶
func Frame(c *ui.Context, o FrameOptions, body func()) ui.Element
Frame builds coss's muted outer frame. Panels remain independently composable.
func FrameDescription ¶
FrameDescription renders the frame's secondary text.
func FrameFooter ¶
FrameFooter hosts frame-level actions outside its panels.
func FrameHeader ¶
FrameHeader groups a frame's title and description.
func FramePanel ¶
FramePanel builds a bordered panel; callers can override native layout on return.
func FrameTitle ¶
FrameTitle renders a compact semibold frame title.
func GuideCard ¶
func GuideCard(c *ui.Context, o GuideCardOptions) ui.Element
GuideCard is a card introducing a feature: cover, title, description, actions and a close button.
func Header ¶
func Header(c *ui.Context, o HeaderOptions) ui.Element
Header is a small muted section heading used by menus and lists.
func Image ¶
func Image(c *ui.Context, o ImageOptions) ui.Element
Image shows an already-decoded picture in a rounded box, a skeleton while the caller loads it and a fallback when loading failed or there is no picture. It never fetches or decodes.
func Kbd ¶
func Kbd(c *ui.Context, o KbdOptions) ui.Element
Kbd renders one coss ui keycap. Multiple keys form a chord separated by a thin gap, with the concatenated chord as its accessible text.
func KbdGroup ¶
func KbdGroup(c *ui.Context, o KbdOptions) ui.Element
KbdGroup renders each key in a chord as a separate keycap.
func Link ¶
func Link(c *ui.Context, o LinkOptions) ui.Element
Link is an inline, keyboard-focusable action. Hover, press and keyboard focus underline the label, and the trailing icon fades from 60% to full opacity. The underline is painted over the native text so the static layout does not shift. URL opening remains application work; the library performs no I/O.
func LinkButton ¶
func LinkButton(c *ui.Context, o LinkButtonOptions) ui.Element
LinkButton is a text action with no hover background, padding or minimum height. It uses native button activation and focus.
func ListGroup ¶
func ListGroup(c *ui.Context, o ListGroupOptions, body func()) ui.Element
ListGroup is a rounded surface containing related rows.
func ListGroupItem ¶
func ListGroupItem(c *ui.Context, o ListGroupItemOptions) ui.Element
ListGroupItem renders a 16 DIP padded row with an optional chevron and real native activation. Prefix and suffix callbacks own their layout.
func Meter ¶
func Meter(c *ui.Context, o MeterOptions) ui.Element
Meter renders a coss ui meter with its label and output.
func PressableFeedback ¶
func PressableFeedback(c *ui.Context, o PressableFeedbackOptions, body func()) ui.Element
PressableFeedback animates a 0.985 press scale and fades its hover and pressed surfaces. It does not draw a ripple.
func ProgressBar ¶
func ProgressBar(c *ui.Context, o ProgressOptions) ui.Element
ProgressBar draws a linear determinate or indeterminate indicator, with an optional label and value output above the track.
func ProgressCircle ¶
func ProgressCircle(c *ui.Context, o ProgressCircleOptions) ui.Element
ProgressCircle draws a determinate ring or an indeterminate native spinner and exposes its progress through native accessibility semantics.
func ResizablePanel ¶
func ResizablePanel(c *ui.Context, o ResizablePanelOptions, body func()) ui.Element
ResizablePanel sizes body along one axis and lets the user move the edge on Side by pointer or keyboard: arrows step 16 DIPs, Home and End go to Min and Max, and on a collapsible panel Enter or a double click toggles it. The cross axis stretches to the parent.
func Result ¶
func Result(c *ui.Context, o ResultOptions) ui.Element
Result centers a status icon, title, description, actions and optional detail. Text and actions are an EmptyState; the icon carries the status.
func ScrollArea ¶
func ScrollArea(c *ui.Context, state *ui.ScrollState, o ScrollAreaOptions, body func()) ui.Element
ScrollArea retains native scrolling, focus, wheel and scrollbar behavior.
func ScrollFade ¶
func ScrollFade(c *ui.Context, viewport ui.Element, state *ui.ScrollState, o ScrollFadeOptions) ui.Element
ScrollFade decorates any native viewport tracking state, including existing application scroll views. It preserves native hit testing and adds no timer. MaskFade uses an effect on the viewport, replacing any existing effect; MyGo draws oversized effect layers normally and excludes embedded web views.
func ScrollShadow ¶
func ScrollShadow(c *ui.Context, s *ui.ScrollState, o ScrollShadowOptions, body func()) ui.Element
ScrollShadow wraps caller-owned content in a native scroll viewport and fades both edges in proportion to the remaining scroll distance.
func Separator ¶
func Separator(c *ui.Context, o SeparatorOptions) ui.Element
Separator draws a decorative 1 DIP rule. Vertical rules stretch to the row height.
func Sidebar ¶
func Sidebar(c *ui.Context, o SidebarOptions) ui.Element
Sidebar builds a scrollable navigation sidebar with a native collapse toggle and individually focusable navigation actions. The caller owns the selected ID, collapse state and the work performed by an activation.
func Skeleton ¶
func Skeleton(c *ui.Context, o SkeletonOptions) ui.Element
Skeleton paints a muted placeholder with a paint-only shimmer or pulse. Reduced motion and high contrast keep it still.
func SkeletonGroup ¶
func SkeletonGroup(c *ui.Context, o SkeletonGroupOptions, body func()) ui.Element
SkeletonGroup lays out placeholders and animates the entire rendered subtree together. Skeletons inside a group should use SkeletonNone. While animated, MyGo excludes embedded web views and skips the effect if either layer side exceeds 8192 pixels.
func Spinner ¶
func Spinner(c *ui.Context, o SpinnerOptions) ui.Element
Spinner uses MyGo's maintained arc indicator. The toolkit owns frame scheduling and reduced-motion poses. The native arc approximates COSS's rotating loading icon.
func StatusIcon ¶
func StatusIcon(color StatusColor) *ui.SVG
StatusIcon is the coss icon for a status: info, check, triangle alert, or circle alert for danger.
func Surface ¶
func Surface(c *ui.Context, o SurfaceOptions, body func()) ui.Element
Surface paints a theme surface and exposes the matching foreground.
func Tag ¶
func Tag(c *ui.Context, o TagOptions) ui.Element
Tag renders one tag. Most callers use TagGroup; Tag is available for a standalone label.
func TagGroup ¶
func TagGroup(c *ui.Context, o TagGroupOptions, tags []TagOptions) ui.Element
TagGroup lays out removable, optionally selectable tags. Tags stay smaller than buttons and expose native focus and removal actions.
func ToggleButton ¶
func ToggleButton(c *ui.Context, o ToggleButtonOptions) ui.Element
ToggleButton is a focusable native toggle whose selected paint follows the caller's bool. It is not a radio: each button owns its state.
func ToggleButtonGroup ¶
func ToggleButtonGroup(c *ui.Context, o ToggleButtonGroupOptions, buttons ...ToggleButtonOptions) ui.Element
ToggleButtonGroup lays out caller-owned toggle states. Each option carries its own Selected pointer, so single- and multi-select are both explicit Go state rather than an ambient group context. Outline-only groups join their items; other groups use independent rounded items with a 2 DIP gap.
func Typography ¶
Typography renders a semantic theme type role. Headings expose a heading role and level to assistive technology; body and code remain ordinary text.
Types ¶
type AlertOptions ¶
type AlertOptions struct {
Title, Description string
Status StatusColor
Icon *ui.SVG
// ShowIcon uses the status glyph when Icon is nil.
ShowIcon bool
Action func()
}
AlertOptions configures a coss ui status callout.
type AvatarGroupOptions ¶
type AvatarGroupOptions struct {
Size AvatarSize
Overlap float32
Ring bool
Grid bool
Total int
Avatars []AvatarOptions
}
AvatarGroupOptions configures an avatar stack or grid.
type AvatarOptions ¶
type AvatarOptions struct {
Image ui.ImageSource
Name string
Fallback string
Size AvatarSize
Soft bool
Ring bool
Color StatusColor
Badge func()
}
AvatarOptions configures a caller-loaded avatar. Name is the accessible name; Fallback overrides generated initials.
type AvatarSize ¶
type AvatarSize uint8
AvatarSize selects a native avatar size.
const ( AvatarMedium AvatarSize = iota AvatarSmall AvatarLarge )
type BadgeAnchorOptions ¶
type BadgeAnchorOptions struct {
Placement BadgePlacement
Badge BadgeOptions
}
BadgeAnchorOptions places a badge over caller content.
type BadgeOptions ¶
type BadgeOptions struct {
Label string
Variant BadgeVariant
Size BadgeSize
Icon *ui.SVG
}
BadgeOptions configures a coss ui badge.
type BadgePlacement ¶
type BadgePlacement uint8
BadgePlacement is the corner used by BadgeAnchor.
const ( BadgeTopRight BadgePlacement = iota BadgeTopLeft BadgeBottomRight BadgeBottomLeft )
type BadgeVariant ¶
type BadgeVariant uint8
BadgeVariant selects a coss ui badge surface treatment.
const ( BadgePrimary BadgeVariant = iota BadgeSecondary BadgeOutline BadgeDestructive BadgeError BadgeInfo BadgeSuccess BadgeWarning )
type ButtonAlign ¶
type ButtonAlign uint8
ButtonAlign places button content.
const ( ButtonAlignCenter ButtonAlign = iota ButtonAlignStart ButtonAlignEnd )
type ButtonGroupOptions ¶
type ButtonGroupOptions struct {
Orientation ButtonGroupOrientation
FullWidth bool
Separators bool
}
ButtonGroupOptions controls a joined set of coss ui buttons.
type ButtonGroupOrientation ¶
type ButtonGroupOrientation uint8
ButtonGroupOrientation selects the join axis.
const ( GroupHorizontal ButtonGroupOrientation = iota GroupVertical )
type ButtonOptions ¶
type ButtonOptions struct {
Label string
Icon *ui.SVG
EndIcon *ui.SVG
Variant ButtonVariant
Size theme.ButtonSize
IconOnly bool
FullWidth bool
Loading bool
Disabled bool
OnClick func()
Handle *ui.Handle
Tooltip string
Content func()
// Align overrides the centered label placement, for navigation rows and
// other left-aligned actions.
Align ButtonAlign
// Corners overrides the uniform coss ui radius. Nil keeps the default;
// a zero array makes square corners.
Corners *[4]float32
}
ButtonOptions configures a native button. Label is always the accessible name, including icon-only layouts and custom content.
type ButtonVariant ¶
type ButtonVariant uint8
ButtonVariant selects a button face, including native theme extensions.
const ( ButtonPrimary ButtonVariant = iota ButtonSecondary ButtonTertiary ButtonOutline ButtonGhost ButtonDanger ButtonDangerSoft ButtonDestructiveOutline ButtonLink )
type CardFrameOptions ¶
type CardFrameOptions struct {
Label string
}
CardFrameOptions configures a framed group of cards and supporting content.
type CardOptions ¶
type CardOptions struct {
Variant CardVariant
Label string
OnClick func()
Handle *ui.Handle
}
CardOptions customizes a coss ui Card. OnClick makes the whole card a real native action without changing its visual variants.
type CardVariant ¶
type CardVariant uint8
CardVariant selects a card surface, including native theme extensions.
const ( CardDefault CardVariant = iota CardSecondary CardTertiary CardTransparent )
type ChipOptions ¶
type ChipOptions struct {
Label string
Color StatusColor
Variant ChipVariant
Size ChipSize
Icon *ui.SVG
}
ChipOptions configures a compact native chip.
type ChipVariant ¶
type ChipVariant uint8
ChipVariant selects a native chip surface treatment.
const ( ChipSecondary ChipVariant = iota ChipPrimary ChipSoft ChipTertiary )
type CloseButtonOptions ¶
CloseButtonOptions configures the compact dismiss control.
type EmptyStateOptions ¶
EmptyStateOptions configures a quiet empty result.
type FlyoutHost ¶
FlyoutHost lets anchored popups open as native flyouts of Window, so they can extend beyond it. Keep one per window and pass a pointer to it in a popup's options. A nil host, a nil Window or a platform without flyouts (WebAssembly) keeps the popup inside the window.
type FrameOptions ¶
FrameOptions configures the inset between a frame and its independent panels.
type GroupItem ¶
GroupItem builds one control with the supplied outer-only corner radii. A mixed group can combine buttons, editors and application-defined controls.
type GroupOptions ¶
type GroupOptions struct {
Orientation Orientation
FullWidth bool
Label string
}
GroupOptions configures joined controls. Each item receives its own corners before construction, so its paint and keyboard focus use the same geometry.
type GuideCardOptions ¶
type GuideCardOptions struct {
Title, Description string
Cover ui.ImageSource
CoverContent func()
Actions func()
OnDismiss func()
}
GuideCardOptions configures a dismissible tip. Cover is an already-decoded picture shown across the top at its own ratio; CoverContent builds a custom cover instead. OnDismiss adds the close button: the caller stops rendering the card.
type HeaderOptions ¶
type HeaderOptions struct {
Text string
}
HeaderOptions configures a section header.
type ImageOptions ¶
type ImageOptions struct {
Source ui.ImageSource
Label string
Width, Height float32
AspectRatio float32
Fit ImageFit
Radius float32
Status ImageStatus
// Fallback adds content under the failed icon.
Fallback func()
// OnClick makes a shown picture a button, as for opening a preview.
OnClick func()
}
ImageOptions configures a caller-loaded image. Label is the accessible name. A zero Width fills the parent. Height wins over AspectRatio (width / height); with neither, the box takes the picture's own ratio, or 16:9 while there is none. A nonpositive Radius uses the theme's large radius.
type ImageStatus ¶
type ImageStatus uint8
ImageStatus is the caller's load state for an Image.
const ( ImageReady ImageStatus = iota ImageLoading ImageFailed )
type IndicatorColor ¶
type IndicatorColor uint8
IndicatorColor is the color of a progress or meter indicator. Its zero value uses the primary color, unlike the status colors used by chips.
const ( IndicatorAccent IndicatorColor = iota IndicatorDefault IndicatorSuccess IndicatorWarning IndicatorDanger )
type KbdOptions ¶
KbdOptions configures a keyboard chord.
type LinkButtonOptions ¶
LinkButtonOptions configures a link-style native button.
type LinkOptions ¶
LinkOptions configures an inline native action.
type ListGroupItemOptions ¶
type ListGroupItemOptions struct {
Title, Description string
Prefix, Suffix func()
Chevron bool
Disabled bool
OnClick func()
}
ListGroupItemOptions configures one row.
type ListGroupOptions ¶
type ListGroupOptions struct {
Variant SurfaceVariant
Label string
}
ListGroupOptions configures a native list group.
type MeterOptions ¶
type MeterOptions struct {
Label string
Value, Min, Max float64
Color IndicatorColor
Size ProgressSize
ShowOutput bool
OutputText string
}
MeterOptions configures a quantity within a known range.
type Orientation ¶
type Orientation uint8
Orientation is a horizontal or vertical layout direction.
const ( Horizontal Orientation = iota Vertical )
type PanelSide ¶
type PanelSide uint8
PanelSide selects the edge of a ResizablePanel that carries its handle. Start and end follow the layout direction.
type Placement ¶
Placement anchors a floating panel. Offset is the gap from the anchor; zero uses the component's default gap, typically 4 DIPs.
type PressableFeedbackOptions ¶
PressableFeedbackOptions configures a native press-feedback container.
type ProgressCircleOptions ¶
type ProgressCircleOptions struct {
Label string
Value, Min, Max float64
Indeterminate bool
Color IndicatorColor
Size ProgressSize
ShowOutput bool
}
ProgressCircleOptions configures a circular indicator.
type ProgressOptions ¶
type ProgressOptions struct {
Label string
Value, Min, Max float64
Indeterminate bool
Color IndicatorColor
Size ProgressSize
ShowOutput bool
OutputText string
}
ProgressOptions configures a coss ui bar indicator.
type ProgressSize ¶
type ProgressSize uint8
ProgressSize selects a native meter or progress track height.
const ( ProgressMedium ProgressSize = iota ProgressSmall ProgressLarge )
type ResizablePanelOptions ¶
type ResizablePanelOptions struct {
Label string
Side PanelSide
Size *float32
Min, Max float32
Collapsed *bool
OnResize func(size float32)
OnCollapseChange func(collapsed bool)
}
ResizablePanelOptions configures a panel resized from one edge. Size, Min and Max are DIPs along the resized axis before the text scale; Size is always shown within [Min, Max], and a nonpositive Max sets no upper bound. A nil Size is kept by the panel. A non-nil Collapsed makes the panel collapsible. Label names the handle and defaults to the locale's Resize.
type ResultOptions ¶
type ResultOptions struct {
Status StatusColor
Title, Description string
Icon *ui.SVG
// Actions builds the buttons under the text.
Actions func()
// Content builds supporting detail under the actions.
Content func()
}
ResultOptions configures the outcome of an operation. Status picks the tint and the default icon; Icon replaces the glyph and keeps the tint.
type ScrollAreaOptions ¶
type ScrollAreaOptions struct {
Axis ScrollAxis
Height float32
Label string
Fade *ScrollFadeOptions
}
ScrollAreaOptions configures coss's scroll viewport with native scrollbars.
type ScrollAxis ¶
type ScrollAxis uint8
ScrollAxis selects the axes of a native scroll area.
const ( ScrollVertical ScrollAxis = iota ScrollHorizontal ScrollBoth )
type ScrollFadeEdges ¶
type ScrollFadeEdges uint8
ScrollFadeEdges selects physical viewport edges; zero enables every edge.
const ( FadeTop ScrollFadeEdges = 1 << iota FadeRight FadeBottom FadeLeft )
type ScrollFadeMode ¶
type ScrollFadeMode uint8
ScrollFadeMode selects a native edge treatment.
const ( ShadowFade ScrollFadeMode = iota SurfaceFade // MaskFade fades the viewport and its descendants to transparency. MaskFade )
type ScrollFadeOptions ¶
type ScrollFadeOptions struct {
Mode ScrollFadeMode
Edges ScrollFadeEdges
Size float32
Surface ui.Color
Color ui.Color
}
ScrollFadeOptions customizes an edge fade independently of scrolling. SurfaceFade requires the actual opaque surface. Color customizes a shadow. MaskFade uses a subtree effect and needs neither Surface nor Color.
type ScrollShadowOptions ¶
type ScrollShadowOptions struct {
Orientation ScrollShadowOrientation
Surface ui.Color
Size float32
Height float32
Label string
}
ScrollShadowOptions describes an opaque scrolling surface. The edge fade is painted in Surface, which should be the actual opaque background. ScrollArea with MaskFade instead fades content to transparency.
type ScrollShadowOrientation ¶
type ScrollShadowOrientation uint8
ScrollShadowOrientation selects the scroll axis; vertical is the default.
const ( ScrollShadowVertical ScrollShadowOrientation = iota ScrollShadowHorizontal )
type SeparatorColor ¶
type SeparatorColor uint8
SeparatorColor selects the divider's emphasis.
const ( SeparatorDefault SeparatorColor = iota SeparatorSecondary SeparatorTertiary )
type SeparatorOptions ¶
type SeparatorOptions struct {
Orientation Orientation
Color SeparatorColor
}
SeparatorOptions configures a semantic divider.
type Side ¶
type Side uint8
Side is a placement edge. SideAuto selects the component's default edge.
type SidebarGroupOptions ¶
type SidebarGroupOptions struct {
Key string
Label string
Items []SidebarItemOptions
}
SidebarGroupOptions groups navigation actions under an optional label. Key preserves the group's identity when groups are reordered and must be unique among groups when set. Without a key, its position is its identity.
type SidebarItemOptions ¶
SidebarItemOptions describes one navigation action. ID must be nonempty and unique within the sidebar; Label is its accessible name. OnClick runs after the selection is updated.
type SidebarOptions ¶
type SidebarOptions struct {
Selected *string
Collapsed *bool
Groups []SidebarGroupOptions
Header func()
Width float32
CollapsedWidth float32
Label string
ToggleLabel string
OnSelect func(id string)
OnCollapseChange func(collapsed bool)
}
SidebarOptions configures a sidebar. Selected and Collapsed are required caller-owned per-window state, and an empty Selected means no selection. Width and CollapsedWidth scale with the text size; nonpositive values use coss ui's 256 and 48 DIP defaults. Header and Footer build their own content in both states and can read Collapsed to adapt their layout. A collapsed item without an icon retains its text so it remains usable.
OnSelect runs for every enabled activation, including the current item, before the item's OnClick. ToggleLabel can replace the English accessible name of the toggle.
type SkeletonAnimation ¶
type SkeletonAnimation uint8
SkeletonAnimation selects placeholder motion; shimmer is the COSS default.
const ( SkeletonShimmer SkeletonAnimation = iota SkeletonPulse SkeletonNone )
type SkeletonGroupOptions ¶
type SkeletonGroupOptions struct {
Animation SkeletonAnimation
}
SkeletonGroupOptions coordinates placeholder animation.
type SkeletonOptions ¶
type SkeletonOptions struct {
Width, Height float32
Radius float32
Circle bool
Animation SkeletonAnimation
}
SkeletonOptions reserves the shape of loading content.
type SpinnerOptions ¶
type SpinnerOptions struct {
Size SpinnerSize
Color StatusColor
Label string
}
SpinnerOptions configures a loading indicator.
type SpinnerSize ¶
type SpinnerSize uint8
SpinnerSize selects a native loading indicator size.
const ( SpinnerMedium SpinnerSize = iota SpinnerSmall SpinnerLarge SpinnerExtraLarge )
type StatusColor ¶
type StatusColor uint8
StatusColor selects a semantic color for native status components.
const ( ColorDefault StatusColor = iota ColorAccent ColorSuccess ColorWarning ColorDanger // ColorInfo uses the theme's informational color. ColorInfo )
type StatusPalette ¶
type StatusPalette struct {
Solid, SolidForeground ui.Color
Hover ui.Color
Soft, SoftForeground ui.Color
SoftHover ui.Color
Foreground ui.Color
}
StatusPalette is the resolved color set for one coss ui status. Components and applications use it to paint custom status surfaces consistently.
func StatusColors ¶
func StatusColors(c *ui.Context, color StatusColor) StatusPalette
StatusColors resolves a status against the live theme.
type SurfaceOptions ¶
type SurfaceOptions struct {
Variant SurfaceVariant
Padding float32
Radius float32
FillWidth bool
Label string
}
SurfaceOptions customizes a native Surface. Padding and Radius default to zero so callers can compose their own layout.
type SurfaceVariant ¶
type SurfaceVariant uint8
SurfaceVariant selects a native container surface.
const ( SurfaceDefault SurfaceVariant = iota SurfaceSecondary SurfaceTertiary SurfaceTransparent )
type TagGroupOptions ¶
type TagGroupOptions struct {
Label, Description, Error string
Selection TagSelection
Size TagSize
Variant TagVariant
State *TagGroupState
OnChange func(keys []string)
}
TagGroupOptions configures a focusable tag collection.
type TagGroupState ¶
TagGroupState is caller-owned tag selection.
func (*TagGroupState) IsSelected ¶
func (s *TagGroupState) IsSelected(key string) bool
IsSelected reports whether key is chosen.
type TagOptions ¶
type TagOptions struct {
Key string
Label string
Icon *ui.SVG
Removable bool
Disabled bool
OnRemove func()
OnClick func()
}
TagOptions configures one tag.
type TagSelection ¶
type TagSelection uint8
TagSelection selects the tag group's selection behavior.
const ( TagSelectNone TagSelection = iota TagSelectSingle TagSelectMultiple )
type TagVariant ¶
type TagVariant uint8
TagVariant selects the unselected tag surface.
const ( TagDefault TagVariant = iota TagSurface )
type ToggleButtonGroupOptions ¶
type ToggleButtonGroupOptions struct {
Orientation Orientation
FullWidth bool
// Detached keeps a 4 DIP gap even for outline toggles.
Detached bool
// Separators paints a divider at the shared edges of joined outline toggles.
Separators bool
}
ToggleButtonGroupOptions controls a joined or detached toggle set.
type ToggleButtonOptions ¶
type ToggleButtonOptions struct {
Label string
Icon *ui.SVG
Variant ToggleButtonVariant
Size theme.ButtonSize
IconOnly bool
FullWidth bool
Selected *bool
Disabled bool
OnChange func(bool)
Tooltip string
// Corners overrides the uniform radius. Nil keeps it.
Corners *[4]float32
}
ToggleButtonOptions configures a persistent pressed-state button. Selected is caller-owned; clicking flips it and reports the new value.
type ToggleButtonVariant ¶
type ToggleButtonVariant uint8
ToggleButtonVariant selects a toggle surface, including a native ghost variant.
const ( ToggleDefault ToggleButtonVariant = iota ToggleGhost ToggleOutline )
Source Files
¶
- alert.go
- avatar.go
- button.go
- card.go
- chip.go
- doc.go
- empty_state.go
- flyout_host.go
- frame.go
- guide_card.go
- image.go
- kbd.go
- link.go
- list_group.go
- placement.go
- pressable.go
- progress.go
- resizable_panel.go
- result.go
- scroll_fade.go
- scroll_shadow.go
- separator.go
- sidebar.go
- skeleton.go
- spinner.go
- status.go
- tag.go
- toggle.go
- typography.go
Directories
¶
| Path | Synopsis |
|---|---|
|
Package chart provides native, coss-themed charts inspired by Bklit's MIT chart catalog.
|
Package chart provides native, coss-themed charts inspired by Bklit's MIT chart catalog. |
|
Package color implements color controls with native MyGo painting, keyboard handling and accessibility.
|
Package color implements color controls with native MyGo painting, keyboard handling and accessibility. |
|
Package content provides native components that copy, colour and render text: a copy button, a one-line snippet, a highlighted code block, themed Markdown and a QR code.
|
Package content provides native components that copy, colour and render text: a copy button, a one-line snippet, a highlighted code block, themed Markdown and a QR code. |
|
Package data provides a COSS-inspired native table.
|
Package data provides a COSS-inspired native table. |
|
Package date provides COSS-inspired Gregorian date and time controls: Calendar, RangeCalendar, DateField, DatePicker, DateRangePicker and TimeField.
|
Package date provides COSS-inspired Gregorian date and time controls: Calendar, RangeCalendar, DateField, DatePicker, DateRangePicker and TimeField. |
|
examples
|
|
|
basic
command
Command basic demonstrates a small native application using mygoui.
|
Command basic demonstrates a small native application using mygoui. |
|
gallery
command
Command gallery opens the native MyGo UI component workbench.
|
Command gallery opens the native MyGo UI component workbench. |
|
Package fonts provides the optional Cal Sans font family.
|
Package fonts provides the optional Cal Sans font family. |
|
Package form provides Coss-inspired form controls with native MyGo editing, focus, selection and accessibility.
|
Package form provides Coss-inspired form controls with native MyGo editing, focus, selection and accessibility. |
|
internal
|
|
|
anchored
Package anchored maps typed placements onto MyGo's native anchor engine.
|
Package anchored maps typed placements onto MyGo's native anchor engine. |
|
apidoc
Package apidoc derives the gallery's API reference from the library source.
|
Package apidoc derives the gallery's API reference from the library source. |
|
apidoc/cmd/apidoc
command
Command apidoc writes the gallery's generated API and example tables.
|
Command apidoc writes the gallery's generated API and example tables. |
|
formstyle
Package formstyle shares Coss field chrome between native form and date controls.
|
Package formstyle shares Coss field chrome between native form and date controls. |
|
gallery
Package gallery is the interactive native workbench for mygoui.
|
Package gallery is the interactive native workbench for mygoui. |
|
style
Package style centralizes typography and state styling shared by components.
|
Package style centralizes typography and state styling shared by components. |
|
Package list provides virtualized, selectable rows with Coss-inspired appearance and optional labelled sections.
|
Package list provides virtualized, selectable rows with Coss-inspired appearance and optional labelled sections. |
|
Package locale owns library-level accessible labels.
|
Package locale owns library-level accessible labels. |
|
Package navigation provides Coss-inspired native navigation controls: accordions, disclosures, tabs, segmented controls, breadcrumbs, pagination, toolbars, menus, context menus, and searchable commands.
|
Package navigation provides Coss-inspired native navigation controls: accordions, disclosures, tabs, segmented controls, breadcrumbs, pagination, toolbars, menus, context menus, and searchable commands. |
|
Package overlay implements COSS-inspired transient surfaces on MyGo's native overlay, focus and toast engines.
|
Package overlay implements COSS-inspired transient surfaces on MyGo's native overlay, focus and toast engines. |
|
Package theme owns coss ui's semantic tokens, geometry and typography.
|
Package theme owns coss ui's semantic tokens, geometry and typography. |