checkbox

package
v2.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package checkbox implements creation of checkboxes.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(label string, ps ...props.Checkbox) core.Component

New is responsible to create an instance of a Checkbox.

Example

ExampleNew demonstrates how to create a checkbox component.

m := maroto.New()

checkbox := checkbox.New("checkbox label", props.Checkbox{
	Checked: true,
})
col := col.New(12).Add(checkbox)
m.AddRow(10, col)

// generate document

func NewAutoRow

func NewAutoRow(label string, ps ...props.Checkbox) core.Row

NewAutoRow is responsible for creating an instance of Checkbox grouped in a Row with automatic height.

Example

ExampleNewAutoRow demonstrates how to create a checkbox component wrapped into a row with automatic height.

m := maroto.New()

checkboxRow := checkbox.NewAutoRow("checkbox label", props.Checkbox{
	Checked: true,
	Size:    5,
	Top:     2,
	Left:    2,
})
m.AddRows(checkboxRow)

// generate document

func NewCol

func NewCol(size int, label string, ps ...props.Checkbox) core.Col

NewCol is responsible to create an instance of a Checkbox wrapped in a Col.

Example

ExampleNewCol demonstrates how to create a checkbox component wrapped into a column.

m := maroto.New()

checkboxCol := checkbox.NewCol(12, "checkbox label")
m.AddRow(10, checkboxCol)

// generate document

func NewRow

func NewRow(height float64, label string, ps ...props.Checkbox) core.Row

NewRow is responsible to create an instance of a Checkbox wrapped in a Row.

Example

ExampleNewRow demonstrates how to create a checkbox component wrapped into a row.

m := maroto.New()

checkboxRow := checkbox.NewRow(10, "checkbox label")
m.AddRows(checkboxRow)

// generate document

Types

type Checkbox

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

func (*Checkbox) GetHeight

func (c *Checkbox) GetHeight(_ core.Provider, _ *entity.Cell) float64

GetHeight returns the height that the checkbox will have in the PDF.

func (*Checkbox) GetStructure

func (c *Checkbox) GetStructure() *node.Node[core.Structure]

GetStructure returns the Structure of a Checkbox.

func (*Checkbox) Render

func (c *Checkbox) Render(provider core.Provider, cell *entity.Cell)

Render renders a Checkbox into a PDF context.

func (*Checkbox) SetConfig

func (c *Checkbox) SetConfig(config *entity.Config)

SetConfig sets the config.

Jump to

Keyboard shortcuts

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