Last updated 4 months ago

Learn how to include your Mason features in your application.

If you haven't already, run through our developer quickstart to get your development environment ready to use Mason.


Mason features take a number of user-defined properties.

  • id - a 12 byte string from the Mason Builder export modal (required)

  • willFetchData - a function invoked before datasource fetching (optional)

  • willSendData - a function invoked before form submission (optional)

  • didReceiveData - a function invoked after form submission (optional)


Mason features use React under the hood, and integrate easily with a React codebase.

import React from 'react';
import { Register } from 'mason-library';
class MyRegister extends React.Component {
render() {
return <Register id="YOUR_COMPONENT_ID" />;

HTML Custom Elements

If you're including Mason features as HTML Custom Elements, you must pass your props as data attributes.

<script src="https://static.trymason.com/mason@latest.js"></script>
<mason-login data-id="YOUR_COMPONENT_ID"></mason-login>

Because you can't pass functions as HTML attributes, you must use event subscribers to utilize callbacks with your HTML feature. See Sending Data, Fetching Data, and Handling Errors for examples.