Add new visibility example.

This new example shows how we can have an invisible container with visible children.
This commit is contained in:
Rodrigo Girão Serrão
2023-01-06 16:38:31 +00:00
parent d69168a922
commit 2217a8f5fa
2 changed files with 52 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
Horizontal {
padding: 1 2; /* (1)! */
background: white;
}
#top {} /* (2)! */
#middle { /* (3)! */
visibility: hidden;
}
#bot { /* (4)! */
visibility: hidden;
}
#bot > Placeholder { /* (5)! */
visibility: visible;
}
Placeholder {
width: 1fr;
}

View File

@@ -0,0 +1,30 @@
from textual.app import App
from textual.containers import Horizontal, Vertical
from textual.widgets import Placeholder
class VisibilityContainersApp(App):
def compose(self):
yield Vertical(
Horizontal(
Placeholder(),
Placeholder(),
Placeholder(),
id="top",
),
Horizontal(
Placeholder(),
Placeholder(),
Placeholder(),
id="middle",
),
Horizontal(
Placeholder(),
Placeholder(),
Placeholder(),
id="bot",
),
)
app = VisibilityContainersApp(css_path="visibility_containers.css")