md

package module
v0.0.0-...-72b7d5e Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: MIT Imports: 2 Imported by: 0

README

GO bindings for Material-Web to be used with GO-APP

example

package main

import (
	"log"
	"net/http"

	md "github.com/BrownNPC/material-web-go-app"
	"github.com/maxence-charriere/go-app/v10/pkg/app"
)

type Example struct {
	app.Compo
}

func (h *Example) Render() app.UI {
	return app.Div().
		//center using grid layout
		Body(

			md.LinearProgress().
				Attr("indeterminate", true),
			md.Icon().Text("settings"),
			app.H1().Text("Hello World").Class("md-typescale-display-large"),
			md.FilledTextField().Attr("value", "Hello World"),
			md.FilledIconButton().
				Body(md.Icon().
					Text("settings"),
				),
			md.Slider(),
			md.ChipSet().
				Body(
					md.AssistChip().Text("assist chip"),
					md.FilterChip().Text("filter chip"),
				),
		)
}
func main() {
	handler := &app.Handler{
		Name:       "Material Design App",
		RawHeaders: append(md.RawHeaders(), md.LinkIconFontOutlined()),
	}
	app.Route("/", func() app.Composer { return &Example{} })
	app.RunWhenOnBrowser()
	log.Fatal(http.ListenAndServe(":8000", handler))
}

To run this

go mod init app
go mod tidy
GOOS=js GOARCH=wasm go build -ldflags="-s -w" -o  web/app.wasm
go run .

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssistChip

func AssistChip() app.HTMLElem

Assist chips represent smart or automated actions that can span multiple apps, such as opening a calendar event from the home screen.

Assist chips function as though the user asked an assistant to complete the action. They should appear dynamically and contextually in a UI.

https://github.com/material-components/material-web/blob/main/docs/components/chip.md#mdassistchip-md-assist-chip

func BrandedFab

func BrandedFab() app.HTMLElem

Branded FABs use a brightly colored logo for their icon. Unlike FAB, branded FABs do not have color variants.

https://github.com/material-components/material-web/blob/main/docs/components/fab.md#branded-fab

func Checkbox

func Checkbox() app.HTMLElem

Checkboxes allow users to select one or more items from a set. Checkboxes can turn an option on or off.

There's one type of checkbox in Material. Use this selection control when the user needs to select one or more options from a list.

https://github.com/material-components/material-web/blob/main/docs/components/checkbox.md#mdcheckbox-md-checkbox

func ChipSet

func ChipSet() app.HTMLElem

Chips should always appear in a set. Chip sets are toolbars that can display any type of chip or other toolbar items.

https://github.com/material-components/material-web/blob/main/docs/components/chip.md#mdchipset-md-chip-set

func CircularProgress

func CircularProgress() app.HTMLElem

Circular progress indicators display progress by animating along an invisible circular track in a clockwise direction.

https://github.com/material-components/material-web/blob/main/docs/components/progress.md#mdcircularprogress-md-circular-progress

func Divider

func Divider() app.HTMLElem

A divider is a thin line that groups content in lists and containers.

Dividers can reinforce tapability, such as when used to separate list items or define tappable regions in an accordion.

https://github.com/material-components/material-web/blob/main/docs/components/divider.md#mddivider-md-divider

func ElevatedButton

func ElevatedButton() app.HTMLElem

Elevated buttons are essentially filled tonal buttons with a shadow.

To prevent shadow creep, only use them when absolutely necessary, such as when the button requires visual separation from a patterned background.

https://github.com/material-components/material-web/blob/main/docs/components/button.md#mdelevatedbutton-md-elevated-button

func Elevation

func Elevation() app.HTMLElem

func Fab

func Fab() app.HTMLElem

Floating Action Button FAB represents the most important action on a screen. It puts key actions within reach.

Extended FABs help people take primary actions. They're wider than FABs to accommodate a text label and larger target area.

https://github.com/material-components/material-web/blob/main/docs/components/fab.md#mdfab-md-floating-action-button

func FilledButton

func FilledButton() app.HTMLElem

Filled buttons have the most visual impact after the FAB, and should be used for important, final actions that complete a flow, like Save, Join now, or Confirm.

https://github.com/material-components/material-web/blob/main/docs/components/button.md#mdfilledbutton-md-filled-button

func FilledIconButton

func FilledIconButton() app.HTMLElem

Filled icon buttons have higher visual impact and are best for high emphasis actions.

https://github.com/material-components/material-web/blob/main/docs/components/icon-button.md#mdfillediconbutton-md-filled-icon-button

func FilledSelect

func FilledSelect() app.HTMLElem

Select menus display a list of choices on temporary surfaces and display the currently selected menu item above the menu.

Select (also referred to as a dropdown menu) allows choosing a value from a fixed list of available options.

https://github.com/material-components/material-web/blob/main/docs/components/select.md#mdfilledselect-md-filled-select

