mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
more docs
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
# Height
|
||||
|
||||
The `height` style sets a widget's height. By default, it sets the height of the content area, but if `box-sizing` is set to `border-box` it sets the height of the border area.
|
||||
The `height` rule sets a widget's height. By default, it sets the height of the content area, but if `box-sizing` is set to `border-box` it sets the height of the border area.
|
||||
|
||||
## Example
|
||||
|
||||
=== "width.py"
|
||||
=== "height.py"
|
||||
|
||||
```python
|
||||
--8<-- "docs/examples/styles/height.py"
|
||||
|
||||
@@ -42,9 +42,9 @@ overflow-x: scroll;
|
||||
|
||||
```python
|
||||
# Hide the vertical scrollbar
|
||||
self.styles.overflow_y = "hidden"
|
||||
widget.styles.overflow_y = "hidden"
|
||||
|
||||
# Always show the horizontal scrollbar
|
||||
self.styles.overflow_x = "scroll"
|
||||
widget.styles.overflow_x = "scroll"
|
||||
|
||||
```
|
||||
|
||||
43
docs/styles/scrollbar.md
Normal file
43
docs/styles/scrollbar.md
Normal file
@@ -0,0 +1,43 @@
|
||||
# Scrollbar colors
|
||||
|
||||
There are a number of rules to set the colors used in Textual scrollbars. You won't typically need to do this, as the default themes have carefully chosen colors, but you can if you want to.
|
||||
|
||||
| Rule | Color |
|
||||
| ---------------------------- | ------------------------------------------------------- |
|
||||
| `scrollbar-color` | Scrollbar "thumb" (movable part) |
|
||||
| `scrollbar-color-hover` | Scrollbar thumb when the mouse is hovering over it |
|
||||
| `scrollbar-color-active` | Scrollbar thumb when it is active (being dragged) |
|
||||
| `scrollbar-background` | Scrollbar background |
|
||||
| `scrollbar-background-hover` | Scrollbar background when the mouse is hovering over it |
|
||||
| `scrollbar-color-active` | Scrollbar background when the thumb is being dragged |
|
||||
|
||||
## Example
|
||||
|
||||
In this example we have two panels, with different scrollbar colors set for each.
|
||||
|
||||
=== "scrollbars.py"
|
||||
|
||||
```python
|
||||
--8<-- "docs/examples/styles/scrollbars.py"
|
||||
```
|
||||
|
||||
=== "Output"
|
||||
|
||||
```{.textual path="docs/examples/styles/scrollbars.py"}
|
||||
```
|
||||
|
||||
## CSS
|
||||
|
||||
```sass
|
||||
/* Set widget scrollbar color to yellow */
|
||||
Widget {
|
||||
scrollbar-color: yellow;
|
||||
}
|
||||
```
|
||||
|
||||
## Python
|
||||
|
||||
```python
|
||||
# Set the scrollbar color to yellow
|
||||
widget.styles.scrollbar_color = "yellow"
|
||||
```
|
||||
37
docs/styles/scrollbar_size.md
Normal file
37
docs/styles/scrollbar_size.md
Normal file
@@ -0,0 +1,37 @@
|
||||
# Scrollbar-size
|
||||
|
||||
The `scrollbar-size` rule changes the size of the scrollbars. It takes 2 integers for horizontal and vertical scrollbar size respectively.
|
||||
|
||||
The scrollbar dimensions may also be set individually with `scrollbar-size-horizontal` and `scrollbar-size-vertical`.
|
||||
|
||||
## Example
|
||||
|
||||
In this example we modify the size of the widgets scrollbar to be _much_ larger than usual.
|
||||
|
||||
=== "scrollbar_size.py"
|
||||
|
||||
```python
|
||||
--8<-- "docs/examples/styles/scrollbar_size.py"
|
||||
```
|
||||
|
||||
=== "Output"
|
||||
|
||||
```{.textual path="docs/examples/styles/scrollbar_size.py"}
|
||||
```
|
||||
|
||||
## CSS
|
||||
|
||||
```sass
|
||||
/* Set horizontal scrollbar to 10, and vertical scrollbar to 4 */
|
||||
Widget {
|
||||
scrollbar-size: 10 4;
|
||||
}
|
||||
```
|
||||
|
||||
## Python
|
||||
|
||||
```python
|
||||
# Set horizontal scrollbar to 10, and vertical scrollbar to 4
|
||||
widget.styles.horizontal_scrollbar = 10
|
||||
widget.styles.vertical_scrollbar = 10
|
||||
```
|
||||
@@ -1,6 +1,6 @@
|
||||
# Width
|
||||
|
||||
The `width` style sets a widget's width. By default, it sets the width of the content area, but if `box-sizing` is set to `border-box` it sets the width of the border area.
|
||||
The `width` rule sets a widget's width. By default, it sets the width of the content area, but if `box-sizing` is set to `border-box` it sets the width of the border area.
|
||||
|
||||
## Example
|
||||
|
||||
|
||||
Reference in New Issue
Block a user