Updated Container API (markdown)

Jakub Sobon 2019-03-02 23:22:22 -05:00
parent 24c59b8a5e
commit 796e8a8160
1 changed files with 30 additions and 0 deletions

@ -141,6 +141,36 @@ if err != nil {
The following options can be used to align a widget within the container both
horizontally and vertically.
[[/images/container-api/aligned_button.gif|aligned_button]]
The following code aligns the button widget into the top right corner as shown above:
```go
tb, err := termbox.New()
if err != nil {
panic(err)
}
defer tb.Close()
b, err := button.New("hello world", func() error {
return nil
},
)
if err != nil {
return err
}
c, err := container.New(
t,
container.PlaceWidget(b),
container.AlignHorizontal(align.HorizontalRight),
container.AlignVertical(align.VerticalTop),
)
if err != nil {
return err
}
```
#### [container.AlignHorizontal](https://godoc.org/github.com/mum4k/termdash/container#AlignHorizontal)
The **container.AlignHorizontal** option is used to specify horizontal alignment for the widget. Refer to the [[Align API|align-api]] for alignment options.