Documentation
¶
Overview ¶
Package chip provides chips: small rounded labels for filters, tags and choices, optionally selectable and removable.
Index ¶
- type Chip
- func (c *Chip) Click()
- func (c *Chip) Icon(el elements.Element) *Chip
- func (c *Chip) IsSelected() bool
- func (c *Chip) Layout(gtx layout.Context) layout.Dimensions
- func (c *Chip) OnClick(fn func()) *Chip
- func (c *Chip) OnRemove(fn func()) *Chip
- func (c *Chip) Selected(on bool) *Chip
- func (c *Chip) SelectedStyles(st styles.Styles) *Chip
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Chip ¶
type Chip struct {
// Contextual gives it a context menu (Context).
elements.Contextual
// contains filtered or unexported fields
}
Chip is a rounded label with an optional icon, a selected state and a remove button. Without OnClick or OnRemove it's a plain element that can be built every frame; with them, create it once (or with Keyed), since it then holds press state.
func New ¶
New returns a chip. The styles argument is optional: Background (default a faint tint of the text), Color (default theme.text), BorderColor, FontSize. They style the unselected chip; a selected chip keeps its theme.primary fill and theme.onprimary text unless SelectedStyles sets others.
func (*Chip) Layout ¶
func (c *Chip) Layout(gtx layout.Context) layout.Dimensions
Layout lays out the chip.
func (*Chip) OnRemove ¶
OnRemove adds a remove (x) button after the label. It returns c for chaining.