mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Add new visibility example.
This new example shows how we can have an invisible container with visible children.
This commit is contained in:
22
docs/examples/styles/visibility_containers.css
Normal file
22
docs/examples/styles/visibility_containers.css
Normal 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;
|
||||
}
|
||||
30
docs/examples/styles/visibility_containers.py
Normal file
30
docs/examples/styles/visibility_containers.py
Normal 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")
|
||||
Reference in New Issue
Block a user