func FilledTextField

func FilledTextField() app.HTMLElem

Text fields let users enter text into a UI.

Filled and outlined text fields are functionally identical.

https://github.com/material-components/material-web/blob/main/docs/components/text-field.md#mdfilledtextfield-md-filled-text-field

func FilledTonalButton

func FilledTonalButton() app.HTMLElem

A filled tonal button is an alternative middle ground between filled and outlined buttons.

They're useful in contexts where a lower-priority button requires slightly more emphasis than an outline would give, such as "Next" in an onboarding flow.

https://github.com/material-components/material-web/blob/main/docs/components/button.md#mdfilledtonalbutton-md-filled-tonal-button

func FilledTonalIconButton

func FilledTonalIconButton() app.HTMLElem

Filled tonal icon buttons are a middle ground between filled and outlined icon buttons.

They're useful in contexts where the button requires slightly more emphasis than an outline would give, such as a secondary action paired with a high emphasis action.

https://github.com/material-components/material-web/blob/main/docs/components/icon-button.md#mdfilledtonaliconbutton-md-filled-tonal-icon-button

func FilterChip

func FilterChip() app.HTMLElem

Filter chips use tags or descriptive words to filter content. They can be a good alternative to toggle buttons or checkboxes.

https://github.com/material-components/material-web/blob/main/docs/components/chip.md#mdfilterchip-md-filter-chip

func FocusRing

func FocusRing() app.HTMLElem

Focus rings are accessible outlines for components to show keyboard focus.

Focus rings follow the same heuristics as :focus-visible to determine when they are visible.

https://github.com/material-components/material-web/blob/main/docs/components/focus-ring.md#mdfocusring-md-focus-ring

func Icon

func Icon() app.HTMLElem

Icons can be specified by name, unicode code point, or have an <svg> child element.

You must load the appropriate icon font to use icons. `LinkIconFontRounded()`, `LinkIconFontSharp()` and `LinkIconFontOutlined()` are available.

https://github.com/material-components/material-web/blob/main/docs/components/icon.md#mdicon-md-icon

func IconButton

func IconButton() app.HTMLElem

Standard icon buttons do not have a background or outline, and have the lowest emphasis of the icon buttons.

https://github.com/material-components/material-web/blob/main/docs/components/icon-button.md#mdiconbutton-md-icon-button

func InputChip

func InputChip() app.HTMLElem

Input chips represent discrete pieces of information entered by a user, such as Gmail contacts or filter options within a search field.

Input chips whose icons are user images may add the avatar attribute to display the image in a larger circle.

https://github.com/material-components/material-web/blob/main/docs/components/chip.md#mdinputchip-md-input-chip

func LinearProgress

func LinearProgress() app.HTMLElem

Linear progress indicators display progress by animating along the length of a fixed, visible track.

https://github.com/material-components/material-web/blob/main/docs/components/progress.md#mdlinearprogress-md-linear-progress

func LinkIconFontOutlined

func LinkIconFontOutlined() string

This icon font features outlined symbols, providing a distinct style.

use the append() function to add this to your RawHeaders app property

