modal

package
v0.0.39 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

templ: version: v0.3.977

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Action

func Action(props ...ActionProps) templ.Component

Action renders the modal-action area for buttons.

func Backdrop

func Backdrop(modalID string) templ.Component

Backdrop renders a click-outside overlay that closes the modal. Must be placed as a sibling of modal-box inside the modal div.

func Box

func Box(props ...BoxProps) templ.Component

Box renders the modal-box content wrapper.

func CloseButton

func CloseButton(modalID string, props ...CloseButtonProps) templ.Component

CloseButton renders a close button inside the modal.

func Modal(props Props) templ.Component

Modal renders a DaisyUI modal controlled by Datastar signals. Uses a hidden checkbox (.modal-toggle) with data-attr:checked to sync state.

func OpenButton

func OpenButton(modalID string, props ...OpenButtonProps) templ.Component

OpenButton renders a button that opens the modal.

Types

type ActionProps

type ActionProps struct {
	Class      string
	Attributes templ.Attributes
}

ActionProps configures the modal action area.

type BoxProps

type BoxProps struct {
	ID         string
	Class      string
	Attributes templ.Attributes
}

BoxProps configures the modal content box.

type CloseButtonProps

type CloseButtonProps struct {
	Class      string
	Attributes templ.Attributes
}

type ModalSignals

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

ModalSignals holds the reactive state for a modal.

type OpenButtonProps

type OpenButtonProps struct {
	Class      string
	Attributes templ.Attributes
}

type Position

type Position string
const (
	PositionDefault Position = ""
	PositionTop     Position = "modal-top"
	PositionMiddle  Position = "modal-middle"
	PositionBottom  Position = "modal-bottom"
)

type Props

type Props struct {
	ID         string
	Class      string
	Attributes templ.Attributes
	Position   Position
}

Props configures the modal container. ID is required so that child components (Box, Backdrop, OpenButton, CloseButton) can reference the same signal.

Jump to

Keyboard shortcuts

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