mirror of https://github.com/mum4k/termdash.git
Updated Container API (markdown)
parent
08eb5c9cec
commit
d97978d9cd
|
@ -55,7 +55,7 @@ if _, err := container.New(
|
|||
),
|
||||
),
|
||||
); err != nil {
|
||||
panic(err)
|
||||
return fmt.Errorf("container.New => %v", err)
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -124,7 +124,7 @@ b, err := button.New("hello world", func() error {
|
|||
},
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
return fmt.Errorf("button.New => %v", err)
|
||||
}
|
||||
|
||||
c, err := container.New(
|
||||
|
@ -132,7 +132,7 @@ c, err := container.New(
|
|||
container.PlaceWidget(b),
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
return fmt.Errorf("container.New => %v", err)
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -157,7 +157,7 @@ b, err := button.New("hello world", func() error {
|
|||
},
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
return fmt.Errorf("button.New => %v", err)
|
||||
}
|
||||
|
||||
c, err := container.New(
|
||||
|
@ -167,7 +167,7 @@ c, err := container.New(
|
|||
container.AlignVertical(align.VerticalTop),
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
return fmt.Errorf("container.New => %v", err)
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -187,6 +187,33 @@ This section describes container options that specify its style or look.
|
|||
|
||||
Containers don't have any borders by default, use one of the following options to instruct Termdash to draw a border around a container.
|
||||
|
||||
[[/images/container-api/border_styles.gif|border_styles]]
|
||||
|
||||
The following code shows two containers with different border styles as shown above:
|
||||
|
||||
```go
|
||||
tb, err := termbox.New()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
defer tb.Close()
|
||||
|
||||
c, err := container.New(
|
||||
t,
|
||||
container.SplitVertical(
|
||||
container.Left(
|
||||
container.Border(linestyle.Light),
|
||||
),
|
||||
container.Right(
|
||||
container.Border(linestyle.Double),
|
||||
),
|
||||
),
|
||||
)
|
||||
if err != nil {
|
||||
return fmt.Errorf("container.New => %v", err)
|
||||
}
|
||||
```
|
||||
|
||||
#### [container.Border](https://godoc.org/github.com/mum4k/termdash/container#Border):
|
||||
|
||||
The **container.Border** option is used to enable the border and specify its line style. Refer to the [[Linestyle API|linestyle-api]] for the available line styles.
|
||||
|
|
Loading…
Reference in New Issue