banner

package
v0.2.9 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2022 License: MIT Imports: 4 Imported by: 2

Documentation

Overview

Package banner provides the banner component and interactions with that component.

https://github.com/material-components/material-components-web/tree/master/packages/mdc-banner

Index

Constants

API is the auto init data value for this component.

View Source
const ReasonTag = "reason"

Variables

This section is empty.

Functions

This section is empty.

Types

type Banner struct {
	app.Compo
	base.JsUtil
	autoinit.AutoInit
	Id       string
	Text     string
	Centered bool
	Fixed    bool
	Stacked  bool
	Buttons  []app.UI
	// contains filtered or unexported fields
}

Banner component displays a prominent message and related optional actions.

See https://github.com/material-components/material-components-web/tree/master/packages/mdc-banner#banner-example for usage of the Banner fields.

func (*Banner) ActionClose

func (b *Banner) ActionClose(ctx app.Context, reason CloseReason)

ActionClose sends the Close event to the banner component with the provided reason.

func (*Banner) ActionOpen

func (b *Banner) ActionOpen(ctx app.Context)

ActionOpen sends the Open event to the banner component.

func (*Banner) OnClose added in v0.2.4

func (b *Banner) OnClose(ctx app.Context, onClose func(ctx app.Context, reason string))

OnClose registers the onClose callback function to handle the Close event emitted by the banner js.

func (*Banner) OnMount

func (b *Banner) OnMount(ctx app.Context)

OnMount sets up the component's js api and the event handlers.

func (*Banner) Render

func (b *Banner) Render() app.UI

Render provides the markup to display the banner.

type CloseReason added in v0.2.4

type CloseReason string
const ClosePrimary CloseReason = "primary"
const CloseSecondary CloseReason = "secondary"
const CloseUnspecified CloseReason = "unspecified"

func (CloseReason) Int added in v0.2.4

func (bcr CloseReason) Int() int

type CloseReasonInt added in v0.2.4

type CloseReasonInt int
const ClosePrimaryInt CloseReasonInt = 0
const CloseSecondaryInt CloseReasonInt = 1
const CloseUnspecifiedInt CloseReasonInt = 3

type EventType

type EventType string

EventType defines the event strings that are sent to and from the banner control.

const Close EventType = "MDCBanner:close"

Close is the event sent using OnClose to call the banner's api.close() method

const Closed EventType = "MDCBanner:closed"

Closed indicates when the banner finishes its closing animation.

const Closing EventType = "MDCBanner:closing"

Closing indicates when the banner begins its closing animation.

const Open EventType = "MDCBanner:open"

Open is the event sent using ActionOpen to call the banner's api.open() method.

const Opened EventType = "MDCBanner:opened"

Opened indicates when the banner finishes its opening animation.

const Opening EventType = "MDCBanner:opening"

Opening indicates when the banner begins its opening animation.

Jump to

Keyboard shortcuts

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