Documentation ¶
Overview ¶
The widget package contains supported composite and special purpose controls that are not part of the html standard
Index ¶
- Constants
- func MegaMenuSelect() *page.Event
- type ItemListPanel
- type ItemListPanelI
- type MegaMenu
- func (l *MegaMenu) Deserialize(dec page.Decoder) (err error)
- func (l *MegaMenu) DrawInnerHtml(ctx context.Context, buf *bytes.Buffer) (err error)
- func (l *MegaMenu) DrawTag(ctx context.Context) string
- func (l *MegaMenu) DrawingAttributes(ctx context.Context) html.Attributes
- func (l *MegaMenu) GetItemsHtml(items []*control.ListItem, level int) string
- func (l *MegaMenu) Init(parent page.ControlI, id string)
- func (l *MegaMenu) Serialize(e page.Encoder) (err error)
- func (l *MegaMenu) SetAriaLabel(s string) MegaMenuI
- func (l *MegaMenu) SetData(data interface{})
- type MegaMenuCreator
- type MegaMenuI
- type Recaptcha3
Constants ¶
const MegaMenuSelectEvent = "megamenuselect"
Variables ¶
This section is empty.
Functions ¶
func MegaMenuSelect ¶ added in v0.7.0
Types ¶
type ItemListPanel ¶
type ItemListPanel struct { Panel FilterPanel *Panel ScrollPanel *Panel ButtonPanel *Panel FilterText *Textbox ItemTable *SelectTable NewButton *Button EditButton *Button }
func NewItemListPanel ¶
func NewItemListPanel(parent page.ControlI, id string) *ItemListPanel
func (*ItemListPanel) Action ¶
func (f *ItemListPanel) Action(ctx context.Context, a page.ActionParams)
func (*ItemListPanel) DrawingAttributes ¶
func (c *ItemListPanel) DrawingAttributes(ctx context.Context) html.Attributes
func (*ItemListPanel) Load ¶
func (p *ItemListPanel) Load(ctx context.Context)
type ItemListPanelI ¶
type ItemListPanelI interface { PanelI }
type MegaMenu ¶ added in v0.7.0
type MegaMenu struct { page.ControlBase control.ItemList control.DataManager }
MegaMenu is a control that is the basis for a navigation or action menu that is typically used in a large application. It implements the recommendations at https://www.levelaccess.com/challenges-mega-menus-standard-menus-make-accessible/ to create a natively styled menu, which is keyboard navigable. It tries to avoid the aria-menu item, as that is particularly difficult to implement.
If an item has sub items, it is treated simply as a menu opener, and clicking on that item will not produce an action. If a terminal item has an href, it will be output as a link. Otherwise, it will be output as a button and will fire the "MenuSelectEvent".
There are so many ways to show menus. We attempt to provide some examples, but you might need to add additional styling for your situation.
func GetMegaMenu ¶ added in v0.7.0
GetMegaMenu is a convenience method to return the control with the given id from the page.
func (*MegaMenu) Deserialize ¶ added in v0.7.0
func (*MegaMenu) DrawInnerHtml ¶ added in v0.7.0
func (*MegaMenu) DrawingAttributes ¶ added in v0.7.0
func (l *MegaMenu) DrawingAttributes(ctx context.Context) html.Attributes
DrawingAttributes retrieves the tag's attributes at draw time. You should not normally need to call this, and the attributes are disposed of after drawing, so they are essentially read-only.
func (*MegaMenu) GetItemsHtml ¶ added in v0.7.0
GetItemsHtml is used by the framework to get the items for the html. It is exported so that it can be overridden by other implementations of an MegaMenu.
func (*MegaMenu) SetAriaLabel ¶ added in v0.7.0
SetAriaLabel sets the aria label that will be used in the tag. e.g. main menu
func (*MegaMenu) SetData ¶ added in v0.7.0
func (l *MegaMenu) SetData(data interface{})
SetData replaces the current list with the given data. ItemLister, ItemIDer, Labeler or Stringer types are accepted. This function can accept one or more lists of items, or single items. They will all get added to the top level of the list. To add sub items, get a list item and add items to it.
type MegaMenuCreator ¶ added in v0.7.0
type MegaMenuCreator struct { ID string // Items is a static list of labels and values that will be in the list. Or, use a DataProvider to dynamically generate the items. Items []control.ListValue // DataProvider is the control that will dynamically provide the data for the list and that implements the DataBinder interface. DataProvider control.DataBinder // DataProviderID is the id of a control that will dynamically provide the data for the list and that implements the DataBinder interface. DataProviderID string // AriaLabel is the aria label attribute. AriaLabel string OnMenuSelect action.ActionI page.ControlOptions }
type Recaptcha3 ¶ added in v0.13.4
type Recaptcha3 struct { page.ControlBase SiteKey string SecretKey string }
func NewRecaptcha3 ¶ added in v0.13.4
func NewRecaptcha3(parent page.ControlI, id string) *Recaptcha3
NewRecaptcha3 creates a new recaptcha widget