import * as React from 'react'; import { Slider } from '@fluentui/react/lib/Slider'; import { Stack, IStackStyles, IStackTokens } from '@fluentui/react/lib/Stack'; import { DefaultPalette } from '@fluentui/react/lib/Styling'; // Non-mutating styles definition const textStyles: React.CSSProperties = { width: 50, height: 50, display: 'flex', alignItems: 'center', justifyContent: 'center', color: DefaultPalette.white, }; const firstStackStyles: IStackStyles = { root: { background: DefaultPalette.neutralTertiary, }, }; const firstStackItemStyles: React.CSSProperties = { ...textStyles, background: DefaultPalette.themePrimary, }; const secondStackStyles: IStackStyles = { root: { background: DefaultPalette.neutralSecondary, }, }; const secondStackItemStyles: React.CSSProperties = { ...textStyles, background: DefaultPalette.themeDark, }; const thirdStackStyles: IStackStyles = { root: { background: DefaultPalette.neutralPrimary, }, }; const thirdStackItemStyles: React.CSSProperties = { ...textStyles, background: DefaultPalette.themeDarker, }; // Tokens definition const sectionStackTokens: IStackTokens = { childrenGap: 10 }; const wrapStackTokens: IStackTokens = { childrenGap: '30 40' }; const firstStackTokens: IStackTokens = { childrenGap: '10 30' }; const secondStackTokens: IStackTokens = { childrenGap: '20 50' }; export const VerticalStackWrapNestedExample: React.FunctionComponent = () => { const [stackHeight, setStackHeight] = React.useState(420); // Mutating styles definition const containerStackStyles: IStackStyles = { root: { background: DefaultPalette.themeTertiary, height: stackHeight, }, }; return ( 1 2 3 4 5 6 7 1 2 3 1 2 3 4 5 6 7 8 9 10 Note: Support for nested wrapping of vertical flex-boxes is scarce across browsers, especially in the way they handle overflows. Most browsers don't scale the width of the flex-box when the inner items overflow and wrap around it. The one exception to this case being Microsoft Edge that handles it correctly (though this might go soon with the switch to Chromium). There are ways in which we could have gone around this issue. However, we have chosen to adhere to the flex-box spec so that we have the correct implementation if support comes down the line. ); };