dropdownmenu

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: MIT Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DropdownMenuCheckboxItemFixtures = gx.Fixtures[DropdownMenuCheckboxItemProps]{
	"Checked":   {Name: "status-bar", Checked: true, Children: gx.Text("Status bar")},
	"Unchecked": {Name: "panel", Children: gx.Text("Panel")},
	"Disabled":  {Name: "activity", Disabled: true, Children: gx.Text("Activity bar")},
}
View Source
var DropdownMenuFixtures = gx.Fixtures[DropdownMenuProps]{
	"Menu": {Id: "demo-dropdown", Class: "w-56", Children: gx.Frag(
		DropdownMenuLabel(DropdownMenuLabelProps{Children: gx.Text("My account")}),
		DropdownMenuSeparator(DropdownMenuSeparatorProps{}),
		DropdownMenuGroup(DropdownMenuGroupProps{Label: "Account", Children: gx.Frag(
			DropdownMenuItem(DropdownMenuItemProps{Children: gx.Text("Profile")}),
			DropdownMenuItem(DropdownMenuItemProps{Children: gx.Frag(
				gx.Text("Settings"),
				DropdownMenuShortcut(DropdownMenuShortcutProps{Children: gx.Text("⌘S")}),
			)}),
			DropdownMenuLink(DropdownMenuLinkProps{Href: gx.URL("/docs"), Children: gx.Text("Documentation")}),
		)}),
		DropdownMenuSeparator(DropdownMenuSeparatorProps{}),
		DropdownMenuCheckboxItem(DropdownMenuCheckboxItemProps{Name: "status-bar", Checked: true, Children: gx.Text("Status bar")}),
		DropdownMenuCheckboxItem(DropdownMenuCheckboxItemProps{Name: "panel", Children: gx.Text("Panel")}),
		DropdownMenuSeparator(DropdownMenuSeparatorProps{}),
		DropdownMenuRadioGroup(DropdownMenuRadioGroupProps{Label: "Position", Children: gx.Frag(
			DropdownMenuRadioItem(DropdownMenuRadioItemProps{Name: "demo-dropdown-position", Value: "top", Checked: true, Children: gx.Text("Top")}),
			DropdownMenuRadioItem(DropdownMenuRadioItemProps{Name: "demo-dropdown-position", Value: "bottom", Children: gx.Text("Bottom")}),
		)}),
		DropdownMenuSeparator(DropdownMenuSeparatorProps{}),
		DropdownMenuItem(DropdownMenuItemProps{Variant: Destructive, Children: gx.Text("Sign out")}),
	)},
	"End": {Id: "demo-dropdown-end", Align: End, Children: gx.Frag(
		DropdownMenuItem(DropdownMenuItemProps{Children: gx.Text("Rename")}),
		DropdownMenuItem(DropdownMenuItemProps{Children: gx.Text("Duplicate")}),
		DropdownMenuItem(DropdownMenuItemProps{Disabled: true, Children: gx.Text("Archive")}),
		DropdownMenuItem(DropdownMenuItemProps{Variant: Destructive, Children: gx.Text("Delete")}),
	)},
	"Start": {Id: "demo-dropdown-start", Align: Start, Children: gx.Frag(
		DropdownMenuItem(DropdownMenuItemProps{Children: gx.Text("Rename")}),
		DropdownMenuItem(DropdownMenuItemProps{Children: gx.Text("Duplicate")}),
	)},
	"Sub": {Id: "demo-dropdown-sub", Class: "w-56", Children: gx.Frag(
		DropdownMenuItem(DropdownMenuItemProps{Children: gx.Text("New tab")}),
		DropdownMenuSub(DropdownMenuSubProps{Children: gx.Frag(
			DropdownMenuSubTrigger(DropdownMenuSubTriggerProps{Children: gx.Text("More tools")}),
			DropdownMenuSubContent(DropdownMenuSubContentProps{Class: "w-48", Children: gx.Frag(
				DropdownMenuItem(DropdownMenuItemProps{Children: gx.Text("Save page")}),
				DropdownMenuItem(DropdownMenuItemProps{Children: gx.Text("Create shortcut")}),
				DropdownMenuSeparator(DropdownMenuSeparatorProps{}),
				DropdownMenuItem(DropdownMenuItemProps{Children: gx.Text("Developer tools")}),
			)}),
		)}),
		DropdownMenuSeparator(DropdownMenuSeparatorProps{}),
		DropdownMenuItem(DropdownMenuItemProps{Children: gx.Text("Print")}),
	)},
}
View Source
var DropdownMenuGroupFixtures = gx.Fixtures[DropdownMenuGroupProps]{
	"Default": {Label: "Account", Children: gx.Frag(
		DropdownMenuItem(DropdownMenuItemProps{Children: gx.Text("Profile")}),
		DropdownMenuItem(DropdownMenuItemProps{Children: gx.Text("Billing")}),
	)},
}
View Source
var DropdownMenuItemFixtures = gx.Fixtures[DropdownMenuItemProps]{
	"Item":        {Children: gx.Text("Profile")},
	"Inset":       {Inset: true, Children: gx.Text("Profile")},
	"Destructive": {Variant: Destructive, Children: gx.Text("Delete")},
	"Disabled":    {Disabled: true, Children: gx.Text("Profile")},
}
View Source
var DropdownMenuLabelFixtures = gx.Fixtures[DropdownMenuLabelProps]{
	"Label": {Children: gx.Text("My account")},
	"Inset": {Inset: true, Children: gx.Text("My account")},
}
View Source
var DropdownMenuLinkFixtures = gx.Fixtures[DropdownMenuLinkProps]{"Link": {Href: gx.URL("/docs"), Children: gx.Text("Documentation")}}
View Source
var DropdownMenuRadioGroupFixtures = gx.Fixtures[DropdownMenuRadioGroupProps]{
	"Default": {Label: "Position", Children: gx.Frag(
		DropdownMenuRadioItem(DropdownMenuRadioItemProps{Name: "dropdown-menu-group-position", Value: "top", Checked: true, Children: gx.Text("Top")}),
		DropdownMenuRadioItem(DropdownMenuRadioItemProps{Name: "dropdown-menu-group-position", Value: "bottom", Children: gx.Text("Bottom")}),
	)},
}
View Source
var DropdownMenuRadioItemFixtures = gx.Fixtures[DropdownMenuRadioItemProps]{
	"Checked":   {Name: "dropdown-menu-item-checked", Value: "top", Checked: true, Children: gx.Text("Top")},
	"Unchecked": {Name: "dropdown-menu-item-unchecked", Value: "bottom", Children: gx.Text("Bottom")},
}
View Source
var DropdownMenuSeparatorFixtures = gx.Fixtures[DropdownMenuSeparatorProps]{"Default": {}}
View Source
var DropdownMenuShortcutFixtures = gx.Fixtures[DropdownMenuShortcutProps]{"Default": {Children: gx.Text("⌘K")}}
View Source
var DropdownMenuSubContentFixtures = gx.Fixtures[DropdownMenuSubContentProps]{
	"Content": {Class: "w-48", Children: gx.Frag(
		DropdownMenuItem(DropdownMenuItemProps{Children: gx.Text("Save page")}),
		DropdownMenuItem(DropdownMenuItemProps{Children: gx.Text("Create shortcut")}),
		DropdownMenuSeparator(DropdownMenuSeparatorProps{}),
		DropdownMenuItem(DropdownMenuItemProps{Children: gx.Text("Developer tools")}),
	)},
}
View Source
var DropdownMenuSubFixtures = gx.Fixtures[DropdownMenuSubProps]{
	"Default": {Children: gx.Frag(
		DropdownMenuSubTrigger(DropdownMenuSubTriggerProps{Children: gx.Text("More tools")}),
		DropdownMenuSubContent(DropdownMenuSubContentProps{Children: gx.Frag(
			DropdownMenuItem(DropdownMenuItemProps{Children: gx.Text("Save page")}),
			DropdownMenuItem(DropdownMenuItemProps{Children: gx.Text("Create shortcut")}),
		)}),
	)},
}
View Source
var DropdownMenuSubTriggerFixtures = gx.Fixtures[DropdownMenuSubTriggerProps]{
	"Trigger":  {Children: gx.Text("More tools")},
	"Inset":    {Inset: true, Children: gx.Text("More tools")},
	"Disabled": {Disabled: true, Children: gx.Text("More tools")},
}
View Source
var DropdownMenuTriggerFixtures = gx.Fixtures[DropdownMenuTriggerProps]{
	"Default": {Id: "demo-dropdown", Children: gx.Text("Open menu")},
	"Ghost":   {Id: "demo-dropdown-end", Variant: button.Ghost, Size: button.Sm, Class: "ml-32", Children: gx.Text("Open at the end")},
	"Start":   {Id: "demo-dropdown-start", Variant: button.Secondary, Children: gx.Text("Open at the start")},
	"Sub":     {Id: "demo-dropdown-sub", Children: gx.Text("Open with a sub-menu")},
}

