Add example to grid styles docs, rename it

This commit is contained in:
Darren Burns
2022-10-07 14:59:37 +01:00
parent 72dff52212
commit 143332efd5
3 changed files with 69 additions and 4 deletions

View File

@@ -0,0 +1,20 @@
Screen {
layout: grid;
grid-size: 3 4;
grid-rows: 1fr;
grid-columns: 1fr;
grid-gutter: 1;
}
Static {
color: auto;
background: lightblue;
height: 100%;
padding: 1 2;
}
#static1 {
tint: magenta 40%;
row-span: 3;
column-span: 2;
}

View File

@@ -0,0 +1,18 @@
from textual.app import App
from textual.widgets import Static
class GridApp(App):
def compose(self):
yield Static("Grid cell 1\n\nrow-span: 3;\ncolumn-span: 2;", id="static1")
yield Static("Grid cell 2", id="static2")
yield Static("Grid cell 3", id="static3")
yield Static("Grid cell 4", id="static4")
yield Static("Grid cell 5", id="static5")
yield Static("Grid cell 6", id="static6")
yield Static("Grid cell 7", id="static7")
app = GridApp(css_path="grid.css")
if __name__ == "__main__":
app.run()