diff --git a/packages/office-ui-fabric-react/src/components/Stack/Stack.styles.ts b/packages/office-ui-fabric-react/src/components/Stack/Stack.styles.ts
index 879597e4cef293..6d20b0d7d4b00d 100644
--- a/packages/office-ui-fabric-react/src/components/Stack/Stack.styles.ts
+++ b/packages/office-ui-fabric-react/src/components/Stack/Stack.styles.ts
@@ -12,7 +12,7 @@ const GlobalClassNames = {
inner: 'ms-Stack-inner'
};
-export const styles: IStackComponent['styles'] = (props, theme): IStackStylesReturnType => {
+export const styles: IStackComponent['styles'] = (props, theme, tokens): IStackStylesReturnType => {
const {
verticalFill,
maxWidth,
@@ -31,7 +31,8 @@ export const styles: IStackComponent['styles'] = (props, theme): IStackStylesRet
const classNames = getGlobalClassNames(GlobalClassNames, theme);
- const { rowGap, columnGap } = parseGap(gap, theme);
+ const childrenGap = tokens && tokens.childrenGap ? tokens.childrenGap : gap;
+ const { rowGap, columnGap } = parseGap(childrenGap, theme);
const horizontalMargin = `${-0.5 * columnGap.value}${columnGap.unit}`;
const verticalMargin = `${-0.5 * rowGap.value}${rowGap.unit}`;
diff --git a/packages/office-ui-fabric-react/src/components/Stack/Stack.test.tsx b/packages/office-ui-fabric-react/src/components/Stack/Stack.test.tsx
index 66d03c76e7430a..834b1d373b7788 100644
--- a/packages/office-ui-fabric-react/src/components/Stack/Stack.test.tsx
+++ b/packages/office-ui-fabric-react/src/components/Stack/Stack.test.tsx
@@ -168,7 +168,7 @@ describe('Stack', () => {
it('renders vertical Stack with a gap correctly', () => {
const component = renderer.create(
-
+
Item 1
Item 2
@@ -179,7 +179,7 @@ describe('Stack', () => {
it('renders horizontal Stack with a gap correctly', () => {
const component = renderer.create(
-
+
Item 1
Item 2
diff --git a/packages/office-ui-fabric-react/src/components/Stack/Stack.types.ts b/packages/office-ui-fabric-react/src/components/Stack/Stack.types.ts
index c48c3dd67256c1..31e362e4391d14 100644
--- a/packages/office-ui-fabric-react/src/components/Stack/Stack.types.ts
+++ b/packages/office-ui-fabric-react/src/components/Stack/Stack.types.ts
@@ -31,7 +31,7 @@ export interface IStackSlots {
export interface IStackProps
extends IStackSlots,
- IStyleableComponentProps,
+ IStyleableComponentProps,
React.HTMLAttributes {
/**
* Defines how to render the Stack.
@@ -110,6 +110,8 @@ export interface IStackProps
wrap?: boolean;
}
-export interface IStackTokens {}
+export interface IStackTokens {
+ childrenGap?: number | string;
+}
export type IStackStyles = IComponentStyles;
diff --git a/packages/office-ui-fabric-react/src/components/Stack/StackItem/StackItem.styles.ts b/packages/office-ui-fabric-react/src/components/Stack/StackItem/StackItem.styles.ts
index 78e0efb90e4cc0..1802b8d8b4023f 100644
--- a/packages/office-ui-fabric-react/src/components/Stack/StackItem/StackItem.styles.ts
+++ b/packages/office-ui-fabric-react/src/components/Stack/StackItem/StackItem.styles.ts
@@ -10,7 +10,7 @@ const alignMap: { [key: string]: string } = {
end: 'flex-end'
};
-export const styles: IStackItemComponent['styles'] = (props, theme): IStackItemStylesReturnType => {
+export const StackItemStyles: IStackItemComponent['styles'] = (props, theme, tokens): IStackItemStylesReturnType => {
const { grow, shrink, disableShrink, align, verticalFill, order, className } = props;
const classNames = getGlobalClassNames(GlobalClassNames, theme);
@@ -20,8 +20,9 @@ export const styles: IStackItemComponent['styles'] = (props, theme): IStackItemS
theme.fonts.medium,
classNames.root,
{
- width: 'auto',
- height: verticalFill ? '100%' : 'auto'
+ margin: tokens.margin,
+ height: verticalFill ? '100%' : 'auto',
+ width: 'auto'
},
grow && { flexGrow: grow === true ? 1 : grow },
(disableShrink || (!grow && !shrink)) && {
diff --git a/packages/office-ui-fabric-react/src/components/Stack/StackItem/StackItem.tsx b/packages/office-ui-fabric-react/src/components/Stack/StackItem/StackItem.tsx
index aa6cf5e7c4f6e6..77126465ba7cf7 100644
--- a/packages/office-ui-fabric-react/src/components/Stack/StackItem/StackItem.tsx
+++ b/packages/office-ui-fabric-react/src/components/Stack/StackItem/StackItem.tsx
@@ -2,7 +2,7 @@
import * as React from 'react';
import { withSlots, createComponent, getSlots } from '../../../Foundation';
import { IStackItemComponent, IStackItemProps, IStackItemSlots } from './StackItem.types';
-import { styles } from './StackItem.styles';
+import { StackItemStyles as styles } from './StackItem.styles';
const view: IStackItemComponent['view'] = props => {
const { children } = props;
diff --git a/packages/office-ui-fabric-react/src/components/Stack/StackItem/StackItem.types.ts b/packages/office-ui-fabric-react/src/components/Stack/StackItem/StackItem.types.ts
index ebc114d89209cf..559c42aba40000 100644
--- a/packages/office-ui-fabric-react/src/components/Stack/StackItem/StackItem.types.ts
+++ b/packages/office-ui-fabric-react/src/components/Stack/StackItem/StackItem.types.ts
@@ -53,6 +53,8 @@ export interface IStackItemProps extends IStackItemSlots, IStyleableComponentPro
order?: number | string;
}
-export interface IStackItemTokens {}
+export interface IStackItemTokens {
+ margin?: number | string;
+}
export type IStackItemStyles = IComponentStyles;
diff --git a/packages/office-ui-fabric-react/src/components/Stack/examples/Stack.Horizontal.Basic.Example.tsx b/packages/office-ui-fabric-react/src/components/Stack/examples/Stack.Horizontal.Basic.Example.tsx
index 3e2fef900eb402..921f83121f62f9 100644
--- a/packages/office-ui-fabric-react/src/components/Stack/examples/Stack.Horizontal.Basic.Example.tsx
+++ b/packages/office-ui-fabric-react/src/components/Stack/examples/Stack.Horizontal.Basic.Example.tsx
@@ -16,8 +16,17 @@ export class HorizontalStackBasicExample extends React.Component<{}, {}> {
}
});
+ const tokens = {
+ fiveGapStack: {
+ childrenGap: 5
+ },
+ tenGapStack: {
+ childrenGap: 10
+ }
+ };
+
return (
-
+
Default horizontal stack
Item One
@@ -39,14 +48,21 @@ export class HorizontalStackBasicExample extends React.Component<{}, {}> {
Horizontal gap between items
-
+
Item One
Item Two
Item Three
Item alignments
-
+
Auto-aligned item
diff --git a/packages/office-ui-fabric-react/src/components/Stack/examples/Stack.Horizontal.Configure.Example.tsx b/packages/office-ui-fabric-react/src/components/Stack/examples/Stack.Horizontal.Configure.Example.tsx
index e6ecbd9b1bb20c..4ac97a350f5f49 100644
--- a/packages/office-ui-fabric-react/src/components/Stack/examples/Stack.Horizontal.Configure.Example.tsx
+++ b/packages/office-ui-fabric-react/src/components/Stack/examples/Stack.Horizontal.Configure.Example.tsx
@@ -103,8 +103,17 @@ export class HorizontalStackConfigureExample extends React.Component<{}, IExampl
}
};
+ const tokens = {
+ sectionStack: {
+ childrenGap: 10
+ },
+ configureStack: {
+ childrenGap: 20
+ }
+ };
+
return (
-
+
@@ -124,7 +133,7 @@ export class HorizontalStackConfigureExample extends React.Component<{}, IExampl
-
+
@@ -144,7 +153,7 @@ export class HorizontalStackConfigureExample extends React.Component<{}, IExampl
-
+
-
+
{
@@ -19,8 +20,10 @@ export class HorizontalStackGrowExample extends React.Component<{}, {}> {
}
});
+ const stackTokens: IStackTokens = { childrenGap: 5 };
+
return (
-
+
Grow is 3
diff --git a/packages/office-ui-fabric-react/src/components/Stack/examples/Stack.Horizontal.HorizontalAlign.Example.tsx b/packages/office-ui-fabric-react/src/components/Stack/examples/Stack.Horizontal.HorizontalAlign.Example.tsx
index 99ae4904f60188..b3aa7629f5faef 100644
--- a/packages/office-ui-fabric-react/src/components/Stack/examples/Stack.Horizontal.HorizontalAlign.Example.tsx
+++ b/packages/office-ui-fabric-react/src/components/Stack/examples/Stack.Horizontal.HorizontalAlign.Example.tsx
@@ -1,5 +1,6 @@
import * as React from 'react';
import { Stack } from '../Stack';
+import { IStackTokens } from '../Stack.types';
import { mergeStyleSets, DefaultPalette } from 'office-ui-fabric-react/lib/Styling';
export class HorizontalStackHorizontalAlignExample extends React.Component<{}, {}> {
@@ -21,8 +22,10 @@ export class HorizontalStackHorizontalAlignExample extends React.Component<{}, {
}
});
+ const stackTokens: IStackTokens = { childrenGap: 5 };
+
return (
-
+
Left-aligned
1
diff --git a/packages/office-ui-fabric-react/src/components/Stack/examples/Stack.Horizontal.Reversed.Example.tsx b/packages/office-ui-fabric-react/src/components/Stack/examples/Stack.Horizontal.Reversed.Example.tsx
index 1b435376baf45a..864df8e3b4eca0 100644
--- a/packages/office-ui-fabric-react/src/components/Stack/examples/Stack.Horizontal.Reversed.Example.tsx
+++ b/packages/office-ui-fabric-react/src/components/Stack/examples/Stack.Horizontal.Reversed.Example.tsx
@@ -16,8 +16,17 @@ export class HorizontalStackReversedExample extends React.Component<{}, {}> {
}
});
+ const tokens = {
+ fiveGapStack: {
+ childrenGap: 5
+ },
+ tenGapStack: {
+ childrenGap: 10
+ }
+ };
+
return (
-
+
Default horizontal stack
Item One
@@ -26,14 +35,22 @@ export class HorizontalStackReversedExample extends React.Component<{}, {}> {
Horizontal gap between items
-
+
Item One
Item Two
Item Three
Item alignments
-
+
Auto-aligned item
diff --git a/packages/office-ui-fabric-react/src/components/Stack/examples/Stack.Horizontal.Shrink.Example.tsx b/packages/office-ui-fabric-react/src/components/Stack/examples/Stack.Horizontal.Shrink.Example.tsx
index d498c00e0f862b..03e3733aec46b6 100644
--- a/packages/office-ui-fabric-react/src/components/Stack/examples/Stack.Horizontal.Shrink.Example.tsx
+++ b/packages/office-ui-fabric-react/src/components/Stack/examples/Stack.Horizontal.Shrink.Example.tsx
@@ -1,6 +1,7 @@
import * as React from 'react';
import { Slider } from 'office-ui-fabric-react/lib/Slider';
import { Stack } from '../Stack';
+import { IStackTokens } from '../Stack.types';
import { mergeStyleSets, DefaultPalette } from 'office-ui-fabric-react/lib/Styling';
export interface IExampleState {
@@ -34,8 +35,10 @@ export class HorizontalStackShrinkExample extends React.Component<{}, IExampleSt
}
});
+ const stackTokens: IStackTokens = { childrenGap: 5 };
+
return (
-
+
-
+
I shrink
diff --git a/packages/office-ui-fabric-react/src/components/Stack/examples/Stack.Horizontal.Spacing.Example.tsx b/packages/office-ui-fabric-react/src/components/Stack/examples/Stack.Horizontal.Spacing.Example.tsx
index b2bacc701674a4..0c9c3183ad8151 100644
--- a/packages/office-ui-fabric-react/src/components/Stack/examples/Stack.Horizontal.Spacing.Example.tsx
+++ b/packages/office-ui-fabric-react/src/components/Stack/examples/Stack.Horizontal.Spacing.Example.tsx
@@ -32,12 +32,36 @@ export class HorizontalStackSpacingExample extends React.Component<{}, {}> {
}
});
+ const tokens = {
+ numericalSpacing: {
+ childrenGap: 10
+ },
+ customSpacing: {
+ childrenGap: '10%'
+ },
+ themedExtraSmall: {
+ childrenGap: 's2'
+ },
+ themedSmall: {
+ childrenGap: 's1'
+ },
+ themedMedium: {
+ childrenGap: 'm'
+ },
+ themedLarge: {
+ childrenGap: 'l1'
+ },
+ themedExtraLarge: {
+ childrenGap: 'l2'
+ }
+ };
+
return (
-
+
Numerical spacing
-
+
1
2
3
@@ -45,7 +69,7 @@ export class HorizontalStackSpacingExample extends React.Component<{}, {}> {
Custom spacing
-
+
1
2
3
@@ -56,7 +80,7 @@ export class HorizontalStackSpacingExample extends React.Component<{}, {}> {
Themed spacing (extra small)
-
+
1
2
3
@@ -64,7 +88,7 @@ export class HorizontalStackSpacingExample extends React.Component<{}, {}> {
Themed spacing (small)
-
+
1
2
3
@@ -72,7 +96,7 @@ export class HorizontalStackSpacingExample extends React.Component<{}, {}> {
Themed spacing (medium)
-
+
1
2
3
@@ -83,7 +107,7 @@ export class HorizontalStackSpacingExample extends React.Component<{}, {}> {
Themed spacing (large)
-
+
1
2
3
@@ -91,7 +115,7 @@ export class HorizontalStackSpacingExample extends React.Component<{}, {}> {
Themed spacing (extra large)
-
+
1
2
3
diff --git a/packages/office-ui-fabric-react/src/components/Stack/examples/Stack.Horizontal.VerticalAlign.Example.tsx b/packages/office-ui-fabric-react/src/components/Stack/examples/Stack.Horizontal.VerticalAlign.Example.tsx
index bf26358803afb1..07b2ee6758a81e 100644
--- a/packages/office-ui-fabric-react/src/components/Stack/examples/Stack.Horizontal.VerticalAlign.Example.tsx
+++ b/packages/office-ui-fabric-react/src/components/Stack/examples/Stack.Horizontal.VerticalAlign.Example.tsx
@@ -1,5 +1,6 @@
import * as React from 'react';
import { Stack } from '../Stack';
+import { IStackTokens } from '../Stack.types';
import { mergeStyleSets, DefaultPalette } from 'office-ui-fabric-react/lib/Styling';
export class HorizontalStackVerticalAlignExample extends React.Component<{}, {}> {
@@ -22,8 +23,10 @@ export class HorizontalStackVerticalAlignExample extends React.Component<{}, {}>
}
});
+ const stackTokens: IStackTokens = { childrenGap: 5 };
+
return (
-
+
Top-aligned
1
diff --git a/packages/office-ui-fabric-react/src/components/Stack/examples/Stack.Horizontal.Wrap.Example.tsx b/packages/office-ui-fabric-react/src/components/Stack/examples/Stack.Horizontal.Wrap.Example.tsx
index bfe24f14d3dd2b..f625ace6eec8ad 100644
--- a/packages/office-ui-fabric-react/src/components/Stack/examples/Stack.Horizontal.Wrap.Example.tsx
+++ b/packages/office-ui-fabric-react/src/components/Stack/examples/Stack.Horizontal.Wrap.Example.tsx
@@ -34,8 +34,17 @@ export class HorizontalStackWrapExample extends React.Component<{}, IExampleStat
}
});
+ const tokens = {
+ sectionStack: {
+ childrenGap: 10
+ },
+ wrapStack: {
+ childrenGap: 30
+ }
+ };
+
return (
-
+
-
+
1
2
3
diff --git a/packages/office-ui-fabric-react/src/components/Stack/examples/Stack.Horizontal.WrapAdvanced.Example.tsx b/packages/office-ui-fabric-react/src/components/Stack/examples/Stack.Horizontal.WrapAdvanced.Example.tsx
index b8899b29454c52..fd8c70d7048a59 100644
--- a/packages/office-ui-fabric-react/src/components/Stack/examples/Stack.Horizontal.WrapAdvanced.Example.tsx
+++ b/packages/office-ui-fabric-react/src/components/Stack/examples/Stack.Horizontal.WrapAdvanced.Example.tsx
@@ -54,8 +54,20 @@ export class HorizontalStackWrapAdvancedExample extends React.Component<{}, IExa
}
});
+ const tokens = {
+ sectionStack: {
+ childrenGap: 10
+ },
+ configureStack: {
+ childrenGap: 20
+ },
+ wrapStack: {
+ childrenGap: 30
+ }
+ };
+
return (
-
+
@@ -73,7 +85,7 @@ export class HorizontalStackWrapAdvancedExample extends React.Component<{}, IExa
-
+
+
-
-
+
+