summaryrefslogtreecommitdiffstats
path: root/docs/source/panel.rst
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-14 20:18:28 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-14 20:18:28 +0000
commitf8363b456f1ab31ee56abad579b215af195093d5 (patch)
treeb1500c675c2e0a55fb75721a854e1510acf7c862 /docs/source/panel.rst
parentInitial commit. (diff)
downloadrich-f8363b456f1ab31ee56abad579b215af195093d5.tar.xz
rich-f8363b456f1ab31ee56abad579b215af195093d5.zip
Adding upstream version 9.11.0.upstream/9.11.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'docs/source/panel.rst')
-rw-r--r--docs/source/panel.rst24
1 files changed, 24 insertions, 0 deletions
diff --git a/docs/source/panel.rst b/docs/source/panel.rst
new file mode 100644
index 0000000..422f023
--- /dev/null
+++ b/docs/source/panel.rst
@@ -0,0 +1,24 @@
+Panel
+=====
+
+To draw a border around text or other renderable, construct a :class:`~rich.panel.Panel` with the renderable as the first positional argument. Here's an example::
+
+ from rich import print
+ from rich.panel import Panel
+ print(Panel("Hello, [red]World!"))
+
+You can change the style of the panel by setting the ``box`` argument to the Panel constructor. See :ref:`appendix_box` for a list of available box styles.
+
+Panels will extend to the full width of the terminal. You can make panel *fit* the content by setting ``expand=False`` on the constructor, or by creating the Panel with :meth:`~rich.panel.Panel.fit`. For example::
+
+ from rich import print
+ from rich.panel import Panel
+ print(Panel.fit("Hello, [red]World!"))
+
+The Panel constructor accepts a ``title`` argument which will draw a title within the panel::
+
+ from rich import print
+ from rich.panel import Panel
+ print(Panel("Hello, [red]World!", title="Welcome"))
+
+See :class:`~rich.panel.Panel` for details how to customize Panels.