Box

Rich has a number of constants that set the box characters used to draw tables and panels. To select a box style import one of the constants below from rich.box. For example:

from rich import box
table = Table(box=box.SQUARE)

Note

Some of the box drawing characters will not display correctly on Windows legacy terminal (cmd.exe) with raster fonts, and are disabled by default. If you want the full range of box options on Windows legacy terminal, use a truetype font and set the safe_box parameter on the Table class to False.

The following table is generated with this command:

python -m rich.box
                                                                                    ╭───────────────╮
                                                                                    Box Constants
                                                                                    ╰───────────────╯

        box.ASCII                 box.ASCII2            box.ASCII_DOUBLE_HEAD           box.DOUBLE               box.DOUBLE_EDGE               box.HEAVY               box.HEAVY_EDGE     
+-----------------------+  +-----------+-----------+  +-----------+-----------+  ╔═══════════╦═══════════╗  ╔═══════════╤═══════════╗  ┏━━━━━━━━━━━┳━━━━━━━━━━━┓  ┏━━━━━━━━━━━┯━━━━━━━━━━┓
| Header 1  | Header 2  |  | Header 1  | Header 2  |  | Header 1  | Header 2  |  ║ Header 1   Header 2  ║  ║ Header 1   Header 2  ║  ┃ Header 1   Header 2  ┃  ┃ Header 1   Header 2 ┃
|-----------+-----------|  +-----------+-----------+  +===========+===========+  ╠═══════════╬═══════════╣  ╟───────────┼───────────╢  ┣━━━━━━━━━━━╋━━━━━━━━━━━┫  ┠───────────┼──────────┨
| Cell      | Cell      |  | Cell      | Cell      |  | Cell      | Cell      |  ║ Cell      ║ Cell      ║  ║ Cell      │ Cell      ║  ┃ Cell      ┃ Cell      ┃  ┃ Cell      │ Cell     ┃
| Cell      | Cell      |  | Cell      | Cell      |  | Cell      | Cell      |  ║ Cell      ║ Cell      ║  ║ Cell      │ Cell      ║  ┃ Cell      ┃ Cell      ┃  ┃ Cell      │ Cell     ┃
|-----------+-----------|  +-----------+-----------+  +-----------+-----------+  ╠═══════════╬═══════════╣  ╟───────────┼───────────╢  ┣━━━━━━━━━━━╋━━━━━━━━━━━┫  ┠───────────┼──────────┨
| Footer 1  | Footer 2  |  | Footer 1  | Footer 2  |  | Footer 1  | Footer 2  |  ║ Footer 1   Footer 2  ║  ║ Footer 1   Footer 2  ║  ┃ Footer 1   Footer 2  ┃  ┃ Footer 1   Footer 2 ┃
+-----------------------+  +-----------+-----------+  +-----------+-----------+  ╚═══════════╩═══════════╝  ╚═══════════╧═══════════╝  ┗━━━━━━━━━━━┻━━━━━━━━━━━┛  ┗━━━━━━━━━━━┷━━━━━━━━━━┛


     box.HEAVY_HEAD             box.HORIZONTALS             box.MARKDOWN                box.MINIMAL          box.MINIMAL_DOUBLE_HEAD    box.MINIMAL_HEAVY_HEAD          box.ROUNDED       
┏━━━━━━━━━━━┳━━━━━━━━━━━┓   ───────────────────────                                          ╷                          ╷                          ╷              ╭───────────┬──────────╮
┃ Header 1   Header 2   Header 1    Header 2     | Header 1  | Header 2  |    Header 1   Header 2       Header 1   Header 2       Header 1   Header 2   Header 1   Header 2 │
┡━━━━━━━━━━━╇━━━━━━━━━━━┩   ───────────────────────   |-----------|-----------|  ╶───────────┼───────────╴   ═══════════╪═══════════   ╺━━━━━━━━━━━┿━━━━━━━━━━━╸  ├───────────┼──────────┤
│ Cell      │ Cell      │    Cell        Cell         | Cell      | Cell      |    Cell      │ Cell           Cell      │ Cell           Cell      │ Cell         │ Cell      │ Cell     │
│ Cell      │ Cell      │    Cell        Cell         | Cell      | Cell      |    Cell      │ Cell           Cell      │ Cell           Cell      │ Cell         │ Cell      │ Cell     │
├───────────┼───────────┤   ───────────────────────   |-----------|-----------|  ╶───────────┼───────────╴   ───────────┼───────────   ╶───────────┼───────────╴  ├───────────┼──────────┤
│ Footer 1   Footer 2   Footer 1    Footer 2     | Footer 1  | Footer 2  |    Footer 1   Footer 2       Footer 1   Footer 2       Footer 1   Footer 2   Footer 1   Footer 2 │
└───────────┴───────────┘   ───────────────────────                                          ╵                          ╵                          ╵              ╰───────────┴──────────╯


       box.SIMPLE               box.SIMPLE_HEAD           box.SIMPLE_HEAVY              box.SQUARE           box.SQUARE_DOUBLE_HEAD  
                                                                                ┌───────────┬───────────┐  ┌───────────┬───────────┐
 Header 1    Header 2       Header 1    Header 2       Header 1    Header 2   Header 1   Header 2  │  │ Header 1   Header 2  │
───────────────────────    ───────────────────────    ━━━━━━━━━━━━━━━━━━━━━━━   ├───────────┼───────────┤  ╞═══════════╪═══════════╡
Cell        Cell           Cell        Cell           Cell        Cell          │ Cell      │ Cell      │  │ Cell      │ Cell      │
Cell        Cell           Cell        Cell           Cell        Cell          │ Cell      │ Cell      │  │ Cell      │ Cell      │
───────────────────────                               ━━━━━━━━━━━━━━━━━━━━━━━   ├───────────┼───────────┤  ├───────────┼───────────┤
 Footer 1    Footer 2       Footer 1    Footer 2       Footer 1    Footer 2   Footer 1   Footer 2  │  │ Footer 1   Footer 2  │
                                                                                └───────────┴───────────┘  └───────────┴───────────┘