Functions

func DropdownMenu(p DropdownMenuProps) gx.Node
func DropdownMenuCheckboxItem(p DropdownMenuCheckboxItemProps) gx.Node
func DropdownMenuCheckboxItemWrap(n gx.Node) gx.Node

DropdownMenuCheckboxItemWrap renders the item inside a menu, as a page uses it.

func DropdownMenuGroup(p DropdownMenuGroupProps) gx.Node
func DropdownMenuGroupWrap(n gx.Node) gx.Node

DropdownMenuGroupWrap renders the group inside a menu, as a page uses it.

func DropdownMenuItem(p DropdownMenuItemProps) gx.Node
func DropdownMenuItemWrap(n gx.Node) gx.Node

DropdownMenuItemWrap renders the item inside a menu, as a page uses it.

func DropdownMenuLabel(p DropdownMenuLabelProps) gx.Node
func DropdownMenuLink(p DropdownMenuLinkProps) gx.Node
func DropdownMenuLinkWrap(n gx.Node) gx.Node

DropdownMenuLinkWrap renders the item inside a menu, as a page uses it.

func DropdownMenuRadioGroup(p DropdownMenuRadioGroupProps) gx.Node
func DropdownMenuRadioGroupWrap(n gx.Node) gx.Node

DropdownMenuRadioGroupWrap renders the group inside a menu, as a page uses it.

func DropdownMenuRadioItem(p DropdownMenuRadioItemProps) gx.Node
func DropdownMenuRadioItemWrap(n gx.Node) gx.Node

DropdownMenuRadioItemWrap renders the item inside a menu, as a page uses it.

func DropdownMenuSeparator(p DropdownMenuSeparatorProps) gx.Node
func DropdownMenuShortcut(p DropdownMenuShortcutProps) gx.Node
func DropdownMenuSub(p DropdownMenuSubProps) gx.Node
func DropdownMenuSubContent(p DropdownMenuSubContentProps) gx.Node
func DropdownMenuSubContentWrap(n gx.Node) gx.Node

DropdownMenuSubContentWrap renders the content behind its trigger inside a menu, as a page uses it.

func DropdownMenuSubTrigger(p DropdownMenuSubTriggerProps) gx.Node
func DropdownMenuSubTriggerWrap(n gx.Node) gx.Node

DropdownMenuSubTriggerWrap renders the trigger inside a menu, as a page uses it.

func DropdownMenuSubWrap(n gx.Node) gx.Node

DropdownMenuSubWrap renders the sub-menu inside a menu, as a page uses it.

func DropdownMenuTrigger(p DropdownMenuTriggerProps) gx.Node

Types

type Align

type Align string

Align is the edge of the trigger that the menu lines up with.

const (
	Center Align = "center"
	Start  Align = "start"
	End    Align = "end"
)

The alignments of dropdownmenu.DropdownMenu.

