set default align stack (#2626)
This commit is contained in:
parent
411a3a1f13
commit
0cb66fb561
@ -2,16 +2,11 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Literal
|
||||
|
||||
from reflex.components.component import Component
|
||||
|
||||
from ..base import LiteralSpacing
|
||||
from ..base import LiteralAlign, LiteralSpacing
|
||||
from .flex import Flex
|
||||
|
||||
LiteralJustify = Literal["start", "center", "end"]
|
||||
LiteralAlign = Literal["start", "center", "end", "stretch"]
|
||||
|
||||
|
||||
class Stack(Flex):
|
||||
"""A stack component."""
|
||||
@ -21,6 +16,7 @@ class Stack(Flex):
|
||||
cls,
|
||||
*children,
|
||||
spacing: LiteralSpacing = "2",
|
||||
align: LiteralAlign = "start",
|
||||
**props,
|
||||
) -> Component:
|
||||
"""Create a new instance of the component.
|
||||
@ -28,6 +24,7 @@ class Stack(Flex):
|
||||
Args:
|
||||
*children: The children of the stack.
|
||||
spacing: The spacing between each stack item.
|
||||
align: The alignment of the stack items.
|
||||
**props: The properties of the stack.
|
||||
|
||||
Returns:
|
||||
@ -36,6 +33,7 @@ class Stack(Flex):
|
||||
return super().create(
|
||||
*children,
|
||||
spacing=spacing,
|
||||
align=align,
|
||||
**props,
|
||||
)
|
||||
|
||||
|
@ -7,14 +7,10 @@ from typing import Any, Dict, Literal, Optional, Union, overload
|
||||
from reflex.vars import Var, BaseVar, ComputedVar
|
||||
from reflex.event import EventChain, EventHandler, EventSpec
|
||||
from reflex.style import Style
|
||||
from typing import Literal
|
||||
from reflex.components.component import Component
|
||||
from ..base import LiteralSpacing
|
||||
from ..base import LiteralAlign, LiteralSpacing
|
||||
from .flex import Flex
|
||||
|
||||
LiteralJustify = Literal["start", "center", "end"]
|
||||
LiteralAlign = Literal["start", "center", "end", "stretch"]
|
||||
|
||||
class Stack(Flex):
|
||||
@overload
|
||||
@classmethod
|
||||
@ -22,6 +18,7 @@ class Stack(Flex):
|
||||
cls,
|
||||
*children,
|
||||
spacing: Optional[LiteralSpacing] = "2",
|
||||
align: Optional[LiteralAlign] = "start",
|
||||
as_child: Optional[Union[Var[bool], bool]] = None,
|
||||
direction: Optional[
|
||||
Union[
|
||||
@ -29,12 +26,6 @@ class Stack(Flex):
|
||||
Literal["row", "column", "row-reverse", "column-reverse"],
|
||||
]
|
||||
] = None,
|
||||
align: Optional[
|
||||
Union[
|
||||
Var[Literal["start", "center", "end", "baseline", "stretch"]],
|
||||
Literal["start", "center", "end", "baseline", "stretch"],
|
||||
]
|
||||
] = None,
|
||||
justify: Optional[
|
||||
Union[
|
||||
Var[Literal["start", "center", "end", "between"]],
|
||||
@ -145,9 +136,9 @@ class Stack(Flex):
|
||||
Args:
|
||||
*children: The children of the stack.
|
||||
spacing: The spacing between each stack item.
|
||||
align: The alignment of the stack items.
|
||||
as_child: Change the default rendered element for the one passed as a child, merging their props and behavior.
|
||||
direction: How child items are layed out: "row" | "column" | "row-reverse" | "column-reverse"
|
||||
align: Alignment of children along the main axis: "start" | "center" | "end" | "baseline" | "stretch"
|
||||
justify: Alignment of children along the cross axis: "start" | "center" | "end" | "between"
|
||||
wrap: Whether children should wrap when they reach the end of their container: "nowrap" | "wrap" | "wrap-reverse"
|
||||
access_key: Provides a hint for generating a keyboard shortcut for the current element.
|
||||
@ -186,6 +177,7 @@ class VStack(Stack):
|
||||
cls,
|
||||
*children,
|
||||
spacing: Optional[LiteralSpacing] = "2",
|
||||
align: Optional[LiteralAlign] = "start",
|
||||
as_child: Optional[Union[Var[bool], bool]] = None,
|
||||
direction: Optional[
|
||||
Union[
|
||||
@ -193,12 +185,6 @@ class VStack(Stack):
|
||||
Literal["row", "column", "row-reverse", "column-reverse"],
|
||||
]
|
||||
] = None,
|
||||
align: Optional[
|
||||
Union[
|
||||
Var[Literal["start", "center", "end", "baseline", "stretch"]],
|
||||
Literal["start", "center", "end", "baseline", "stretch"],
|
||||
]
|
||||
] = None,
|
||||
justify: Optional[
|
||||
Union[
|
||||
Var[Literal["start", "center", "end", "between"]],
|
||||
@ -309,9 +295,9 @@ class VStack(Stack):
|
||||
Args:
|
||||
*children: The children of the stack.
|
||||
spacing: The spacing between each stack item.
|
||||
align: The alignment of the stack items.
|
||||
as_child: Change the default rendered element for the one passed as a child, merging their props and behavior.
|
||||
direction: How child items are layed out: "row" | "column" | "row-reverse" | "column-reverse"
|
||||
align: Alignment of children along the main axis: "start" | "center" | "end" | "baseline" | "stretch"
|
||||
justify: Alignment of children along the cross axis: "start" | "center" | "end" | "between"
|
||||
wrap: Whether children should wrap when they reach the end of their container: "nowrap" | "wrap" | "wrap-reverse"
|
||||
access_key: Provides a hint for generating a keyboard shortcut for the current element.
|
||||
@ -350,6 +336,7 @@ class HStack(Stack):
|
||||
cls,
|
||||
*children,
|
||||
spacing: Optional[LiteralSpacing] = "2",
|
||||
align: Optional[LiteralAlign] = "start",
|
||||
as_child: Optional[Union[Var[bool], bool]] = None,
|
||||
direction: Optional[
|
||||
Union[
|
||||
@ -357,12 +344,6 @@ class HStack(Stack):
|
||||
Literal["row", "column", "row-reverse", "column-reverse"],
|
||||
]
|
||||
] = None,
|
||||
align: Optional[
|
||||
Union[
|
||||
Var[Literal["start", "center", "end", "baseline", "stretch"]],
|
||||
Literal["start", "center", "end", "baseline", "stretch"],
|
||||
]
|
||||
] = None,
|
||||
justify: Optional[
|
||||
Union[
|
||||
Var[Literal["start", "center", "end", "between"]],
|
||||
@ -473,9 +454,9 @@ class HStack(Stack):
|
||||
Args:
|
||||
*children: The children of the stack.
|
||||
spacing: The spacing between each stack item.
|
||||
align: The alignment of the stack items.
|
||||
as_child: Change the default rendered element for the one passed as a child, merging their props and behavior.
|
||||
direction: How child items are layed out: "row" | "column" | "row-reverse" | "column-reverse"
|
||||
align: Alignment of children along the main axis: "start" | "center" | "end" | "baseline" | "stretch"
|
||||
justify: Alignment of children along the cross axis: "start" | "center" | "end" | "between"
|
||||
wrap: Whether children should wrap when they reach the end of their container: "nowrap" | "wrap" | "wrap-reverse"
|
||||
access_key: Provides a hint for generating a keyboard shortcut for the current element.
|
||||
|
Loading…
Reference in New Issue
Block a user