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...
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 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.
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
:
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.
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.
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.
Displays a number field with a stepper.
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 some informational static text.
Display a segmented control.
You can also use the following title key to display text instead of icons.
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.
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
.
All UI Controls need to be placed inside of a Group. The controls appear in the inspector.
Displays the Theme Studio Border Width control.
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 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 a multiline text area in the inspector.
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 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.
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
.
Displays a select box, also known as a dropdown menu.
Displays a text field in the inspector.