Documentation
¶
Overview ¶
Package menu contains Material 3 Menu components.
Reference: [Menus](https://m3.material.io/components/menus/overview) Specs: [Menus Specs](https://m3.material.io/components/menus/specs)
Index ¶
- Constants
- Variables
- func DropdownMenu(expanded bool, onDismissRequest func(), menuItems []api.Composable, ...) api.Composable
- func DropdownMenuItem(textStr string, onClick func(), options ...DropdownMenuItemOption) api.Composable
- func MenuItems(items ...api.Composable) []api.Composable
- type Composer
- type ContentPadding
- type DropdownMenuColors
- type DropdownMenuItemColors
- type DropdownMenuItemOption
- type DropdownMenuItemOptions
- type DropdownMenuOption
- type DropdownMenuOptions
Constants ¶
const DropdownMenuItemDefaultMaxWidth unit.Dp = 280
DropdownMenuItemDefaultMaxWidth is the maximum width for menu items.
const DropdownMenuItemDefaultMinWidth unit.Dp = 112
DropdownMenuItemDefaultMinWidth is the minimum width for menu items.
const DropdownMenuItemHorizontalPadding unit.Dp = 12
DropdownMenuItemHorizontalPadding is the horizontal padding for menu items.
const DropdownMenuVerticalPadding unit.Dp = 8
DropdownMenuVerticalPadding is the vertical padding inside the menu container.
const MenuHorizontalMargin unit.Dp = 48
MenuHorizontalMargin is the horizontal margin around the menu.
const MenuListItemContainerHeight unit.Dp = 48
MenuListItemContainerHeight is the default height for menu items.
const MenuVerticalMargin unit.Dp = 48
MenuVerticalMargin is the vertical margin around the menu.
const ShadowElevation unit.Dp = 3 // MenuTokens.ContainerElevation
ShadowElevation is the default shadow elevation for a menu.
const TonalElevation unit.Dp = 0 // ElevationTokens.Level0
TonalElevation is the default tonal elevation for a menu.
Variables ¶
var MenuDefaults = menuDefaults{}
MenuDefaults contains default values used for DropdownMenu and DropdownMenuItem. Reference: https://m3.material.io/components/menus/specs
Functions ¶
func DropdownMenu ¶
func DropdownMenu( expanded bool, onDismissRequest func(), menuItems []api.Composable, options ...DropdownMenuOption, ) api.Composable
DropdownMenu Composable Uses a Popup to display content on top of other content.
func DropdownMenuItem ¶
func DropdownMenuItem( textStr string, onClick func(), options ...DropdownMenuItemOption, ) api.Composable
DropdownMenuItem Composable
func MenuItems ¶ added in v0.1.60
func MenuItems(items ...api.Composable) []api.Composable
Types ¶
type ContentPadding ¶ added in v0.1.51
ContentPadding represents padding values for content.
type DropdownMenuColors ¶
func DefaultDropdownMenuColors ¶
func DefaultDropdownMenuColors(c Composer) DropdownMenuColors
type DropdownMenuItemColors ¶
type DropdownMenuItemColors struct {
TextColor graphics.Color
LeadingIconColor graphics.Color
TrailingIconColor graphics.Color
DisabledTextColor graphics.Color
DisabledLeadingIconColor graphics.Color
DisabledTrailingIconColor graphics.Color
}
func DefaultDropdownMenuItemColors ¶
func DefaultDropdownMenuItemColors(c Composer) DropdownMenuItemColors
func (DropdownMenuItemColors) LeadingIconColorFor ¶ added in v0.1.51
func (c DropdownMenuItemColors) LeadingIconColorFor(enabled bool) graphics.Color
LeadingIconColorFor returns the leading icon color based on enabled state.
func (DropdownMenuItemColors) TextColorFor ¶ added in v0.1.51
func (c DropdownMenuItemColors) TextColorFor(enabled bool) graphics.Color
TextColorFor returns the text color based on enabled state.
func (DropdownMenuItemColors) TrailingIconColorFor ¶ added in v0.1.51
func (c DropdownMenuItemColors) TrailingIconColorFor(enabled bool) graphics.Color
TrailingIconColorFor returns the trailing icon color based on enabled state.
type DropdownMenuItemOption ¶
type DropdownMenuItemOption func(*DropdownMenuItemOptions)
func WithEnabled ¶
func WithEnabled(enabled bool) DropdownMenuItemOption
func WithLeadingIcon ¶
func WithLeadingIcon(icon api.Composable) DropdownMenuItemOption
func WithMenuItemModifier ¶
func WithMenuItemModifier(mod ui.Modifier) DropdownMenuItemOption
func WithTrailingIcon ¶
func WithTrailingIcon(icon api.Composable) DropdownMenuItemOption
type DropdownMenuItemOptions ¶
type DropdownMenuItemOptions struct {
Modifier ui.Modifier
LeadingIcon api.Composable
TrailingIcon api.Composable
Enabled bool
}
func DefaultDropdownMenuItemOptions ¶
func DefaultDropdownMenuItemOptions() DropdownMenuItemOptions
type DropdownMenuOption ¶
type DropdownMenuOption func(*DropdownMenuOptions)
func WithModifier ¶
func WithModifier(m ui.Modifier) DropdownMenuOption
func WithOffset ¶
func WithOffset(x, y unit.Dp) DropdownMenuOption
type DropdownMenuOptions ¶
func DefaultDropdownMenuOptions ¶
func DefaultDropdownMenuOptions() DropdownMenuOptions