Search code examples
wagtail

When to use `StreamBlock` vs `StructBlock`?


In Wagtail, StreamBlock and StructBlock seem to serve the same purpose, which is to nest other child blocks in a parent field.

When to use one versus the other?


Solution

  • Use StructBlock if you have a known, well-defined set of sub-elements to include in a block.

    Use StreamBlock when you want an variable number of content items of mixed types.