Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

docs(Stack, VStack, StackItem): horizontal flow follows the writing direction, and the styling props and ref are documented (#9583)

Cindy Zhangc3cdc8e97660
diff --git a/.changeset/stack-doc-direction-styling-props.md b/.changeset/stack-doc-direction-styling-props.md
new file mode 100644
index 0000000000..e10087eec4
--- /dev/null
+++ b/.changeset/stack-doc-direction-styling-props.md
@@ -0,0 +1,7 @@
+---
+'@astryxdesign/core': patch
+---
+
+[docs] Stack, VStack, and StackItem: say that a horizontal stack follows the writing direction (right to left in RTL), and document the `className`, `style`, and `ref` props, plus `xstyle` on VStack and StackItem.
+
+@cixzhang
diff --git a/packages/core/src/Stack/Stack.doc.mjs b/packages/core/src/Stack/Stack.doc.mjs
index 79e8142436..05d1c0e3b3 100644
--- a/packages/core/src/Stack/Stack.doc.mjs
+++ b/packages/core/src/Stack/Stack.doc.mjs
@@ -38,7 +38,7 @@ export const docs = {
name: 'Stack',
displayName: 'Stack',
description:
- 'Unified stack layout component with a direction prop. Use direction="horizontal" for left-to-right flow or direction="vertical" (default) for top-to-bottom. For convenience, HStack and VStack are pre-configured wrappers.',
+ 'Unified stack layout component with a direction prop. Use direction="horizontal" to flow along the inline axis (left to right in LTR, right to left in RTL) or direction="vertical" (default) for top-to-bottom. For convenience, HStack and VStack are pre-configured wrappers.',
playground: {
defaults: {
direction: 'horizontal',
@@ -55,7 +55,7 @@ export const docs = {
name: 'direction',
type: "'horizontal' | 'vertical'",
description:
- "Direction of the stack layout. 'horizontal' flows items left-to-right (like HStack), 'vertical' flows top-to-bottom (like VStack). Note: the value is 'horizontal', NOT 'row'.",
+ "Direction of the stack layout. 'horizontal' flows items along the inline axis, left to right in LTR and right to left in RTL (like HStack), 'vertical' flows top-to-bottom (like VStack). Note: the value is 'horizontal', NOT 'row'.",
default: "'vertical'",
},
{
@@ -176,6 +176,21 @@ export const docs = {
description:
'StyleX styles for layout customization (margins, positioning, sizing). Must be a stylex.create() value, not an inline style object like style={{}}.',
},
+ {
+ name: 'className',
+ type: 'string',
+ description: 'Class name added to the stack element, after the component styles.',
+ },
+ {
+ name: 'style',
+ type: 'CSSProperties',
+ description: 'Inline styles for the stack element. width, height, maxWidth, and minHeight win over the same properties here.',
+ },
+ {
+ name: 'ref',
+ type: 'Ref<HTMLElement>',
+ description: 'Ref to the rendered stack element.',
+ },
],
},
@@ -461,6 +476,27 @@ export const docs = {
type: 'ReactNode',
description: 'Stack content.',
},
+ {
+ name: 'xstyle',
+ type: 'StyleXStyles',
+ description:
+ 'StyleX styles for layout customization (margins, positioning, sizing). Must be a stylex.create() value, not an inline style object like style={{}}.',
+ },
+ {
+ name: 'className',
+ type: 'string',
+ description: 'Class name added to the stack element, after the component styles.',
+ },
+ {
+ name: 'style',
+ type: 'CSSProperties',
+ description: 'Inline styles for the stack element. width, height, maxWidth, and minHeight win over the same properties here.',
+ },
+ {
+ name: 'ref',
+ type: 'Ref<HTMLElement>',
+ description: 'Ref to the rendered stack element.',
+ },
],
},
{
@@ -508,6 +544,27 @@ export const docs = {
type: 'ReactNode',
description: 'Item content.',
},
+ {
+ name: 'xstyle',
+ type: 'StyleXStyles',
+ description:
+ 'StyleX styles for layout customization (margins, positioning, sizing). Must be a stylex.create() value, not an inline style object like style={{}}.',
+ },
+ {
+ name: 'className',
+ type: 'string',
+ description: 'Class name added to the item element, after the component styles.',
+ },
+ {
+ name: 'style',
+ type: 'CSSProperties',
+ description: 'Inline styles for the item element.',
+ },
+ {
+ name: 'ref',
+ type: 'Ref<HTMLElement>',
+ description: 'Ref to the rendered item element.',
+ },
],
},
],
diff --git a/packages/core/src/Stack/Stack.tsx b/packages/core/src/Stack/Stack.tsx
index 867dab5b68..c56d72759a 100644
--- a/packages/core/src/Stack/Stack.tsx
+++ b/packages/core/src/Stack/Stack.tsx
@@ -56,7 +56,7 @@ export interface StackProps extends BaseProps<HTMLElement> {
ref?: React.Ref<HTMLElement>;
/**
* Direction of the stack layout.
- * - `horizontal`: Items flow left-to-right (like HStack)
+ * - `horizontal`: Items flow along the inline axis, right to left in RTL (like HStack)
* - `vertical`: Items flow top-to-bottom (like VStack)
* @default 'vertical'
*/
diff --git a/packages/core/src/Stack/stack.stylex.ts b/packages/core/src/Stack/stack.stylex.ts
index 3ab7e4802f..7d08a52f1f 100644
--- a/packages/core/src/Stack/stack.stylex.ts
+++ b/packages/core/src/Stack/stack.stylex.ts
@@ -74,7 +74,7 @@ const directionStyles = stylex.create({
/**
* Stack direction.
- * - `horizontal`: Items flow left-to-right (HStack)
+ * - `horizontal`: Items flow along the inline axis, right to left in RTL (HStack)
* - `vertical`: Items flow top-to-bottom (VStack)
*/
export type StackDirection = keyof typeof directionStyles;