Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
At a bare minimum you'll want to include PDF images for light mode icons so they can be used for all views where your Component appears within the RapidWeaver Elements UI.
Important: The PDF graphic for your icon should have a transparent background so it can be composited in app on to the background tile to give a consistent look.
All Elements require an icon.pdf file for light mode. If the dark-mode.pdf file isn't provided, icon.pdf will be used in Dark Mode.
icon.pdf (Required), 1:1 ratio, e.g. 128x128 (Square)
icon-dark.pdf (optional), 1:1 ratio, e.g. 128x128 (Square)
The Palette image should be named paletteIcon.pdf and paletteIcon-dark.pdf for Dark Mode. If the paletteIcon-dark.pdf file isn't provided, paletteIcon.pdf will be used in Dark Mode.
paletteIcon.pdf (Required), 1:2 ratio, e.g. 128x256 (landscape)
paletteIcon-dark.pdf (optional), 1:2 ratio, e.g. 128x256 (landscape)
All Icon files should be placed at the root of the Component alongside the info.json file.
Watch the short video below to learn more about adding custom icons to your Components.
Your pdf icons MUST be on a transparent background. The background should not be exported as this is generated in Elements.
We've provided an example Sketch document below you can use to get started.
⚠️ While this feature works, please do not use it as it may be removed in a future build.
There is some unfinished experimental support for banner style icons, these are great for layout style components. However, this style of icon may not be supported when Elements ships, please use with caution and ensure you also include the standard style of icon.
bannerLayer1.png
bannerLayer1-Dark.png (optional)
Banner icons can be layered, and each layer can represent a different colour in the Theme Studio. For example this icon uses four layers and three of those layers will be tinted with the Theme colour.
bannerLayer1.png
bannerLayer2-brand-500.png
bannerLayer3-brand-200.png
bannerLayer4-surface-500.png
Banner images should be 512px in width, but can be as short or tall as you need. Banner icons will appear the same in both grid and list.
The visible
key in an object's properties can be set using a logical expression that evaluates to true
or false
. This determines whether a specific UI element is shown or hidden based on the conditions specified in the expression. Works in the same way as enabled.
Boolean Logic: Use logical operators (&&
, ||
) to combine multiple conditions.
Comparison Operators: Use ==
, !=
, >
, <
, >=
, <=
to compare values.
Complex Condition
This makes the property visible only if the backgroundType is either custom' or 'image', and the textColor is 'white'.
Visibility Based on Numeric Ranges
Useful for showing elements that should only be visible within a specific range, e.g., showing a message if the opacity is not between 20-30.
Negation to Hide Elements
The property is visible when mySwitchControl
is false
.
The following example code toggles the visibility of controls based on the value of the switch.
Groups allow you to organise similar settings into relevant groups.
the Icon property uses SF Symbols. Please refer to the SF Symbol app for a list of available icons.
Here is an example emtpy group:
Controls should placed inside of the properties array. The following example has a heading and an image drop well inside of the group.
The following example has two groups, the first with a text box, and the second with an image dropwell.
By default, Elements makes all property controls responsive, allowing users to override any control setting across different devices. Elements accomplishes this by appending Tailwind’s responsive modifiers to the control’s value. Let’s explore how this works in an example.
In this example, a control uses Tailwind’s text transform utility classes. The user can customize the control’s value across devices by clicking the responsive icon (dot) next to the control title in Elements.
Initially, the headingTextTransform
output is set to normal-case. However, once the user customizes this setting in Elements, it may look something like this: normal-case sm:uppercase md:lowercase lg:capitalize
.
Elements automatically applies and manages these responsive modifiers, saving you the effort of manually setting values for each device size and applying the appropriate modifier.
This even works for controls that require multiple classes as the value. So given the following control:
You can expect the output of position
to be bottom-0 left-0 right-auto md:top-0 md:left-auto md: right-0
To disable responsive values for your control, simply add "responsive": false
to your control.
Outline basic information about your Element
The info.json file contains important information about a Component. The file uses the JSON format and consists of a series of key and value pairs. It's required for Component to function.
Every Component needs to define a category in which they belong. This tells Elements how to group components in the UI and helps users to locate components. Your Component MUST use one of the following pre-defined categories.
If you think we're missing a category, please visit the .
The Elements info.json file supports the following key-value pairs.
You can use the following code as a starting point for your own info.json file.
identifier (Required)
string
The identifier is the unique ID for your Element. We recommend using a reverse DNS format. This should be a string consisting of just lowercase characters and periods without spaces.
author (Required)
string
The name of the author of the Element. This would usually be the developer name, or the name of the company publishing the Element.
title (Required)
string
The name of the Element. This will be displayed inside of RapidWeaver. A unique and descriptive name is preferable. Overly long names will get truncated, check inside of the RapidWeaver UI for readability.
group (Required)
string
One of the above categories. Components with the same category are grouped together.
tags
array
A list of tags relevant to the Elements.
helpURL
string
A URL to the location of the help documentation online.
infoURL
string
A URL to the location of the marketing page online.
Content
Headings, Paragraphs, Lists.
Layout
Grid, Flex, Containers, Columns.
Navigation
Menus, Nav Bars, Breadcrumbs, Tabs.
Forms
Text Fields, Text Areas, Checkboxes, Buttons.
SEO
Keywords, SEO helpers.
Media
Images, Video, Audio Players, Icons, Embeds (YouTube, Vimeo).
Ecommerce
Cart Integration, Product display, Add to Cart Buttons.
Accessibility
ARIA Lables, Contrast Checkers.
Animation
Hover Effects, Animated SVG's.
Dynamic
CMS Components, Google Sheets
Utilities
Cookies, Anchors, Placeholders, Dividers.
Interactive
Modals, Popovers, Accordions, Carousels.
Security
Password Protection, Login Forms.
title
string
See Title for more information
id
string
See ID for more information
format
string
See Format for more information
visible
string
See Visible for more information
enabled
string
See Enabled for more information
Displays a select box, also known as a dropdown menu.
Display a divider between content.
Show and hide controls based on another control's value.
The enabled
key in an object's properties can be set using a logical expression that evaluates to true
or false
. This determines whether a specific UI element is enabled or disabled based on the conditions specified in the expression. Works in the same way as visible.
Boolean Logic: Use logical operators (&&
, ||
) to combine multiple conditions.
Comparison Operators: Use ==
, !=
, >
, <
, >=
, <=
to compare values.
Complex Condition
This makes the property enabled only if the backgroundType is either custom' or 'image', and the textColor is 'white'.
Visibility Based on Numeric Ranges
Useful for enabling controls that should only be visible within a specific range.
Negation to Hide Elements
The property is enabled when mySwitchControl
is false
.
Displays a heading in the inspector interface.
Displays an image dropwell in the inspector.
In some cases, it's adventagous to format a value before it's passed to your element's templates. To achieve this, add a format
property to the configuration specifying the format string.
Value formatting is support by all controls.
For example, the following creates a slider ranging from 0-12 with a property called padding
If the slider is set to 5 and the template contains
the output will be
You could also format the control's value to use tailwind's arbitrary value feature. This would allow your element precis control over all css properties. For example, you can control the opacity utility class from tailwind with a slider:
If the slider is set to 50 and the template contains
the output will be
You could also format the control's value to output a valid CSS property. For example, if we want to control the translateX css property with a number input, we can do the following:
If the number field is set to 50 and the template contains
the output will be
Of cause, in this case you would want to add this to a CSS template file.
You can even use the format to control a CSS Custom Property (css variable). If we take our previous example and expand on it, we might want to instead set a --translateX
CSS custom property with a number input:
If the number field is set to 50 and the template contains
the output will be
In this case you would either want to add this to a CSS file, or use an inline style attribute to set the --translateX
:
All UI Controls need to be placed inside of a Group. The controls appear in the inspector.
A slider can be used for choosing from a range of values.
The following example displays a stepped slider with seven pre-defined values.
The following example displays a stepped slider with seven pre-defined values.
The following example has a minimum value of 0 and maximum of 100. The units are set to round, and display in the UI with a "%" after the number.
An example slider setting a star rating between 0 and 5.
Here's an example of an items
array in sliders so you can set custom values for each point in the slider.
The slider control supports the following options.
Display some informational static text.
The Link control allows users to input a URL or link to another page within their RapidWeaver project.
The following will give you access to the link object in your template file(s).
By default the link attribute will return a relative URL. To get the full URL add the absoluteURL property.
Corresponding template example using the absoluteURL.
Display a segmented control.
You can also use the following title key to display text instead of icons.
Displays a number field with a stepper.
title
string
The name of the Slider. This will be displayed beside the UI element of RapidWeaver
id
string
The id for this control.
format
string
default
string
The default value the slider should be set to.
items
array
min
number
The minimum value for the slider.
max
number
The maximum value for the slider.
units
string
The units string appears alongside the slider value in the user interface, but it is not included in the template output value.
round
boolean
If true an integer will be used instead of a floating point.
ticks
number
the number of ticks that will appear beneath the slider.
snap
boolean
is set to true, slider will snap to ticks
.
Displays the Theme Studio Border Width control.
Displays a text field in the inspector.
Displays a switch, similar to a checkbox in functionality.
The following examples returns a true or false value. Note that responsive
should be false
.
The following example returns a string value instead of true or false. Note that responsive
should be false
.
To display this value in a template file, use {{display}}
.
When using a switch responsively, trueValue and falseValue should be set to a Tailwind class name. You'll then receive a list of Tailwind classes within your template, prefixed for each breakpoint as necessary.
In the Template file you can do the following to display different html based on the value.
Displays a multiline text area in the inspector.
Displays the Theme Studio Color control.
For consistency and integration with the Theme Studio in RapidWeaver Elements, use the themeColor
attribute to specify all color options for your elements. This ensures that the color settings are centrally managed and adaptable to theme changes.
Usage of themeColor
:
default: Sets the initial or fallback color and brightness. In this case, the default color is black with a brightness value of 300.
Output Example: controls the output format of the customColor
property. In your template files, referencing {{customColor}}
with the example configuration above would output: text-black-300
.
Displays the Theme Studio Border Radius control.
Can be used to apply additional formatting to the value. {{value}}
will be replaced with the selected value. See for more information.
Can be used to specify an array of values to the slider. See below.
Displays the Theme Studio Text Style control.
Displays the Theme Studio Shadow control.
Displays the Theme Studio Font control.
For effective theme integration in RapidWeaver Elements, it is recommended to use the themeFont
attribute to define all font family settings for your elements. This approach ensures that font preferences are coordinated with the overall theme settings, providing a consistent user experience.
Here’s a structured example for defining a font property:
Output Example: In your template files, referencing {{fontFamily}}
with the example configuration above would output: font-sub-heading sm:font-heading md:font-quote
.
Component Template Folder
Template files in RapidWeaver Elements house all the HTML, CSS, JavaScript, and other assets your component needs to work seamlessly. These files are dynamically processed by Elements, allowing for property replacements (think handlebars-style), perform iterations, and more—enabling you to build highly flexible and reusable components.
The structure of the templates directory is important and denotes in which area the contained files will be inserted into the page. Any files placed at the root of the templates directory will be processed and added for each instance of the component on the page.
The templates directory may also contain the following sub directories
headStart - placed at the top of head
headEnd - placed at the end of head
bodyStart - placed at the top of body
bodyEnd - placed at the bottom of body
include - files can be included from other template files using an @include statement
html - contains HTML content
js - contains javascript
css - CSS styles
php - files containing PHP
Displays the Theme Studio Typography class picker.
Displays the Theme Studio Spacing control.
The themeSpacing
attribute is should be used for all space settings like padding, margins, gaps, translate, and positioning.
This control allows the user's site to dynamically adapt to any theme updates, changes, or overrides to the spacing scale.
The themeSpacing control has the following modes:
padding
margin
gap
transition
position
single
Each one of these modes correspond to the appropriate Tailwind utility classes. This means both developers and users can manage one single spacing scale that help promote consistency across all sites built in RapidWeaver Elements. See the examples below for more information.
The single mode allows you to access the spacing scale from the Theme Studio in a single select control. This is handy when you need to set a single property rather than all four properties (top, right, bottom left). For example, if you need to set only the top
css property you can do so like this:
In this example, the default value will be returned as top-2
.
You can also specify that a custom value should be used by default for the themeSpacing control. This allows you to gain precise control over the value of the spacing when your element is dropped on to a page.
The following example displays the text inside of the IF statment when the switch is on/true. It's worth noting that only non-responsive controls can be used in 'if' statements.
When performing complex logic like string comparisons, use the to perform this logic and provide simple bool values to the template. This helps to keep templates simple and focused on HTML rather than complex conditional logic.
Elements allows you to specify a number of else if statements to run before falling back to the else block. An @elseif
statement works just like a regular @if
statement and follows the same syntax.
Elements gives you access to the current RapidWeaver mode inside of conditional statements. This can be particularly useful for showing content in edit mode or in preview.
RegEx (Regular Expression) is a powerful tool for searching, matching, and manipulating text based on specific patterns. It uses a combination of characters, meta-characters, and quantifiers to define complex search criteria. RegEx is widely used in programming, text editors, and command-line tools for tasks like input validation, pattern extraction, and string replacement. Its versatility allows users to efficiently find and process text, from simple matches to intricate parsing operations.
In Elements it can be used to conditionally check for values, the following example checks for specific words in a text field before showing a slider.
The portal feature allows you to transport sections of your template code to another part of the page.
If you are linking and including scripts, you'll want to tell Elements to only include the link once (when multiple instances of the same component are on the page). To do that you can use the "includeOne argument.
Include once across multiple components.
Include content from another template file
An include allows you to insert the content of another template file within the current template file.
Include files should be stored in the directory.
Suppose you have the following template files in your include folder:
hello.html
world.html
You could then include the contents of those files into your main template.html file by using the following code:
The output from template.html would look like this
The include template files allow access to properties as if they were part of the main template file. Given that you have set a pages
value in your hooks file (via the rw.setProps()
method), you can pass that property to your template like so:
You can of cause include multiple properties simply by comma separating them:
Rather than wrapping your @include statement inside an @if statement, you can use the @includeIf helper:
Setting an anchor in a template file will list it and allow it to be linked to from the Link Panel in the Editor.
And using a property:
See also rw.addAnchor in the hooks file.
At the start of a template file you can add an inline template that can be included like any other template file. This is handy if you have small parts of your template you want to extract, and don't want or need to create separate templates files.
A dropzones is an area within a template where child element can be added. Each dropzone requires a name giving you a consistent & reliable way to manage child items.
Multiple dropzones with the same name can used, but you should be careful not to show them at the same time. This can be useful if you want to show child items in different places based on a control.
Sometimes you want to allow the user to drop the resources directly into the Editor, this can be achieved with the rwResourceDropZone
key.
The following example shows how to support dropping a folder of images directly into the Editor. Place the following in the Template HTML:
You also need a corresponding image control in the Properties file:
Adding the @raw()
tag around templte content will stop Element properties from being processed.
The properties.json file defines the User Interface for an Element. Browse the UI Control docs for a full list of available controls.
Here's an example of setting Default Properites on various UI controls.
The following tags should be placed in the html template file. Using any of the following tags enable editable areas with the page. No setup of configuration in the properties file is required.
Add a simple editible text area with optional default text.
An editable text area with a default value of "Hello World!".
Adds a text area that support the Typography feature.
Hooks provide a powerful way to extend your components by manipulating properties before they are applied within templates.
The typical flow of a component follows this sequence: properties → hooks → template. Hooks process and refine properties, allowing you to perform complex logic before passing them into the template for rendering.
Each component has its own unique hooks.js
file. To share code across multiple components, refer to shared hooks.
To use a transform hook, create a hooks.js
file in the root of your component with this code.
Next, add this to the template.html
file in the component templates directory.
rw:mode
string
edit
or preview
getValues
getClassNames
getResponsiveValues
getBreakpoints
getBreakpointNames
in hooks.js
in template.html
The rendered output would look something like this:
Mario - Plumber
The transform hook allows you to get and set property values before they're used in templates. Let's assume you have the following slider defined in your properties and you're using the value in a template.
When the slider is set to 5, the output would be
Now lets add a transform hook that multiplies the padding value by 2
With the slider still set to 5, when the template is processed the output will be
This becomes incredibly powerful and convenient when you need to perform logic based on multiple properties. The following example show how you might generate a list of css classes based on standard or custom settings.
The template simply uses the classes property instead of attempting to handle all options from 7 different properties. For example
Assets can be included per component or shared in a component pack. Assets are additional files that should be deployed when a project is published. They are not processed in any way and are simply copied during publish.
All assets should be placed inside a directory named page and will be deployed once to the page's files directory during publish. Here's an example showing where to place the snowstorm.js file.
Currently, page is the only area currently supported. If you need to deploy assets to another area, please visit the forum and let us know.
To link to an asset in a single component you'll need to do the following;
Use the {{assetPath}} macro inside of the index.html Template file. If you need the include to appear in the head (or other areas) of the page you can use the Portal Function.
Include the following code in the hooks.js to return the assetPath to the page template:
Access Project Properties
Various properties from the current environment can be used within templates but access must be granted through the setProps
command in the file first.
With this in place, we gain access to the following within template files.
The following template example will output the page (and folder) details for all the pages in a project.
Before you can access the page properties you'll need to include the following code in the Hooks.js
{{page.title}}
String
{{page.description}}
String
{{page.id}}
String
{{page.language}}
String
{{page.filename}}
String
{{page.ext}}
String
{{page.absolutePath}}
String
{{page.docRootPath}}
String
{{page.resourcesPath}}
String
{{node.id}}
String
{{node.parent.id}}
String
{{node.parent.container}}
String
{{node.title}}
String
{{element.group}}
String
{{element.title}}
String
{{element.version}}
String
{{element.assetPath}}
String
{{element.siteAssetPath}}
String
{{project.siteURL}}
String
{{project.mode}}
String
{{project.title}}
String
{{project.slogan}}
String
{{project.copyright}}
String
{{project.email}}
String
{{project.contactText}}
String
{{project.enableSocialTags}}
Boolean
{{project.language}}
String
{{project.logo.url}}
String
{{project.logo.alt}}
String
info about the new @resource
(or will it be @image()
Elements gives you access to the current RapidWeaver mode inside of conditional statements. This can be particularly useful for showing content in edit mode or in preview when a certain property evaluates to true.
::index
::isFirst
::isLast
In your Template file you can reference the text field by using double brackets and the ID name.
In your Template file you can reference the text field by using double brackets and the ID name.
In your Template file you can reference the text field by using double brackets and the ID name.
can be placed inside of any Template files, including HTML, CSS, and Javascript files.
For example in your file you can add the a , and then reference that value in your , including HTML, CSS, and Javascript.
Anything set in is also available to all Templates files in your component.
can be placed inside of any Template files, including HTML, CSS, and Javascript files.
For example in your file you can add the a , and then reference that value in your , including HTML, CSS, and Javascript.
Anything set in is also available to all Templates files in your component.
can be placed inside of any Template files, including HTML, CSS, and Javascript files.
For example in your file you can add the a , and then reference that value in your , including HTML, CSS, and Javascript.
Anything set in is also available to all Templates files in your component.