brick/programs/TableDemo.hs

33 lines
728 B
Haskell
Raw Normal View History

{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE CPP #-}
module Main where
#if !(MIN_VERSION_base(4,11,0))
import Data.Monoid ((<>))
#endif
import Brick
import Brick.Widgets.Table
ui :: Widget ()
2021-02-01 07:35:22 +03:00
ui = renderTable outerTable
2021-02-01 06:19:16 +03:00
2021-02-01 07:35:03 +03:00
innerTable :: Table ()
innerTable =
surroundingBorder False $
table [ [txt "inner", txt "table"]
, [txt "is", txt "here"]
]
2021-02-01 07:35:22 +03:00
outerTable :: Table ()
outerTable =
2021-02-01 06:19:16 +03:00
alignCenter 1 $
alignRight 2 $
table [ [txt "Left", txt "Center", txt "Right"]
, [txt "X", txt "Some things", txt "A"]
2021-02-01 07:35:03 +03:00
, [renderTable innerTable, txt "are", txt "B"]
2021-02-01 06:19:16 +03:00
, [txt "Z", txt "centered", txt "C"]
]
main :: IO ()
main = simpleMain ui