mirror of https://github.com/mum4k/termdash.git
Updated Container API (markdown)
parent
0108e42d20
commit
f6537618b0
|
@ -189,7 +189,7 @@ Containers don't have any borders by default, use one of the following options t
|
||||||
|
|
||||||
[[/images/container-api/border_styles.gif|border_styles]]
|
[[/images/container-api/border_styles.gif|border_styles]]
|
||||||
|
|
||||||
The following code shows two containers with different border styles as shown above:
|
The following code shows two containers with different border styles as shown above. The right container has the keyboard focus so its border is highlighted.
|
||||||
|
|
||||||
```go
|
```go
|
||||||
tb, err := termbox.New()
|
tb, err := termbox.New()
|
||||||
|
@ -230,6 +230,28 @@ The **container.FocusedColor** option sets the color of the border when the cont
|
||||||
|
|
||||||
Containers that have a border can also have a text title displayed in the border. The title isn't visible on a container without border.
|
Containers that have a border can also have a text title displayed in the border. The title isn't visible on a container without border.
|
||||||
|
|
||||||
|
[[/images/container-api/border_title.gif|border_title]]
|
||||||
|
|
||||||
|
The following code shows a container with a title in the border that is aligned to the right.
|
||||||
|
|
||||||
|
```go
|
||||||
|
tb, err := termbox.New()
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
defer tb.Close()
|
||||||
|
|
||||||
|
c, err := container.New(
|
||||||
|
t,
|
||||||
|
container.Border(linestyle.Light),
|
||||||
|
container.BorderTitle("hello world"),
|
||||||
|
container.BorderTitleAlignRight(),
|
||||||
|
)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("container.New => %v", err)
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
#### [container.BorderTitle](https://godoc.org/github.com/mum4k/termdash/container#BorderTitle):
|
#### [container.BorderTitle](https://godoc.org/github.com/mum4k/termdash/container#BorderTitle):
|
||||||
|
|
||||||
The **container.BorderTitle** option sets the title to display on the container. The title is displayed above the container and aligned according to the following alignment options.
|
The **container.BorderTitle** option sets the title to display on the container. The title is displayed above the container and aligned according to the following alignment options.
|
||||||
|
|
Loading…
Reference in New Issue