-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New Component: Stack #5419
Comments
change default direction to vertical, add a horizontal props (if this hasn't already been done). |
@khmakoto sorry...didn't mean to say close this, but update it and have your PR close it via updating the "Fixes #0000" part |
🎉This issue was addressed in #8008, which has now been successfully released as Handy links: |
🎉This issue was addressed in #8008, which has now been successfully released as Handy links: |
🎉This issue was addressed in #8008, which has now been successfully released as Handy links: |
🎉This issue was addressed in #8008, which has now been successfully released as Handy links: |
Component Details
A Stack is a container-type component that abstracts the implementation of a flexbox in order to define the layout of its children components.
Why should we abstract flexbox?
The reason for abstracting flexbox comes from our drive to provide a complete component library, where we wouldn't want for the consumer to need to write additional CSS just to get flexbox functionality. By abstracting flexbox we:
Stack properties
Although Stack has a number of different properties, there are three in particular that define the overall layout that the component has:
horizontal
property when using the component.verticalAlign
andhorizontalAlign
properties. One thing to notice here is that while flexbox containers align always across the cross axis, Stack aims to remove the mental strain involved in this process by making theverticalAlign
andhorizontalAlign
properties always follow the vertical and horizontal axes, respectively, regardless of the direction of the Stack.gap
adverticalGap
properties.Stack wrapping
Aside from the previously mentioned properties, there is another property called
wrap
that determines if items overflow the Stack container or wrap around it. The wrap property only works in the direction of the Stack, which means that the children components can still overflow in the perpendicular direction (i.e. in a Vertical Stack, items might overflow horizontally and vice versa).Stack nesting
Stacks can be nested inside one another in order to be able to configure the layout of the application as desired.
Transition from HorizontalStack and VerticalStack to singular Stack component
Description of the changes
When discussing the promotion of the component from the
experiments
package into theoffice-ui-fabric-react
package, it was decided that we should change the approach we were using in theexperiments
package of having two separate components, HorizontalStack and VerticalStack, and instead have a single component Stack with a boolean propertyhorizontal
that determines if the stack is horizontal or vertical, with a vertical stack being the default.This change required modifying existing examples, tests and usage of Stack inside other components throughout the
experiments
package. The HorizontalStack and VerticalStack pages in theexperiments
website have also been removed and a Stack page has been added to theoffice-ui-fabric-react
website as part of this change.Focus areas to test
All the existing tests (snapshots, vr-tests, etc) for HorizontalStack and VerticalStack have been modified to use the singular Stack component and the new component has been tested against all of them to ensure conformance with how the previous components worked.
Component Documentation
Imports
Stack does not make use of other components internally to be constructed.
Exports/ Component Breakdown
Both the Stack and StackItem components are exported, as well as the Stack and StackItem properties defined in
Stack.types
andStackItem.types
respectively.Intended Package
Initially in
@uifabric/experiments
while we drive the changes to have the correct api, but with the intention of moving it tooffice-ui-fabric-react
after that is done.Code mockup/example
Basic Vertical Stack Code Sample
Basic Horizontal Stack Code Sample
Stack Types
IStackItemSlots
root
IHTMLSpanSlot
IStackItemProps
as
string
|React.ReactType<IStackProps>
StackItem
className
string
StackItem
grow
boolean
|number
|inherit
|initial
|unset
StackItem
in proportion to its siblingsshrink
boolean
|number
|inherit
|initial
|unset
StackItem
shrink to fit the available spacedisableShrink
boolean
false
StackItem
should be prevented from shrinking.align
auto
|stretch
|baseline
|start
|center
|end
StackItem
along the x-axis (for verticalStacks
) or the y-axis (for horizontalStacks
)verticalFill
boolean
true
StackItem
should take up 100% of the height of its parentIStackSlots
root
IHTMLDivSlot
inner
IHTMLDivSlot
IStackProps
as
string
|React.ReactType<IStackProps>
Stack
horizontal
boolean
false
Stack
children horizontallyreversed
boolean
false
Stack
children in the opposite direction (bottom-to-top if it's a verticalStack
and right-to-left if it's a horizontalStack
)horizontalAlign
'start'
|'flex-start'
|'end'
|'flex-end'
|'center'
|'space-between'
|'space-around'
|'space-evenly'
|'baseline'
|'stretch'
Stack
children horizontally (along the x-axis)verticalAlign
'top'
|'bottom'
|'start'
|'flex-start'
|'end'
|'flex-end'
|'center'
|'space-between'
|'space-around'
|'space-evenly'
|'baseline'
|'stretch'
Stack
children vertically (along the y-axis)verticalFill
boolean
Stack
should take up 100% of the height of its parentdisableShrink
boolean
Stack
children should not shrink to fit the available spacegrow
boolean
|number
|'inherit'
|'initial'
|'unset'
Stack
in proportion to its siblingsgap
number
|string
Stack
childrenmaxWidth
number
|string
Stack
can takemaxHeight
number
|string
Stack
can takepadding
number
|string
Stack
wrap
boolean
false
Stack
children should wrap onto multiple rows or columns when they are about to overflow the size of theStack
Component Ownership
@uifabric/experiments
tooffice-ui-fabric-react
Deadlines
We are aiming for the component to be promoted from
@uifabric/experiments
tooffice-ui-fabric-react
in February 2019.Steps
The text was updated successfully, but these errors were encountered: