moar docs

This commit is contained in:
Will McGugan
2022-07-30 22:33:55 +01:00
parent 7040d00c7b
commit 99ccbc5eb8
12 changed files with 227 additions and 0 deletions

25
docs/styles/max_height.md Normal file
View File

@@ -0,0 +1,25 @@
# Max-height
The `max-height` rule sets a maximum width for a widget.
## CSS
```sass
/* Set a maximum height of 10 rows */
max-height: 10;
/* Set a maximum height of 25% of the screen height */
max-height: 25vh;
```
## Python
```python
# Set the maximum width to 10 rows
widget.styles.max_height = 10
# Set the maximum width to 25% of the screen width
widget.styles.max_height = "25vw"
```

25
docs/styles/max_width.md Normal file
View File

@@ -0,0 +1,25 @@
# Max-width
The `max-width` rule sets a maximum width for a widget.
## CSS
```sass
/* Set a maximum width of 10 cells */
max-width: 10;
/* Set a maximum width of 25% of the screen width */
max-width: 25vh;
```
## Python
```python
# Set the maximum width to 10 cells
widget.styles.max_width = 10
# Set the maximum width to 25% of the screen width
widget.styles.max_width = "25vw"
```

25
docs/styles/min_height.md Normal file
View File

@@ -0,0 +1,25 @@
# Min-height
The `min-height` rule sets a minimum height for a widget.
## CSS
```sass
/* Set a minimum height of 10 rows */
min-height: 10;
/* Set a minimum height of 25% of the screen height */
min-height: 25vh;
```
## Python
```python
# Set the minimum height to 10 rows
self.styles.min_height = 10
# Set the minimum height to 25% of the screen height
self.styles.min_height = "25vh"
```

25
docs/styles/min_width.md Normal file
View File

@@ -0,0 +1,25 @@
# Min-width
The `min-width` rules sets a minimum width for a widget.
## CSS
```sass
/* Set a minimum width of 10 cells */
min-width: 10;
/* Set a minimum width of 25% of the screen width */
min-width: 25vh;
```
## Python
```python
# Set the minimum width to 10 cells
widget.styles.min_width = 10
# Set the minimum width to 25% of the screen height
widget.styles.min_width = "25vh"
```

50
docs/styles/overflow.md Normal file
View File

@@ -0,0 +1,50 @@
# Overflow
The `overflow` rule specifies if and when scrollbars should be displayed on the `x` and `y` axis. There are two values for each scrollbar, which may be set together or independently to one of the follow three values:
- `"auto"` Automatically show the scrollbar if the content doesn't fit
- `"hidden"` Never show the scrollbar
- `"scroll"` Always show the scrollbar
The default is "auto" which will show the scrollbar if content doesn't fit within container, otherwise the scrollbar will be hidden.
## Example
Here we split the screen in to left and right sections, each with three vertically scrolling widgets that do not fit in to the height of the terminal.
The left side has `overflow-y: auto` (the default) and will automatically show a scrollbar. The right side has `overflow-y: hidden` which will prevent a scrollbar from being show.
=== "width.py"
```python
--8<-- "docs/examples/styles/overflow.py"
```
=== "Output"
```{.textual path="docs/examples/styles/overflow.py"}
```
## CSS
```sass
/* Automatic scrollbars on both axies (the default) */
overflow: auto auto;
/* Hide the vertical scrollbar */
overflow-y: hidden;
/* Always show the horizontal scrollbar */
overflow-x: scroll;
```
## Python
```python
# Hide the vertical scrollbar
self.styles.overflow_y = "hidden"
# Always show the horizontal scrollbar
self.styles.overflow_x = "scroll"
```