Flex

Arrange elements with direction, alignment, spacing, and wrapping.

Live preview
Interact with the component to see results here.
View code
HTML
<sy-flex
  direction="horizontal"
  justify="start"
  align="center"
  wrap="wrap"
  row-gap="small"
  column-gap="small"
  padding="small"
  height="180px"
>
  <sy-button variant="primary">Save</sy-button>
  <sy-button>Preview</sy-button>
  <sy-button>Cancel</sy-button>
</sy-flex>

Usage guide

#

Use to align items along one axis, such as button groups or toolbars. Use Layout for the overall page structure.

Main-axis alignment

justify positions items along the axis specified by direction.

Cross-axis alignment

align aligns items on the perpendicular axis. Changing direction changes both axes.

Feature examples

#

Choose a feature from 10 topics. Explore property settings, method calls, event results, and slot layouts through live examples and code.

Usage examples · Overview

Try the selected example. Topics with multiple configurations let you switch between detailed examples.

View code
HTML
Loading the example.

Property · Align

See how settings change appearance and behavior.

View code
HTML
Loading the example.

Property · Column Gap

See how settings change appearance and behavior.

View code
HTML
Loading the example.

Property · Direction

See how settings change appearance and behavior.

View code
HTML
Loading the example.

Property · Height

See how settings change appearance and behavior.

View code
HTML
Loading the example.

Property · Justify

See how settings change appearance and behavior.

View code
HTML
Loading the example.

Property · Padding

See how settings change appearance and behavior.

View code
HTML
Loading the example.

Property · Row Gap

See how settings change appearance and behavior.

View code
HTML
Loading the example.

Property · Width

See how settings change appearance and behavior.

View code
HTML
Loading the example.

Property · Wrap

See how settings change appearance and behavior.

View code
HTML
Loading the example.

API reference

#

Hover over a name or focus it with the keyboard to see the code. On touch screens, tap the name.

<sy-flex>

Properties

Attribute / PropertyTypeDefaultDescription
FlexAlign'start'Alignment perpendicular to the main axis.
FlexGap'medium'Spacing token between rows.
FlexGap'medium'Spacing token between columns.
FlexJustify'start'Alignment along the main axis.
FlexDirection'horizontal'Horizontal, vertical, or reverse layout direction.
FlexWrap'nowrap'How items wrap when width or height is insufficient.
FlexGap'medium'Spacing token used for padding.
string''Width as a CSS length or a numeric string interpreted as pixels.
string''Height as a CSS length or a numeric string interpreted as pixels.

Slots

SlotDescription
Component body or child items.