func main() {
	handler := &app.Handler{
		Name:       "Material Design App",
		RawHeaders: append(md.RawHeaders(), md.LinkIconFontOutlined()),
	}

func LinkIconFontRounded

func LinkIconFontRounded() string

This icon font is the default one used in Material Design 3.

use the append() function to add this to your RawHeaders app property

func main() {
	handler := &app.Handler{
		Name:       "Material Design App",
		RawHeaders: append(md.RawHeaders(), md.LinkIconFontOutlined()),
	}

func LinkIconFontSharp

func LinkIconFontSharp() string

This icon font is similar to the rounded one, but with sharp corners.

use the append() function to add this to your RawHeaders app property

func main() {
	handler := &app.Handler{
		Name:       "Material Design App",
		RawHeaders: append(md.RawHeaders(), md.LinkIconFontOutlined()),
	}

func List

func List() app.HTMLElem

Lists are continuous, vertical indexes of text and images <md-list> is a container composed of <md-list-item>s of different types.

https://github.com/material-components/material-web/blob/main/docs/components/list.md

func ListItem

func ListItem() app.HTMLElem

Lists are continuous, vertical indexes of text and images <md-list> is a container composed of <md-list-item>s of different types.

https://github.com/material-components/material-web/blob/main/docs/components/list.md

func Menu() app.HTMLElem

When opened, menus position themselves to an anchor.

Thus, either anchor or anchorElement must be supplied to md-menu before opening.

Additionally, a shared parent of position:relative should be present around the menu and it's anchor, because the default menu is positioned relative to the anchor element.

https://github.com/material-components/material-web/blob/main/docs/components/menu.md#mdmenu-md-menu

func MenuItem() app.HTMLElem

Menus also render menu items such as md-menu-item and handle keyboard navigation between md-menu-items as well as typeahead functionality. Additionally, md-menu interacts with md-menu-items to help you determine how a menu was closed.

Listen for and inspect the close-menu custom event's details to determine what action and items closed the menu.

https://github.com/material-components/material-web/blob/main/docs/components/menu.md#mdmenuitem-md-menu-item

func OutlinedButton

func OutlinedButton() app.HTMLElem

Outlined buttons are medium-emphasis buttons. They contain actions that are important, but aren’t the primary action in an app.

https://github.com/material-components/material-web/blob/main/docs/components/button.md#mdoutlinedbutton-md-outlined-button

func OutlinedIconButton

func OutlinedIconButton() app.HTMLElem

Outlined icon buttons are medium-emphasis icon buttons.

They contain actions that are important, but aren’t the primary action in an app.

https://github.com/material-components/material-web/blob/main/docs/components/icon-button.md#mdoutlinediconbutton-md-outlined-icon-button

func OutlinedSelect

func OutlinedSelect() app.HTMLElem

Select menus display a list of choices on temporary surfaces and display the currently selected menu item above the menu.

Select (also referred to as a dropdown menu) allows choosing a value from a fixed list of available options.

https://github.com/material-components/material-web/blob/main/docs/components/select.md#mdoutlinedselect-md-outlined-select

func OutlinedTextField

func OutlinedTextField() app.HTMLElem

Text fields let users enter text into a UI.

Filled and outlined text fields are functionally identical.

https://github.com/material-components/material-web/blob/main/docs/components/text-field.md#mdoutlinedtextfield-md-outlined-text-field

func PrimaryTab

func PrimaryTab() app.HTMLElem

Primary tabs are placed at the top of the content pane under a top app bar.

They display the main content destinations.

https://github.com/material-components/material-web/blob/main/docs/components/tabs.md#mdprimarytab-md-primary-tab

func Radio

func Radio() app.HTMLElem

Radio buttons let people select one option from a set of options.

https://github.com/material-components/material-web/blob/main/docs/components/radio.md#mdradio-md-radio

func RawHeaders

func RawHeaders() []string

func Ripple

func Ripple() app.HTMLElem

Ripples are state layers used to communicate the status of a component or interactive element.

A state layer is a semi-transparent covering on an element that indicates its state. A layer can be applied to an entire element or in a circular shape.

https://github.com/material-components/material-web/blob/main/docs/components/ripple.md#mdripple-md-ripple

func SecondaryTab

func SecondaryTab() app.HTMLElem

Secondary tabs are used within a content area to further separate related content and establish hierarchy.

https://github.com/material-components/material-web/blob/main/docs/components/tabs.md#mdsecondarytab-md-secondary-tab

func SelectOption

func SelectOption() app.HTMLElem

Select menus display a list of choices on temporary surfaces and display the currently selected menu item above the menu.

Select (also referred to as a dropdown menu) allows choosing a value from a fixed list of available options.

https://github.com/material-components/material-web/blob/main/docs/components/select.md#mdselectoption-md-select-option

func Slider

func Slider() app.HTMLElem

Sliders allow users to view and select a value (or range) along a track. They're ideal for adjusting settings such as volume and brightness, or for applying image filters.

Sliders can use icons or labels to represent a numeric or relative scale.

https://github.com/material-components/material-web/blob/main/docs/components/slider.md#mdslider-md-slider

func SubMenu() app.HTMLElem

You can compose <md-menu>s inside of an <md-sub-menu>'s menu slot,

but first the has-overflow attribute must be set on the root <md-menu> to disable overflow scrolling and display the nested submenus.

https://github.com/material-components/material-web/blob/main/docs/components/menu.md#mdsubmenu-md-sub-menu

func SuggestionChip

func SuggestionChip() app.HTMLElem

Suggestion chips help narrow a user’s intent by presenting dynamically generated suggestions, such as possible responses or search filters.

https://github.com/material-components/material-web/blob/main/docs/components/chip.md#mdsuggestionchip-md-suggestion-chip

func Switch

func Switch() app.HTMLElem

Switches toggle the state of an item on or off.

Switches are similar to checkboxes, and can be unselected or selected.

https://github.com/material-components/material-web/blob/main/docs/components/switch.md#mdswitch-md-switch

func Tabs

func Tabs() app.HTMLElem

Tabs organize groups of related content that are at the same level of hierarchy.

Tabs contain multiple primary or secondary tab children. Use the same type of tab in a tab bar.

https://github.com/material-components/material-web/blob/main/docs/components/tabs.md#mdtabs-md-tabs

func TextButton

func TextButton() app.HTMLElem

Text buttons are used for the lowest priority actions, especially when presenting multiple options.

https://github.com/material-components/material-web/blob/main/docs/components/button.md#mdtextbutton-md-text-button

Types

This section is empty.

Jump to

Keyboard shortcuts

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