Skip to content

Commit c5dc6d7

Browse files
authored
Merge pull request #61 from openai/add-basic-root
Add BasicRoot widget type
2 parents 5856c50 + 9d6d2e4 commit c5dc6d7

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

chatkit/widgets.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,6 +1005,27 @@ class LineSeries(BaseModel):
10051005
]
10061006
"""Union of all supported chart series types."""
10071007

1008+
1009+
class BasicRoot(WidgetComponentBase):
1010+
"""Layout root capable of nesting components or other roots."""
1011+
1012+
type: Literal["Basic"] = Field(default="Basic", frozen=True) # pyright: ignore
1013+
children: list[WidgetComponent | WidgetRoot]
1014+
"""Children to render inside this root. Can include widget components or nested roots."""
1015+
theme: Literal["light", "dark"] | None = None
1016+
"""Force light or dark theme for this subtree."""
1017+
direction: Literal["row", "col"] | None = None
1018+
"""Flex direction for laying out direct children."""
1019+
gap: int | str | None = None
1020+
"""Gap between direct children; spacing unit or CSS string."""
1021+
padding: float | str | Spacing | None = None
1022+
"""Inner padding; spacing unit, CSS string, or padding object."""
1023+
align: Alignment | None = None
1024+
"""Cross-axis alignment of children."""
1025+
justify: Justification | None = None
1026+
"""Main-axis distribution of children."""
1027+
1028+
10081029
WidgetRoot = Annotated[
10091030
Card | ListView,
10101031
Field(discriminator="type"),

0 commit comments

Comments
 (0)