Skip to content

Commit 1eecb75

Browse files
authored
docs: panel (#964)
Closes #922
1 parent 512fab2 commit 1eecb75

File tree

2 files changed

+49
-1
lines changed

2 files changed

+49
-1
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Panel
2+
3+
The `panel` component is a versatile [flex](./flex.md) container designed to group and organize elements within a layout. Panels are presented as individual tabs that can be moved to different positions by dragging the tabs around. By default, the top-level return of a `@ui.component` is automatically wrapped in a panel, so you only need to define a panel explicitly if you want to customize it. Customizations can include setting a custom tab title, background color or customizing the flex layout.
4+
5+
## Example
6+
7+
```python
8+
from deephaven import ui
9+
10+
11+
@ui.component
12+
def ui_panel():
13+
text = ui.text_field()
14+
15+
return ui.panel(text, title="Text Field")
16+
17+
18+
my_panel = ui_panel()
19+
```
20+
21+
## Nesting
22+
23+
Panels can only be nested within [ui.row](./dashboard.md#row-api-reference), [ui.column](./dashboard.md#column-api-reference), [ui.stack](./dashboard.md#stack-api-reference) or [ui.dashboard](#./dashboard.md).
24+
25+
```python
26+
from deephaven import ui
27+
28+
my_nested_panel = ui.dashboard([ui.panel("A"), ui.panel("B")])
29+
```
30+
31+
32+
## API Reference
33+
34+
```{eval-rst}
35+
.. dhautofunction:: deephaven.ui.panel
36+
```
37+
38+
39+
40+

plugins/ui/src/deephaven/ui/components/panel.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@
1111
AlignItems,
1212
DimensionValue,
1313
Overflow,
14+
CSSProperties,
1415
)
1516
from ..elements import Element
17+
from ..types import Color
1618

1719

1820
def panel(
@@ -34,8 +36,10 @@ def panel(
3436
padding_end: DimensionValue | None = None,
3537
padding_x: DimensionValue | None = None,
3638
padding_y: DimensionValue | None = None,
39+
background_color: Color | None = None,
40+
UNSAFE_class_name: str | None = None,
41+
UNSAFE_style: CSSProperties | None = None,
3742
key: str | None = None,
38-
**props: Any,
3943
) -> Element:
4044
"""
4145
A panel is a container that can be used to group elements.
@@ -51,13 +55,17 @@ def panel(
5155
gap: The space to display between both rows and columns of children.
5256
column_gap: The space to display between columns of children.
5357
row_gap: The space to display between rows of children.
58+
overflow: Specifies what to do when the elment's content is too long to fit its size.
5459
padding: The padding to apply around the element.
5560
padding_top: The padding to apply above the element.
5661
padding_bottom: The padding to apply below the element.
5762
padding_start: The padding to apply before the element.
5863
padding_end: The padding to apply after the element.
5964
padding_x: The padding to apply to the left and right of the element.
6065
padding_y: The padding to apply to the top and bottom of the element.
66+
background_color: The background color of the element.
67+
UNSAFE_class_name: A CSS class to apply to the element.
68+
UNSAFE_style: A CSS style to apply to the element.
6169
key: A unique identifier used by React to render elements in a list.
6270
6371
Returns:

0 commit comments

Comments
 (0)