Documentation
¶
Overview ¶
Package col implements creation of columns.
Index ¶
- func New(size ...int) core.Col
- type Col
- func (c *Col) Add(components ...core.Component) core.Col
- func (c *Col) GetHeight(provider core.Provider, cell *entity.Cell) float64
- func (c *Col) GetSize() int
- func (c *Col) GetStructure() *node.Node[core.Structure]
- func (c *Col) Render(provider core.Provider, cell entity.Cell, createCell bool)
- func (c *Col) SetConfig(config *entity.Config)
- func (c *Col) WithStyle(style *props.Cell) core.Col
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
New is responsible to create an instance of core.Col.
Example ¶
ExampleNew demonstrates how to create a Col instance.
package main
import (
"github.com/flanksource/maroto/v2"
"github.com/flanksource/maroto/v2/pkg/components/col"
"github.com/flanksource/maroto/v2/pkg/components/row"
)
func main() {
// size is an optional parameters, if not provided, maroto
// will apply the maximum size, even if custom size is applied.
size := 12
col := col.New(size)
row := row.New(10).Add(col)
m := maroto.New()
m.AddRows(row)
// Do things and generate
_, _ = m.Generate()
}
Output:
Types ¶
type Col ¶
type Col struct {
// contains filtered or unexported fields
}
func (*Col) Add ¶
Add is responsible to add a component to a core.Col.
Example ¶
ExampleCol_Add demonstrates how to add components to Col.
package main
import (
"github.com/flanksource/maroto/v2"
"github.com/flanksource/maroto/v2/pkg/components/code"
"github.com/flanksource/maroto/v2/pkg/components/col"
"github.com/flanksource/maroto/v2/pkg/components/row"
"github.com/flanksource/maroto/v2/pkg/components/signature"
"github.com/flanksource/maroto/v2/pkg/components/text"
)
func main() {
col := col.New()
text := text.New("text content")
qrCode := code.NewQr("qrcode")
signature := signature.New("signature label")
col.Add(text, qrCode, signature)
row := row.New(10).Add(col)
m := maroto.New()
m.AddRows(row)
// Do things and generate
_, _ = m.Generate()
}
Output:
func (*Col) GetStructure ¶
GetStructure returns the Structure of a core.Col.
func (*Col) WithStyle ¶
WithStyle sets the style for the column.
Example ¶
ExampleCol_WithStyle demonstrates how to add style to Col.
package main
import (
"github.com/flanksource/maroto/v2"
"github.com/flanksource/maroto/v2/pkg/components/col"
"github.com/flanksource/maroto/v2/pkg/components/row"
"github.com/flanksource/maroto/v2/pkg/consts/border"
"github.com/flanksource/maroto/v2/pkg/consts/linestyle"
"github.com/flanksource/maroto/v2/pkg/props"
)
func main() {
col := col.New()
col.WithStyle(&props.Cell{
BackgroundColor: &props.Color{
Red: 10,
Green: 100,
Blue: 150,
},
BorderColor: &props.Color{
Red: 55,
Green: 10,
Blue: 60,
},
BorderType: border.Full,
BorderThickness: 0.1,
LineStyle: linestyle.Dashed,
})
row := row.New(10).Add(col)
m := maroto.New()
m.AddRows(row)
// Do things and generate
_, _ = m.Generate()
}
Output:
Click to show internal directories.
Click to hide internal directories.