modaldialog

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2026 License: MIT Imports: 5 Imported by: 0

README

ModalDialog

Modal dialog overlay with backdrop and close button.

Import

"github.com/tinywasm/components/modaldialog"

Usage

import (
    "github.com/tinywasm/components/modaldialog"
    . "github.com/tinywasm/html"
)

m := &modaldialog.ModalDialog{
    Title: "Confirm Action",
    Content: P("Are you sure?"),
}

// To open
m.Open()

Properties

  • Title (string): Modal title.
  • Content (dom.Component): Modal body content.

Methods

  • Open(): Shows the modal.

Back to Catalog

Documentation

Index

Constants

View Source
const (
	PartBackdrop = widget.Part("backdrop")
	PartPanel    = widget.Part("panel")
	PartHeader   = widget.Part("header")
	PartBody     = widget.Part("body")
	PartActions  = widget.Part("actions")
	PartClose    = widget.Part("close")
)
View Source
const NameModalDialog = widget.Name("modaldialog")

NameModalDialog is the widget name for modal dialog.

Variables

This section is empty.

Functions

This section is empty.

Types

type ModalDialog

type ModalDialog struct {
	Element
	Title   string
	Content Component

	// HideClose drops the "×" from the header. Set it when the dialog's own
	// content already offers an explicit way out — a confirmation with
	// Cancel/Confirm buttons, where a third exit is one more thing to read and
	// says nothing Cancel does not. Clicking the backdrop still closes.
	HideClose bool
	// contains filtered or unexported fields
}

ModalDialog represents a modal dialog component.

func (*ModalDialog) Close added in v0.1.10

func (m *ModalDialog) Close()

Close hides the dialog programmatically.

func (*ModalDialog) Init

func (m *ModalDialog) Init(_ Ctx)

func (*ModalDialog) Open

func (m *ModalDialog) Open()

func (*ModalDialog) Render

func (m *ModalDialog) Render() *Element

func (*ModalDialog) RenderCSS

func (m *ModalDialog) RenderCSS() *css.Stylesheet

RenderCSS defines the modaldialog visual contract using the style DSL.

func (*ModalDialog) WidgetKind added in v0.1.13

func (m *ModalDialog) WidgetKind() widget.Kind

func (*ModalDialog) WidgetName added in v0.1.13

func (m *ModalDialog) WidgetName() widget.Name

Jump to

Keyboard shortcuts

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