Skip to main content
Neighborhood Design System v5.1.0

Flex

Ready

A flexible layout component for arranging child elements with customizable spacing and alignment options.

Preview

Open in Storybook (opens in new tab)

Properties

PropertyAttributeTypeDefaultDescription
surfacesurfacenoneprimarysecondaryinverseinverse-secondarynoneThe surface theme of the flex container.
splitsplitbooleanfalseApplies space-between justification to the flex container.
reversedreversedbooleanfalseReverses the order of flex items. Use reverse instead.
reversereversebooleanfalseReverses the order of flex items. This only changes the visual order: keyboard and screen reader order still follow the markup, so don’t reverse content whose order matters (e.g. focusable media before its text) (WCAG 1.3.2).
justifyContentjustify-contentstartcenterspace-betweenspace-aroundendstartSets the justify-content property for the flex container.
alignItemsalign-itemsnormalstartcenterendnormalSets the align-items property for the flex container.

Slots

NameDescription
(default)The flex items to be arranged in the flex container.

CSS Parts

NameDescription
baseThe flex container div element.
contentThe slot container for the flex items.
nbhd-flex::part(base) {
  /* your styles */
}

CSS Properties

Set these on nbhd-flex or an ancestor to override the defaults. Token is the design token a default comes from and Value is what it resolves to in core Neighborhood; brands may override them. Properties that adapt to surface follow the light or inverse surface they sit on until you set them.

PropertyTokenValue Copy
--nbhd-flex-alignItems—normal
--nbhd-flex-blockSize—auto
--nbhd-flex-flexDirection—column
--nbhd-flex-flexWrap—nowrap
--nbhd-flex-host-display—block
--nbhd-flex-inlineSize—auto
--nbhd-flex-justifyContent—normal
--nbhd-flex-minBlockSize—auto
--nbhd-flex-position—static

Dependencies

Used by

Esc
↑ ↓ to move↵ to open