type DropdownMenuCheckboxItemProps struct {
	// Name is the name attribute of the checkbox input. A form or a signal reads it.
	Name string
	// Value is the value that the form sends when the item is checked.
	Value string
	// Checked sets the item as checked on the first render.
	Checked bool
	// Disabled turns the item off. The arrow keys pass it.
	Disabled bool
	// Class adds classes to the root element.
	Class string
	// Children is the label of the item.
	Children gx.Node
	// Attrs adds HTML attributes to the root element.
	Attrs gx.Attrs
}
type DropdownMenuGroupProps struct {
	// Label is the accessible name of the group. It is not visible.
	Label string
	// Class adds classes to the root element.
	Class string
	// Children is the items of the group.
	Children gx.Node
	// Attrs adds HTML attributes to the root element.
	Attrs gx.Attrs
}
type DropdownMenuItemProps struct {
	// Variant sets the visual style: Default or Destructive.
	Variant Variant
	// Inset adds left padding, so the item lines up with the checkbox and radio items.
	Inset bool
	// Disabled turns the item off. The arrow keys pass it.
	Disabled bool
	// Class adds classes to the root element.
	Class string
	// Children is the content of the item.
	Children gx.Node
	// Attrs adds HTML attributes to the root element.
	Attrs gx.Attrs
}
type DropdownMenuLabelProps struct {
	// Inset adds left padding, so the label lines up with the checkbox and radio items.
	Inset bool
	// Class adds classes to the root element.
	Class string
	// Children is the text of the label.
	Children gx.Node
	// Attrs adds HTML attributes to the root element.
	Attrs gx.Attrs
}
type DropdownMenuLinkProps struct {
	// Href is the URL that the link opens.
	Href gx.URL
	// Class adds classes to the root element.
	Class string
	// Children is the content of the link.
	Children gx.Node
	// Attrs adds HTML attributes to the root element.
	Attrs gx.Attrs
}
type DropdownMenuProps struct {
	// Id is the id of the root element. The trigger opens the menu by this id.
	Id string
	// Align sets the edge of the trigger that the menu lines up with: Center, Start or End.
	Align Align
	// Class adds classes to the root element.
	Class string
	// Children is the menu items.
	Children gx.Node
	// Attrs adds HTML attributes to the root element.
	Attrs gx.Attrs
}
type DropdownMenuRadioGroupProps struct {
	// Label is the accessible name of the group. It is not visible.
	Label string
	// Class adds classes to the root element.
	Class string
	// Children is the radio items of the group.
	Children gx.Node
	// Attrs adds HTML attributes to the root element.
	Attrs gx.Attrs
}
type DropdownMenuRadioItemProps struct {
	// Name is the name attribute of the radio input. The radio items of one group share
	// the same name.
	Name string
	// Value is the value that the form sends when the item is checked.
	Value string
	// Checked sets the item as checked on the first render.
	Checked bool
	// Disabled turns the item off. The arrow keys pass it.
	Disabled bool
	// Class adds classes to the root element.
	Class string
	// Children is the label of the item.
	Children gx.Node
	// Attrs adds HTML attributes to the root element.
	Attrs gx.Attrs
}
type DropdownMenuSeparatorProps struct {
	// Class adds classes to the root element.
	Class string
	// Attrs adds HTML attributes to the root element.
	Attrs gx.Attrs
}
type DropdownMenuShortcutProps struct {
	// Class adds classes to the root element.
	Class string
	// Children is the text of the keyboard shortcut.
	Children gx.Node
	// Attrs adds HTML attributes to the root element.
	Attrs gx.Attrs
}
type DropdownMenuSubContentProps struct {
	// Class adds classes to the root element.
	Class string
	// Children is the list of items of the sub-menu.
	Children gx.Node
	// Attrs adds HTML attributes to the root element.
	Attrs gx.Attrs
}
type DropdownMenuSubProps struct {
	// Class adds classes to the root element.
	Class string
	// Children is the sub-menu trigger, followed by the sub-menu content.
	Children gx.Node
	// Attrs adds HTML attributes to the root element.
	Attrs gx.Attrs
}
type DropdownMenuSubTriggerProps struct {
	// Inset adds left padding, so the trigger lines up with the checkbox and radio items.
	Inset bool
	// Disabled turns the trigger off. The arrow keys pass it.
	Disabled bool
	// Class adds classes to the root element.
	Class string
	// Children is the label of the trigger. A chevron follows it.
	Children gx.Node
	// Attrs adds HTML attributes to the root element.
	Attrs gx.Attrs
}
type DropdownMenuTriggerProps struct {
	// Id is the id of the menu that the trigger opens.
	Id string
	// Variant sets the visual style of the button: button.Default, button.Secondary,
	// button.Destructive, button.Outline, button.Ghost or button.Link.
	Variant button.Variant
	// Size sets the height and padding of the button: button.Xs, button.Sm, button.Md, button.Lg,
	// or an Icon size for a square button.
	Size button.Size
	// Class adds classes to the root element.
	Class string
	// Children is the button label.
	Children gx.Node
	// Attrs adds HTML attributes to the root element.
	Attrs gx.Attrs
}

type Variant

type Variant string

Variant is the visual style of a menu item.

const (
	Default     Variant = "default"
	Destructive Variant = "destructive"
)

The variants of dropdownmenu.DropdownMenuItem.

Jump to

Keyboard shortcuts

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