dropdown

package
v0.0.0-...-8815ff5 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

templ: version: v0.3.960

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DropdownMenu(args DropdownMenuArgs) templ.Component

DropdownMenu renders the main dropdown wrapper with Datastar state management

func DropdownMenuContent(args DropdownMenuContentArgs) templ.Component

DropdownMenuContent renders the dropdown content panel

func DropdownMenuGroup(args DropdownMenuGroupArgs) templ.Component

DropdownMenuGroup renders a logical grouping of menu items

func DropdownMenuItem(args DropdownMenuItemArgs) templ.Component

DropdownMenuItem renders a clickable menu item

func DropdownMenuLabel(args DropdownMenuLabelArgs) templ.Component

DropdownMenuLabel renders a non-interactive label

func DropdownMenuSeparator(args DropdownMenuSeparatorArgs) templ.Component

DropdownMenuSeparator renders a visual separator

func DropdownMenuShortcut(args DropdownMenuShortcutArgs) templ.Component

DropdownMenuShortcut renders keyboard shortcut text

func DropdownMenuTrigger(args DropdownMenuTriggerArgs) templ.Component

DropdownMenuTrigger renders the trigger button that opens/closes the dropdown

Types

type DropdownHandler struct {
	// contains filtered or unexported fields
}

DropdownHandler creates handlers for dropdown components

type DropdownMenuArgs struct {
	// ID provides a unique identifier for the dropdown (auto-generated if not provided)
	ID string

	// Class allows additional CSS classes to be added
	Class string

	// Attributes allows additional HTML attributes to be added
	Attributes templ.Attributes

	// Open controls the open state (for controlled usage)
	Open bool

	// DefaultOpen sets the initial open state
	DefaultOpen bool
}

DropdownMenuArgs defines the properties for the DropdownMenu root component

type DropdownMenuContentArgs struct {
	// ID is the dropdown identifier (required to link to the correct dropdown)
	ID string

	// Class allows additional CSS classes to be added
	Class string

	// Attributes allows additional HTML attributes to be added
	Attributes templ.Attributes

	// Align specifies the alignment relative to the trigger
	// Options: "start", "center", "end"
	Align string

	// Side specifies which side of the trigger to align to
	// Options: "top", "right", "bottom", "left"
	Side string

	// SideOffset specifies the distance from the trigger
	SideOffset int
}

DropdownMenuContentArgs defines the properties for the DropdownMenuContent component

type DropdownMenuGroupArgs struct {
	// ID is the dropdown identifier (optional for groups)
	ID string

	// Class allows additional CSS classes to be added
	Class string

	// Attributes allows additional HTML attributes to be added
	Attributes templ.Attributes
}

DropdownMenuGroupArgs defines the properties for the DropdownMenuGroup component

type DropdownMenuItemArgs struct {
	// ID is the dropdown identifier (required to link to the correct dropdown)
	ID string

	// Class allows additional CSS classes to be added
	Class string

	// Attributes allows additional HTML attributes to be added
	Attributes templ.Attributes

	// Inset adds left padding for nested items
	Inset bool

	// Variant defines the visual style of the item
	// Options: "default", "destructive"
	Variant string

	// Disabled makes the item non-interactive
	Disabled bool

	// AsChild renders the item as a child element (for composition)
	AsChild bool

	// OnClick is an optional Datastar expression to execute after closing the dropdown
	// Example: "@post('/api/action')" or "$mySignal = true"
	OnClick string
}

DropdownMenuItemArgs defines the properties for the DropdownMenuItem component

type DropdownMenuLabelArgs struct {
	// ID is the dropdown identifier (optional for labels)
	ID string

	// Class allows additional CSS classes to be added
	Class string

	// Attributes allows additional HTML attributes to be added
	Attributes templ.Attributes

	// Inset adds left padding for nested labels
	Inset bool
}

DropdownMenuLabelArgs defines the properties for the DropdownMenuLabel component

type DropdownMenuSeparatorArgs struct {
	// ID is the dropdown identifier (optional for separators)
	ID string

	// Class allows additional CSS classes to be added
	Class string

	// Attributes allows additional HTML attributes to be added
	Attributes templ.Attributes
}

DropdownMenuSeparatorArgs defines the properties for the DropdownMenuSeparator component

type DropdownMenuShortcutArgs struct {
	// ID is the dropdown identifier (optional for shortcuts)
	ID string

	// Class allows additional CSS classes to be added
	Class string

	// Attributes allows additional HTML attributes to be added
	Attributes templ.Attributes
}

DropdownMenuShortcutArgs defines the properties for the DropdownMenuShortcut component

type DropdownMenuTriggerArgs struct {
	// ID is the dropdown identifier (required to link to the correct dropdown)
	ID string

	// Class allows additional CSS classes to be added
	Class string

	// Attributes allows additional HTML attributes to be added
	Attributes templ.Attributes

	// AsChild renders the trigger as a child element (for composition)
	AsChild bool

	// Disabled makes the trigger non-interactive
	Disabled bool
}

DropdownMenuTriggerArgs defines the properties for the DropdownMenuTrigger component

type DropdownSignals struct {
	Open bool `json:"open"`
}

DropdownSignals defines the signal structure for dropdown components

Jump to

Keyboard shortcuts

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