Skip to main content

<m7-view> Attribute Reference

<m7-view> is a standard Web Component (Custom Element) registered by the Module7 loader script. It is fully self-contained — no public JavaScript API, no events, no slots.

All configuration is done through HTML attributes. For CMSes that strip unknown elements, the same attributes work with a data- prefix on a plain <div data-m7-view> — see Fallback element.


Attributes​

token (required)​

Your Integration Key, issued by Venus AI. Sent as the Integration-Key header with every request to the Module7 server. The key encodes your module configuration and restricts usage to the domains you have registered.

<m7-view token="your-integration-key"></m7-view>

If this attribute is missing or empty, the element renders an error immediately without making any server request.


view​

Forces a specific view to render, regardless of the current page URL. The listing, grid and slide views keep their state in m7- parameters of the page URL — see URL state.

<m7-view token="..." view="listing"></m7-view>

Valid values:

ValueDescription
listingStandard list view
minimalCompact list view
gridGrid layout
mapsMap-only view
listing-mapsList and map side by side
split-mapsSplit view with map
grid-mapsGrid layout with map
bookmarksSaved/bookmarked items
snowreportSnow report view
slideSlideshow view
detailSingle entity detail view
landingLanding page view

If view is omitted, Module7 resolves the view from window.location.pathname. For example, a page at /listing will render the listing view automatically. If the path does not match any known view, an UNKNOWN_VIEW error is shown. On the root path (/), nothing is rendered — the element only logs a warning to the console.


filter​

Pre-applies a filter to the view. Supports both path segments and query parameters using the filter-link format. Only takes effect together with the view attribute — without it, the view and its filters come from the page URL.

<!-- Static filter (always applied) -->
<m7-view token="..." view="listing" filter="type=schema:MusicEvent"></m7-view>

<!-- Temporary filter (starting state only) -->
<m7-view token="..." view="listing" filter="?time=next_week"></m7-view>

<!-- Combined -->
<m7-view token="..." view="listing" filter="type=schema:MusicEvent?time=next_week"></m7-view>
  • Static filters (before the ?) are always applied. Visitors cannot remove them — they define the scope of the view.
  • Temporary filters (after the ?) only set the starting state. If the page URL contains an m7- parameter with the same name (e.g. m7-time), that value replaces the attribute's value.

project​

Restricts the view to one or more specific projects, overriding the projects configured in your Integration Key.

<m7-view token="..." project="671092r25dgdq0mae7b3c12f"></m7-view>

Accepts a comma-separated list of 24-character hex IDs. Multiple projects can also be joined with _:

<m7-view token="..." project="671092r25dgdq0mae7b3c12f,5f43a2b1c0d9e8f712345678"></m7-view>

If any ID does not match the expected format, an INVALID_PROJECT error is shown and no request is made.


channel​

Restricts the view to one or more specific channels, overriding the channels configured in your Integration Key. Accepts the same format as project.

<m7-view token="..." channel="671092r25dgdq0mae7b3c12f"></m7-view>

If any ID does not match the expected format, an INVALID_CHANNEL error is shown and no request is made.


Combining attributes​

All attributes can be combined freely:

<m7-view
token="your-integration-key"
view="listing"
project="671092r25dgdq0mae7b3c12f"
filter="type=schema:MusicEvent?time=next_week">
</m7-view>

URL state​

With the view attribute set, the page URL belongs to your CMS. The listing, grid and slide views still keep the visitor's selection in it, so a reload, a shared link and the browser's Back and Forward buttons restore it. All of these parameters carry the prefix m7-:

https://www.example.com/events?L=1&m7-type=schema:Park&m7-sort=name,1&m7-page=2
ParameterContent
m7-<filter>A filter the visitor selected, e.g. m7-type or m7-open
m7-queryThe search term
m7-sortThe sort order. Omitted for the default sort
m7-pageThe result page. Omitted for the first page
  • Parameters without the m7- prefix (here L=1) belong to your CMS. Module7 never reads or changes them.
  • Every filter, search, sort or page change adds an entry to the browser history, so Back and Forward step through the visitor's selections.
  • Reset removes the visitor's filters and search term. The sort order stays.
  • The static filters of the filter attribute never appear in the URL — they always apply.

Without the view attribute, the view is driven by the page URL itself (e.g. /listing?type=schema:Park&sort=name,1) and no prefix is used — see Deep-link routing.

One filterable view per page

All <m7-view> elements on a page share the same m7- parameters. If you place more than one view with filters on the same page, their selections can interfere with each other. Use one filterable view per page.


Fallback element​

CMSes that sanitize HTML may remove <m7-view> as an unknown tag. Use a standard <div> with the data-m7-view marker attribute instead. All attributes work identically with a data- prefix:

<div
data-m7-view
data-token="your-integration-key"
data-view="listing"
data-filter="type=schema:MusicEvent"
data-project="671092r25dgdq0mae7b3c12f"
data-channel="671092r25dgdq0mae7b3c12f">
</div>

The loader upgrades these placeholders to proper <m7-view> elements automatically on page load, stripping the data- prefix from all attributes.


Error handling​

Errors are displayed as a styled message inside the element's shadow DOM — visible to end users if something is misconfigured. Each error has a code shown in the footer.

Attribute validation errors​

These are caught before any server request is made:

CodeCause
MISSING_TOKENtoken attribute is absent or empty
INVALID_PROJECTA project ID is not a valid 24-character hex ID
INVALID_CHANNELA channel ID is not a valid 24-character hex ID
INVALID_FILTERThe filter value does not match the filter-link format
UNKNOWN_VIEWThe view could not be resolved — neither view attribute nor the current URL path matches a known view

Server errors​

These occur after the POST request:

CodeCause
SERVER_ERRORThe Module7 server returned a non-2xx response. The HTTP status code is included in the message.
MISSING_MOUNT_TARGETThe server response did not contain a valid mount point. Indicates a server-side rendering failure.
MISSING_RENDER_OPTIONSThe mount point was found but render options were missing from the server response.
DEFAULTAny other uncaught error during element setup or rendering.

Console errors (prefixed m7-view:, [m7-mirror], or [m7-assets]) provide additional detail for debugging without affecting the visible error state.