Custom framework attributes (data-*)
data-* attributes power the interactive JavaScript behavior in Foundation, Bootstrap, and Materialize components. This article shows you how to add and customize them through Site Designer’s Element pane.
What are data-* attributes?
data-* attributes are custom HTML attributes that store information for JavaScript without affecting layout or presentation. Every CSS framework uses them to wire up interactive components without inline JavaScript:
- Bootstrap:
data-toggle="modal",data-target="#myModal",data-dismiss="modal",data-ride="carousel" - Foundation:
data-accordion,data-reveal,data-orbit,data-sticky,data-dropdown - Materialize:
data-target="mobile-nav",data-badge-caption="new"
When you add a framework component through Site Designer’s canvas, the necessary data-* attributes are inserted automatically. However, for advanced configurations — such as customizing a Foundation accordion to allow multiple open panels — you’ll need to add or modify data-* attributes manually.
Adding data-* attributes in Site Designer
- Select the element on the canvas.
- Open the Element pane.
- Scroll to the Attributes section.
- Click Add Attribute.
- Enter the attribute name (e.g.,
data-toggle) and value (e.g.,modal). - Press Enter to apply.
The attribute is immediately added to the element’s HTML and visible in the code view.
ARIA attributes are added exactly the same way, through the Element pane’s Attributes section — see ARIA roles and accessibility attributes for the full reference.
When to add attributes manually vs. let the framework handle it
| Scenario | Who handles it |
|---|---|
| Inserting a Foundation reveal from the canvas | Site Designer (automatic) |
| Customizing a Foundation accordion to allow multiple open panels | Manual (data-multi-expand="true" on the ul) |
| Making a Bootstrap modal accessible | Site Designer adds role="dialog" and aria-labelledby automatically |
Adding aria-label to a decorative icon link | Manual |
| Implementing a fully custom dropdown (no framework) | Manual — all data-* and ARIA |
Example: Foundation accordion with custom options
A standard Foundation accordion is created automatically. To allow multiple panels open simultaneously, add this attribute to the <ul class="accordion"> element:
- Attribute name:
data-multi-expand - Value:
true
And to allow all panels to be closed (none forced open):
- Attribute name:
data-allow-all-closed - Value:
true
These are added in the Element pane’s Attributes section — no code editing required.
Attributes tutorials
Let’s now see some guides and tutorials on how to create these interactive elements using the Attributes control.
Tutorial 1: Build a responsive menu
Using Foundation, learn how to create a multi-level responsive navigation menu. The menu transforms into a mobile menu icon that triggers the menu for small screens.
Tutorial 2: Show/hide items with Toggler
In the video demonstration, the webpage is built with Foundation, so the class names and attributes are assigned by that framework. The goal is for a button to show a hidden section of the page. The button will be the Toggle, and the pricing container is the Toggler.
Video recap:
- The
data-toggleattribute is applied to the trigger element (in this case the button) on the Element pane. The attribute value isPrice— the ID name of the content that is being called to appear. - Next, select the element or the group you want triggered to show/hide when the button is clicked. In the video, the parent container holding the pricing info is selected. On the Styles pane the ID name
Priceis applied so that it matches the value entered indata-toggle. - The triggered element is given the class name
is-hidden. - On the Element pane, the triggered element is given the attribute
data-togglerwith the valueis-hidden.
Tutorial 3: Build a video modal
In the video demonstration, the webpage is built with Bootstrap, so the class names and attributes are assigned by that framework. Using Bootstrap’s names, we are going to make a button trigger a full-screen video modal to pop over the webpage. The button will be the Toggle, and the container with the video element is the Target.
Video recap:
- A Container element with a Video Platform element are added to the design. The Container is assigned a unique ID name (in this example
video-demo) so that it can be targeted by the button. - The Container element is assigned the class name
modal. This causes the container with its children to disappear. - The button will trigger the display action. From Element pane → Properties → Attributes, add
data-togglewith the valuemodal. - A second attribute is added to the button,
data-targetwith the value#video-demo. The value must match the ID name you set on your modal.
Tutorial 4: Create a carousel
In the video tutorial, learn how to build a picture carousel — slideshow — using the Bootstrap framework. While this tutorial uses the Picture element within the carousel, it would work for any design, such as applying the image to the background of the containers and layering text on top.
The basic structure is made up of two Container elements. One serves as the main carousel wrapper, the second as the inner wrapper. Nested inside the second container is the desired content — in this example, three additional containers, each the parent of an individual slideshow image.
Video recap:
- The first parent Container is added to the canvas. On the Styles pane an ID is associated with the slider — in the example,
carousel-example. Then the class namescarouselandslideare applied, and the attributedata-ridewith valuecarouselis added on the Element pane. - A second Container is nested inside the first by dragging and dropping it onto the canvas. The class name
carousel-inneris assigned. - With the base structure in place, the children containers can be added as the gallery slides — three in this example, each assigned the class
carousel-item. The slide you want first also gets the classactive. Use the eye icon on the Element pane to show or hide any slide that is currently invisible, so you can style it. - Each
carousel-itemcontainer holds a Picture element. The Picture elements all share the class namesd-blockandw-100. The image resource is assigned on the Element pane, and the layout is tweaked so the images havemax-width: none.
Bonus — add slide controls:
- Add two Button Link elements to the parent container (
carousel). - The left-side button gets the class name
carousel-control-prevand three attributes:role="button",data-slide="prev", andaria-hidden="true". - The right-side button gets the class name
carousel-control-nextand three attributes:role="button",data-slide="next", andaria-hidden="true". - Finally, both buttons need to be linked to the parent container’s ID name — in this case
#carousel-example, entered on the Element pane in the HREF box.