Filtered Views (DSL)
Filtered views create a subset of an existing view by including or excluding elements based on their tags.
Basic syntax
Section titled “Basic syntax”filtered baseViewKey include "Tag1,Tag2" { title "Filtered View Title" description "Optional description"}Or to exclude:
filtered baseViewKey exclude "Internal" { title "External Components Only"}Parameters
Section titled “Parameters”| Parameter | Description |
|---|---|
baseViewKey |
The key of the view to filter |
include / exclude |
The filter mode |
"Tag1,Tag2" |
Comma-separated list of tags to match |
How filtering works
Section titled “How filtering works”- Include mode — Only elements with at least one of the specified tags are shown.
- Exclude mode — Elements with any of the specified tags are hidden; everything else is shown.
- Relationships are displayed only when both their source and target are visible after filtering.
Example
Section titled “Example”Given a system context view with elements tagged Frontend, Backend, and Database:
// Base viewsystemContext mySystem "FullContext" { include * autoLayout}
// Show only frontend elementsfiltered "FullContext" include "Frontend" { title "Frontend Components"}
// Hide internal infrastructurefiltered "FullContext" exclude "Infrastructure" { title "Business Services"}Inspector properties
Section titled “Inspector properties”In the UI, the Inspector for a filtered view shows:
- Base view key — Which view the filter applies to
- Filter mode — Include or exclude
- Tag list — Tags used for filtering
- Title and description
- Auto layout — On/off and direction
- Layout engine — Default, Graphviz, Dagre, or ELK
- Themes — Theme list and custom URLs
Base view visibility
Section titled “Base view visibility”When a filtered view is defined for a base view, the base view may be hidden from the Views panel. This is expected behavior in Structurizr-compatible rendering.
- Use meaningful tags — Tags like
Frontend,Backend,External,Critical,PIImake filters self-documenting. - Start with include — Include mode is usually clearer and more predictable than exclude mode.
- Combine with documentation — Filtered views work well in arc42 documentation to provide focused perspectives.
See also
Section titled “See also”- Views — Overview of all view types
- DSL Basics — Tags and element definitions
- Filtered Views (Portal Guide) — Working with filtered views in the UI