Documentation ¶
Overview ¶
Package autoinit allows interaction between go-app components and mdc.autoInit().
See https://github.com/material-components/material-components-web/tree/master/packages/mdc-auto-init for more detail.
Typical use occur in OnMount() where the component element is initialized and the value attached to the component is referenced in a field of the go-app component.
type TopAppBar struct { app.Compo autoinit.AutoInit ..... } func (c *TopAppBar) OnMount(_ app.Context) { c.api = c.AutoInitComponent(c.JSValue(), autoinit.MDCTopAppBar) }
Index ¶
- Constants
- type AutoInit
- type MDCName
- func (n MDCName) DataMdcAutoInitButton(button app.HTMLButton) app.HTMLButton
- func (n MDCName) DataMdcAutoInitDiv(div app.HTMLDiv) app.HTMLDiv
- func (n MDCName) DataMdcAutoInitHeader(header app.HTMLHeader) app.HTMLHeader
- func (n MDCName) DataMdcAutoInitSpan(set app.HTMLSpan) app.HTMLSpan
- func (n MDCName) GetFrom(value app.Value) app.Value
Constants ¶
const MdcAutoInitData = "mdc-auto-init"
MdcAutoInitData is the data attribute constant.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AutoInit ¶
type AutoInit struct{}
func (*AutoInit) AutoInitComponent ¶
AutoInitComponent is short for MdcAutoInitWindow() and return name.GetFrom(compo).
func (*AutoInit) MdcAutoInit ¶
MdcAutoInit calls the js function mdc.autoInit() with the provided value
func (*AutoInit) MdcAutoInitWindow ¶
func (ai *AutoInit) MdcAutoInitWindow()
MdcAutoInitWindow is short for MdcAutoInit(app.Window().get("Document"))
type MDCName ¶
type MDCName string
MDCName defines the constants for the keys registered using autoInit.register().
const MDCBanner MDCName = "MDCBanner"
const MDCCheckbox MDCName = "MDCCheckbox"
const MDCChip MDCName = "MDCChip"
const MDCChipSet MDCName = "MDCChipSet"
const MDCCircularProgress MDCName = "MDCCircularProgress"
const MDCDataTable MDCName = "MDCDataTable"
const MDCDialog MDCName = "MDCDialog"
const MDCDrawer MDCName = "MDCDrawer"
const MDCFloatingLabel MDCName = "MDCFloatingLabel"
const MDCFormField MDCName = "MDCFormField"
const MDCIconButtonToggle MDCName = "MDCIconButtonToggle"
const MDCLineRipple MDCName = "MDCLineRipple"
const MDCLinearProgress MDCName = "MDCLinearProgress"
const MDCList MDCName = "MDCList"
const MDCMenu MDCName = "MDCMenu"
const MDCMenuSurface MDCName = "MDCMenuSurface"
const MDCNotchedOutline MDCName = "MDCNotchedOutline"
const MDCRadio MDCName = "MDCRadio"
const MDCRipple MDCName = "MDCRipple"
const MDCSegmentedButton MDCName = "MDCSegmentedButton"
const MDCSelect MDCName = "MDCSelect"
const MDCSlider MDCName = "MDCSlider"
const MDCSnackbar MDCName = "MDCSnackbar"
const MDCSwitch MDCName = "MDCSwitch"
const MDCTabBar MDCName = "MDCTabBar"
const MDCTextField MDCName = "MDCTextField"
const MDCTooltip MDCName = "MDCTooltip"
const MDCTopAppBar MDCName = "MDCTopAppBar"
func (MDCName) DataMdcAutoInitButton ¶ added in v0.2.3
func (n MDCName) DataMdcAutoInitButton(button app.HTMLButton) app.HTMLButton
DataMdcAutoInitButton is a convenience method for setting the data-mdc-auto-init attribute on a Button.
func (MDCName) DataMdcAutoInitDiv ¶ added in v0.2.2
DataMdcAutoInitDiv is a convenience method for setting the data-mdc-auto-init attribute on a Div.
func (MDCName) DataMdcAutoInitHeader ¶ added in v0.2.4
func (n MDCName) DataMdcAutoInitHeader(header app.HTMLHeader) app.HTMLHeader
DataMdcAutoInitHeader is a convenience method for setting the data-mdc-auto-init attribute on a Header.
func (MDCName) DataMdcAutoInitSpan ¶ added in v0.2.4
DataMdcAutoInitSpan is a convenience method for setting the data-mdc-auto-init attribute on a Span.