Wrap
Wrap is the flow-layout helper for content that should continue onto another line or column when space runs out.
This is a strong fit for chips, tag clouds, compact action sets, filter pills, or other repeated items that should flow naturally rather than force a strict grid or one long row.
Use Wrap when wrapping behavior is the important part of the layout. Do not use it when you need exact track definitions or predictable card columns. For those cases, use Grid or SimpleGrid. Example
use fission::op::FlexDirection;
use fission::prelude::*;
fission_component! {
pub TopicTags<()> {}
view(_tags, _state, cx) {
let spacing = &cx.view.env().theme.tokens.spacing;
} =>
Wrap(
direction: FlexDirection::Row,
spacing: spacing.s,
children: [
Tag(label: cx.tr("topic.design")),
Tag(label: cx.tr("topic.performance")),
Tag(label: cx.tr("topic.accessibility")),
],
)
}
These are visible taxonomy tags, not buttons pretending to filter results.
Supply real selection/removal actions when the product supports editing; a
translated label alone does not make a tag interactive.
Field table
| | | |
|---|
| | Whether the flow starts as a row or a column. | Defaults to FlexDirection::Row. |
| | | |
| | Items that participate in the flow layout. | Defaults to an empty list. |
Layout behavior
Wrap is implemented by building either a wrapping Row or a wrapping Column. That means it inherits the flex-style behavior of those primitives while forcing FlexWrap::Wrap.
In practice, FlexDirection::Row is the common case. FlexDirection::Column is available for less common layouts where items should flow downward and then into another column.
Specific advice
Wrap is best when items are relatively self-sized and the layout can stay visually loose. If you need every tile to respect a minimum width and create a more card-like responsive grid, prefer SimpleGrid. Check the layout in context
Use Wrap when items should flow to another line or column; use Grid or SimpleGrid when columns need predictable tracks.
Test the layout with the actual range of labels and at narrow widths. Long or translated items can change where every later item wraps.
Give repeated stateful children stable ids based on their data, not their current position.