Documentation
¶
Index ¶
- func ActionIcon(c *ui.Context, svg *ui.SVG, p ActionIconProps) ui.Element
- func ActionIconGroup(c *ui.Context, p ActionIconGroupProps) string
- func Button(c *ui.Context, label string, p ButtonProps) ui.Element
- func CopyButton(c *ui.Context, content string, p CopyButtonProps) ui.Element
- func Segmented(c *ui.Context, selected *int, options []string, p SegmentedProps) ui.Element
- func StyleActionIcon(c *ui.Context, b ui.Element, svg *ui.SVG, p ActionIconProps) ui.Element
- func StyleButton(c *ui.Context, b ui.Element, label string, p ButtonProps) ui.Element
- type ActionGroupItem
- type ActionIconGroupProps
- type ActionIconGroupVariant
- type ActionIconProps
- type ActionIconVariant
- type ButtonProps
- type ButtonVariant
- type CopyButtonProps
- type SegmentedProps
- type SegmentedVariant
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ActionIcon ¶
func ActionIconGroup ¶
func ActionIconGroup(c *ui.Context, p ActionIconGroupProps) string
ActionIconGroup shows a row of icon buttons on one surface, as the actions under a message, with an optional More menu; it returns the Key of the icon or menu item clicked in the frame, or "".
func CopyButton ¶
CopyButton copies content to the clipboard when clicked, and shows a check and says "Copied" for two seconds after.
func StyleActionIcon ¶
StyleActionIcon gives b, a button of any kind, as a menu's trigger (ui.MenuBase), the look of ActionIcon with svg.
func StyleButton ¶
StyleButton gives b, a button of any kind, as a menu's trigger (ui.MenuBase), the look of Button with label.
Types ¶
type ActionGroupItem ¶
type ActionGroupItem struct {
// Key is what ActionIconGroup returns in the frame the icon is clicked.
Key string
// Icon is the button's glyph; Label names it and shows as its tooltip.
Icon *ui.SVG
Label string
// Danger colors the glyph with the error color.
Danger bool
// Disabled keeps the icon from being clicked.
Disabled bool
}
type ActionIconGroupProps ¶
type ActionIconGroupProps struct {
// Items are the icons, in order.
Items []ActionGroupItem
// Menu, if set, adds a More icon at the end that opens a menu of these items.
Menu []overlay.MenuItem
// Variant picks the group's surface: Filled tints it, Outlined borders it on the container
// color, Borderless shows a fill only under the pointer.
Variant ActionIconGroupVariant
// Size sets the icons' size, as ActionIcon's.
Size theme.Size
// Vertical stacks the icons in a column.
Vertical bool
// Disabled dims the group and keeps its icons and menu from being used.
Disabled bool
// Shadow lifts the group with a soft layered shadow in the border colors.
Shadow bool
}
type ActionIconGroupVariant ¶
type ActionIconGroupVariant int
const ( GroupFilled ActionIconGroupVariant = iota GroupOutlined GroupBorderless )
type ActionIconProps ¶
type ActionIconProps struct {
// Variant picks the surface: Borderless shows a fill only on hover, Filled keeps a neutral
// fill, Outlined sits on the container with a border.
Variant ActionIconVariant
// Size sets the box (24, 36 or 44), corner radius and glyph size (14, 20 or 24).
Size theme.Size
// GlyphSize sets the glyph in DIPs, as Lobe UI's numeric size: the box is 1.8 times it, rounded
// by a sixth of the box, unless BlockSize sets the box.
GlyphSize float32
// BlockSize sets the box in DIPs, rounded by 6, as Lobe UI's size object.
BlockSize float32
// Active keeps the hover fill, for a toggled or open state.
Active bool
// Danger colors the glyph with the error color.
Danger bool
// Title names the button for assistive technology and shows as its tooltip.
Title string
}
type ActionIconVariant ¶
type ActionIconVariant int
const ( ActionIconBorderless ActionIconVariant = iota ActionIconFilled ActionIconOutlined )
type ButtonProps ¶
type ButtonProps struct {
// Variant picks the surface: Primary fills with the primary color, Default and Dashed sit on
// the container with a border, Filled uses a neutral fill, Text and Link have no surface.
Variant ButtonVariant
// Size sets the height (24, 32 or 40), padding, font size and corner radius.
Size theme.Size
}
type ButtonVariant ¶
type ButtonVariant int
const ( Default ButtonVariant = iota Primary Dashed Filled Text Link )
type CopyButtonProps ¶
type CopyButtonProps struct {
// Variant picks the surface, as ActionIcon's.
Variant ActionIconVariant
// Size sets the button and icon size, as ActionIcon's.
Size theme.Size
// Icon replaces the copy icon.
Icon *ui.SVG
}
type SegmentedProps ¶
type SegmentedProps struct {
// Variant picks the track: Filled sits on the layout color with a faint border, Outlined
// has only a border.
Variant SegmentedVariant
// Size sets the item height (26, 32 or 36), padding and font size.
Size theme.Size
// Block stretches the track across its parent and shares the width between the items.
Block bool
}
type SegmentedVariant ¶
type SegmentedVariant int
const ( SegmentedFilled SegmentedVariant = iota SegmentedOutlined )