Slider Framework
Slider Framework
Slider Framework
The Slider Framework is a wrapper code for the Breakdance Builder that allows users to easily create and customize responsive sliders using the Swiper.js library. It integrates seamlessly, offering extensive options for layout, navigation, and effects, event for making highly customizable slider creation simple and flexible even for non-developers.
For developers we are providing code examples how you could use full Swiper.js API and connect it to Slider element.
Basic
Modules
Navigation (arrows)
Here we go navigation docs
Events
A11Y
Examples
Autoplay
const scope = document.querySelector('.breakdance .bde-text-6793-113-7197-6793-1').previousElementSibling;
const swiper = scope.querySelector('.swiper').swiper;
swiper.params.autoplay.delay = 1000;
swiper.params.autoplay.reverseDirection = true;
swiper.autoplay.start();
Dynamic Tabs
Dynamic Tabs
Dynamic Tabs
An a11y-friendly Dynamic Tabs component is designed to be accessible and responsive, offering a seamless user experience across devices. It adapts to different screen sizes by transforming traditional tabs into a dropdown menu or accordion on smaller screens. This component ensures keyboard accessibility, proper ARIA roles and attributes, and focus management, making it easy to navigate for all users, including those using assistive technologies.
Getting started
Post loop setup
In the video below, we are demonstrating setup of using dynamic tabs loop component with custom posts, and fields made in ACF.
Repeater setup
Video:
Basic configuration
In order to configure you’ll need locate element called Dynamic Tabs – config and click on Advanced option like shown in the image below:
Attribute | Values | Description |
---|---|---|
data-responsive-type | tabs, accordion, dropdown | Should tabs be shown as tabs on the smaller devices? With this you could switch to accordion and dropdown. When to switch is decided by next attribute “data-responsive-px” |
data-responsive-px | Integer | When to switch to alternative responsive view like accordion or dropdown. |
data-tab-preset | tabs, pills, bar, dot | Quick tab styling presets |
data-accordion-preset | classic, pill, bordered | Quick accordion styling presets |
data-accordion-icon | openclosed, open-and-closed | openclosed – Uses only one icon for both open and closed accordion state. Modify OpenClosed icon if you pick this option. open-and-closed – Uses separate open and closed icons. Modify both Open and Closed icon if you use this option. |
data-tab-activation | automatic, manual | According to W3C guidelines there are two types of tabs. With automatic automation keyboard arrows will shift immediately tabs, while with manual you will need to confirm choice by Enter or Space key. Recommended value: automatic |
Option configuration
Style presets
Tabs style preset
You should see attribute data-tab-preset under element named Dynamic Tabs – config.
Attribute name | Value |
---|---|
data-tab-preset | tabs |
pills | |
bar | |
dot |
Accordion styles preset
You should see attribute data-accordion-preset under element named Dynamic Tabs – config.
Values:
Attribute name | Value |
---|---|
data-accordion-preset | classic |
pill | |
bordered |
Style modification
This is aimed to make direct code modification to our styles. Because this is hybrid component, you could not style it with native elements as HTML markup is made on the fly by using JavaScript so it could support Tabs, Dropdown and Accordion options. Video below shows where you could find this code, in the code you will se comments with enumeration and table below explains what is code responsible for. Use this table as guide to find desired styles that need modification.
Please check style preset section which shows no-code styling option, you may not need custom code or if you pick some preset which matches desired design, or you will need less modification.
No | Description of applied styles |
---|---|
1.1 | Tabs focus styles. Styles applied when tab navigation item is focused, and styles when content is focused. |
1.2 | Tabs navigation wrapper container styles. Div that holds tabs navigation items. |
1.3 | Tabs dot preset styles. Conditional styles when dot preset is chosen. |
1.4 | Tabs pills preset styles. Conditional styles when pills preset is chosen. |
1.5 | Tabs tabs preset styles. Conditional styles when tabs preset is chosen. |
1.6 | Tabs bar preset styles. Conditional styles when bar preset is chosen. |
2.1 | Accordion icons styles |
2.2 | Accordion button to expand styles |
2.3 | Accordion classic preset styles. Conditional styles when classic preset is chosen. |
2.4 | Accordion pill preset styles. Conditional styles when pill preset is chosen. |
2.5 | Accordion bordered preset styles. Conditional styles when bordered preset is chosen. |
3.1 | Dropdown (select) base styles |
3.2 | Dropdown (select) hover styles |
4.1 | Functionality rules, do not modify as it may lead to broken things |
Responsive options
Responsive type
You should see attribute data-responsive-type under element named Dynamic Tabs – config.
Values: Tabs, Accordion, Dropdown
Responsive screen size
You should see attribute data-responsive-px under element named Dynamic Tabs – config.
Values: Integer number (100, 360, 500 etc.)
This will tell when you want to switch from Tabs view to Accordion or Dropdown view.
Advanced styling
Tabs – custom CSS
In order to make advanced design modification of tabs you could you use following selectors:
Element | CSS target |
---|---|
Navigation wrapper | .hs-nav-container.hs-nav-container [role=”tablist”]{} |
Navigation item (default state) | .hs-nav-container .hs-tablink[aria-selected=”true”] [data-tab=”tabnav”]{} |
Navigation item (hover state) | .hs-nav-container .hs-tablink:hover, .hs-nav-container .hs-tablink [data-tab=”tabnav”]:focus-within{} |
Navigation item (active state) | .hs-nav-container .hs-tablink[aria-selected=”true”] [data-tab=”tabnav”]{} |
Navigation Underline (active & hover state) | .hs-nav-container .hs-tablink [data-tab=”tabnav”]:hover:after, .hs-nav-container .hs-tablink [aria-selected=”true”] [data-tab=”tabnav”]:after{} |
Accordion – custom CSS
Customizing Icons
You should see attribute data-accordion-icon under element named Dynamic Tabs – config.
Values: open-and-closed | openclosed
open-and-closed value will use two separate icons for open and closed accordion state like + and -.
openclosed value will use single icon for example chevron (>) which gets rotated.
In order to customize accordion you could use following selectors:
Element | CSS target |
---|---|
Accordion button trigger (default state) | .hs-accordion-button.hs-accordion-button{} |
Accordion button trigger (hover & focus state) | .hs-accordion-button.hs-accordion-button:hover,.hs-accordion-button.hs-accordion-button:focus-within{} |
Accordion button trigger (expanded state) | .hs-accordion-button.hs-accordion-button[aria-expanded=”true”]{} |
Dropdown – custom CSS
In order to customize dropdown you could use following selectors:
Element | CSS target |
---|---|
Select element | .hs-nav-select.hs-nav-select{} |
Custom view styles hooks
In order to target elements under certain view you could use data-hsview attribute as style hook:
View | CSS target |
---|---|
Tabs | [data-hsview=”tabs”] .my-custom-selector{} |
Accordion | [data-hsview=”accordion”] .my-custom-selector{} |
Dropdown | [data-hsview=”dropdown”] .my-custom-selector{} |
Accessibility
Tabs
Tab navigation markup
<div role="tablist">
<button id="tab-1" tabindex="0" role="tab" aria-controls="tabcontent1" aria-selected="true"></button>
<button id="tab-1" tabindex="-1" role="tab" aria-controls="tabcontent2" aria-selected="false"></button>
<button id="tab-1" tabindex="-1" role="tab" aria-controls="tabcontent3" aria-selected="false"></button>
</div>
<div id="tabcontent1" role="tabpanel" aria-labelledby="tab-1" class="is-active"></div>
<div id="tabcontent2" role="tabpanel" aria-labelledby="tab-2"></div>
<div id="tabcontent3" role="tabpanel" aria-labelledby="tab-3"></div>
Role, Property, State, and Tabindex Attributes
Role | Attribute | Element | Usage |
---|---|---|---|
tablist | div | The tablist role identifies the element that serves as the container for a set of tabs. The tab content are referred to as tabpanel elements. | |
tab | button | The ARIA tab role indicates an interactive element inside a tablist that, when activated, displays its associated tabpanel. | |
aria-selected=”true” | button | Selected button will tell screen reader it is selected by using aria-selected=”true” | |
tabindex=”-1″ | button | Buttons that are not selected will have negative tabindex to exclude them from tabbing because tab should lead to first focus-able element inside tabpanel. And switching tabs will be done with JavaScript which will listen for ArrowLeft and ArrowRight. | |
aria-controls=”TCID” | button | The global aria-controls property identifies the element (or elements) whose contents or presence are controlled by the element on which this attribute is set. | |
id=”NID” | button | ||
tabpanel | div | The tabpanel role indicates the element is a container for the resources associated with a tab role, where each tab is contained in a tablist . | |
aria-labelledby=”NID” | div | The aria-labelledby attribute identifies the element (or elements) that labels the element it is applied to. | |
id=”TCID” |
Keyboard navigation
We are busting navigation with TAB key so user would not go through tab navigation, and would lead him to tab content. Switching tabs is done with keyboard arrow keys. There are two modes of activation:
- automatic
- manual
In automatic activation mode, after pressing arrow keys it will change tabs instantly without need to confirm choice to switch by pressing enter/tab key.
Tabbing through content
When user moves around content, and gets to last focus-able element in tab content, next TAB key press should lead to opening next tab, and vice versa with SHIFT + TAB.
Accordion
Code below is showing simplified markup of Accordion responsive view.
<div class="accordion-content">
<h3>
<button id="accordion-button-1" aria-expanded="true" aria-controls="tabcontent1">Tab1</button>
</h3>
<div id="tabcontent2" aria-labelledby="accordion-button-1" role="region" class="tab-content" hidden></div>
</div>
<div class="accordion-content">
<h3>
<button id="accordion-button-2" aria-controls="tabcontent2">Tab1</button>
</h3>
<div id="tabcontent2" aria-labelledby="accordion-button-2" role="region" class="tab-content" hidden></div>
</div>
Keyboard navigation
Key | Function |
---|---|
Space or Enter | When focus is on the accordion header of a collapsed section, expands the section. |
Tab | Moves focus to the next focusable element. All focusable elements in the accordion are included in the page Tab sequence. |
Shift + Tab | Moves focus to the previous focusable element. All focusable elements in the accordion are included in the page Tab sequence. |
Role, Property, State, and Tabindex Attributes
Role | Attribute | Element | Usage |
---|---|---|---|
h3 * | *Heading level is automatically picked up by script which check surrounding content, fallback to script is h3. Element that serves as an accordion header. Each accordion header element contains a button that controls the visibility of its content panel. The example uses heading level 3 so it fits correctly within the outline of the page; the example is contained in a section titled with a level 2 heading. | ||
aria-expanded="true" | button | Set to true when the Accordion panel is expanded, otherwise set to false . | |
aria-controls="ID" | div | Points to the ID of the panel which the header controls. | |
region | div | Creates a landmark region that contains the currently expanded accordion panel. | |
aria-labelledby="IDREF" | div | Defines the accessible name for the region element.References the accordion header button that expands and collapses the region. region elements are required to have an accessible name to be identified as a landmark. |
Dropdown
Dropdown uses same structure as Tabs, just navigation is replaced with dropdown. Semantics are enhanced with aria-label to tell screen readers that dropdown is related to Content Tabs.
Keyboard Naviagation
Key | Function |
---|---|
Space | When focus is on the unopened dropdown (HTML select element) Space key will open dropdown. |
Enter | When dropdown is open, Enter key will select dropdown option item and close dropdown. |
ArrowUp and ArrowDown | When dropdown is open, ArrowUp and ArrowDown key will move selection to next/previous option item. |
Tab | Moves focus to the next focusable element. |
Shift + Tab | Moves focus to the previous focusable element. |
Whiskey template documentation
Whiskey template documentation
Whiskey template documentation
Whiskey template is being shipped as a whole “site” via Updraft plugin.
Getting Started
You always need to start with a fresh install of WordPress. As a first step, install plugin UpdraftPlus: WP Backup & Migration Plugin and activate it.
Then go and download files from Whiskey template – you should be able to see them here after the purchase (or if you are Pro or LTD license holder). Unzip the file and you should be able to see 5 archive files starting “backup” in their names.
After that, go back to your fresh install, go to Settings > UpdraftPlus Backups and click on Upload backup files:
Drag and drop or select or the 5 “backup” files there. After all the files are loaded, click on Restore button:
Check all checkboxes and proceed to next step and wait for plugin to finish restoring:
When the restoring is finished you will be asked to login again – now – this is IMPORTANT. This template has a different login, so you need to use this to login:
username: default & password: HeadspinIsAwesome!
After login, you should, no you must create a new account for yourself and remove immediately all other accounts for security reason!
Then go and install Breakdance plugin as it is not part of delivered package.
As a last step, just to make sure that everything is in its place – Go to Settings > Permalinks and hit Save button. Similarly, go to Headspin plugin dashboard and hit Save button.
Blog
When setting up a blog, follow these steps:
- Choose an “archive” page where all the posts are displayed. You can find them under Pages, their names start with “Blog page…”. Remove the rest or change their status to “Draft”.
- Choose an “archive” template for all post taxonomies (categories & tags). That means, if you have e.g. a category “Tech” and user visit it, they will see all the posts of this category in selected template. Right now you can choose from 3 post taxonomy templates. Make sure that only one template is active at a time.
- Similarly, you can choose a Single template for all the posts too, activate the one you want to use (currently, there is only 1 single post template in v 1.0).
Blog – Search templates
By default, there are 2 templates that apply to Blog search. A normal one that shows the results and the one that shows when there is no result. You can edit their layout with Breakdance builder:
Woocommerce
Woocommerce store consists of Shop, Cart, Checkout, Thank you and My account pages. There there are Single product and Product search templates.
Dynamic Lightbox
Dynamic Lightbox
Dynamic Lightbox
There are two variations Dynamic Lightbox component:
- Classic – this variation is aimed when you don’t have many posts to loop and content of the post is not too long. This is because all the content is loaded when page is loaded and if you have many posts with long content it could lead to huge DOM load. Benefit of this is that all of it could be cached.
Check demo - Iframe – when loading via iframe, each modal content will be loaded on demand when user clicks. This method is more like loading via AJAX, just it does not require PHP code to make it. Also there is option to make template condition based on url parameter so you could design special single post template within page builder just for showing within modal.
Check demo
Configuration
Dynamic data
Configuration for dynamic data is the same as pulling any post within Breakdance. We’ll have Post loop element inside page or template and adjust query to our needs.
Global code block
In modal code you will find div named Global code block. You’ll need to go:
- WP Admin > Breakdance > Global blocks
- Create new Global code block with some name eg. Dynamic Lightbox Card
- Copy/Paste that element called Global block to created
Styling features
Iframe template setup
By default you will need to pass post url which should be opened in iframe within modal.
You need to:
- WordPress Admin > Breakdance > Templates
- Add New Template > Single Post* (or CPT and whatever you want to load)
- Set condition > Dynamic data
- Under Dynamic data pick URL parameter option
- Click on URL parameter chip and set it to loadoveriframe – is – true
- Give template some higher priority like 1000
Check video how to set it up:
A11Y Features
All elements that have related a11y attributes have a11y in name so they are easier to find and tweak exactly to own need.
Focus trap
The process of designing a modal component entails various considerations. One of these considerations is ensuring proper focus management. Focus trapping is a technique that plays a vital role in this process.
When a modal is open, we keep track about focus-able items that are the part of modal such as buttons, links and form inputs. These items are part of webpage focus flow, and we need to isolate them because if our focus gets to the first or the last focus-able item it could get out of modal and focus invisible items under the modal.
Focus trap kicks here into the place by intercepting moving focus from the last item and gets cycle back to the first focus item inside modal, and vice versa.
Scroll trap
When we open modal, we want user to be focused on the modal content and freeze document under the modal. There are some problems because we don’t have right now all the needed tool out-of-the-box to stop main document from scrolling. We could implement overscroll-behavior: contain; which will stop accidental scrolls propagating when scrolling modal to main document, but user could still scroll over backdrop element.
Scrolling main document while modal is open is bad UX because user could end up on other
Role, Property, State, and Tabindex Attributes
Role | Attribute | Element | Usage |
---|---|---|---|
dialog | div | Identifies the element that serves as the dialog container. | |
aria-labelledby=”IDREF” | div | Gives the dialog an accessible name by referring to the element that provides the dialog title. | |
aria-modal=”true” | div | Tells assistive technologies that the windows underneath the current dialog are not available for interaction (inert). | |
button | tabindex=”0″ aria-pressed=”true” | div | Tells assistive technologies that div wrapper acts as button, uses tabindex=”0″ to be in natural focus flow and aria-pressed tells whenever related modal is open or not |
Keyboard navigation
Key | Function |
---|---|
Tab | – Moves focus to next focusable element inside the dialog. – When focus is on the last focusable element in the dialog, moves focus to the first focusable element in the dialog. |
Shift + Tab | – Moves focus to previous focusable element inside the dialog. – When focus is on the first focusable element in the dialog, moves focus to the last focusable element in the dialog. |
Escape | Closes the dialog. |
Arrow Right | Opens next item in modal |
Arrow Left | Opens previous item in modal |
Teleporting card content
If you want to teleport part of the card inside modal body you need to use attribute data-tepleport=”true”. This attribute should be present on div which is holding card content to be teleported and on div named Teleport here which tells where should we inject content.
Animation Options
We could configure animation with attribute on element named Dynamic Lightbox.
name: data-animation
values: none | scale | slide
Plugin Update: v1.2.2
Plugin Update: v1.2.2
Plugin Update: v1.2.2
Based on the feedback that we gathered in communication with our users, we are introducing few new things which should improve quality of life for our users.
Improved color palette views
1) List view – default
The list view is new view introduced palette view option in list format with use case hints. This view should make much easier for the new users to understand our color system because it will act as cheat sheet where each shade will have recommended use case.
2) Row view – old
We have kept old row view which was used before v1.2.2 because many users are used to that, and also that view far more compact so when users are on-board with our color system they could use this compact view.
Also this view is improved also with dark/light labels for theme mods so user understands which variation belong to light or dark mode. Besides that, when user hovers on shade he will also get use case tooltip for that particular shade.
Typography size overview
While adjusting advanced settings, user will have table preview with fluid sizes, or text preview where he could see actual size of the particular step.
Also there is indication if token is unlinked, so you will have feedback indication that settings won’t affect that token which is manually controlled via Tokens panel.
Spacing preview
Same as for typography is done for spacing, you will have option to preview regular and section spacing.
Also there is indication if token is unlinked, so you will have feedback indication that settings won’t affect that token which is manually controlled via Tokens panel.
Theme switches docs
Theme switches docs
Theme switches docs
In this article, we are going to cover how we could modify the styling and functionality of theme switches.
Styling options
As shown in the image image below, we have 6 options to style:
- Size – controls size of the whole element
- Moon icon color – color of the Moon icon, we use a CSS variable that could be a hex value also
- Sun icon color – color of the Sun icon, we use a CSS variable that could be a hex value also
- Background color – switch background color
- Border color – switch border-color
- Knob color – controls the color the switch knob
Functionality options
data-matchmedia
Value: true or false
Before the user interacts with the component we need to show a dark or light theme. The default theme is the theme from the app settings. If we set this to true, the theme setter will check the user preference in the browser and system to see if does user prefers a dark or light theme and set the theme according to this.
data-buttonstate
Value: current or next
As there isn’t a defacto standard related to toggles should they represent the current or next state? With this option, you could reverse the UX of a component and force the component to show a reversed state.
Animated theme toggles
Animated theme toggles
Animated theme toggles
Styling options
 For basic styles like size and color we need to navigate to the code block called “Theme toggle Code” (1) and under the design tab we should have the option to set the color for toggle (2).
To make toggle size we need to adjust the font-size (3)
Functionality options
Match media
If we want to use settings from browser preference until the first user interaction as the default theme we should set data-match media to true
Desired UX
There is an option to data-buttonstate which could be current or next. The default UX is to show the current state (for example, the sun icon in dark mode which represents after clicking it will get to light mode). If the desired option is that the icon shows the next state you need to set this value to next.
Styling per dark/light mode
To set separate colors per dark/light mode you could do the following Theme Toggle code > Advanced > Custom CSS, and drop the following custom CSS. instead of named colors in this example, you could use your own custom hex colors.
{
--toggle-color-dark-mode: gold;
--toggle-color-light-mode: dodgerblue;
}
Theme modes API
Theme modes API
Theme modes API
In this post, we will introduce Headspin UI Dark Theme API. Dark Theme API is a convenient set of functions that allow users to switch between dark and light modes.
Theme mode hierarchy
Before diving into all the options that we could use, we should understand how dark/light mode logic operates. The hierarchy shown below is in cascade fashion, so each step later will take priority and override the step before.
- App settings
- Match browser/system preference (OPTIONAL)
- User preference
Logic is following:
- First, we retrieve settings from the Headspin app (dark/light), and that will make the initial theme assumption but has the lowest priority.
- After we that if API has an option called match media, if data-matchmedia is true this option will be enabled and this will check user browser preference and pull theme from there
- User preference – This will check the user’s local storage to find if the user set up a theme after the interaction. This step has the highest priority and the first two are like fallback logic until the user interacts with the theme settings UI element.
To recap two steps are logic to set the theme if the user didn’t set up the theme by clicking on toggle/dropdown. The third step will check if the user has some data stored in local storage and set the theme according to that data.
Event API
In the table below we have examples of events that we could use to make more modifications. Init event hooks run only once (initial theme setup after the page is loaded), while Update event hooks are client-side hooks to run before/after each change.
Event | Description | Runs |
theme:hook:beforeInit | Event that runs before the theme is established | Once |
theme:hook:afterInit | Event that runs after the theme is established | Once |
theme:hook:beforeUpdate | Event that runs before the theme setting occurs | Multiple |
theme:hook:afterUpdate | Event that runs before the theme setting occurs | Multiple |
Some usage examples are given below to use as boilerplate for custom logic:
window.addEventListener("theme:hook:beforeInit", function(e){
e = e || window.event;
console.log(e.datil);
})
window.addEventListener("theme:hook:afterInit", function(e){
e = e || window.event;
console.log(e.datil);
})
window.addEventListener("theme:hook:beforeUpdate", function(e){
e = e || window.event;
console.log(e.datil);
})
window.addEventListener("theme:hook:afterUpdate", function(e){
e = e || window.event;
console.log(e.datil);
})
Realtime cross tabs events
There is also a real-time sync mechanism for multiple opened tabs in the same browser via Broadcast Channel API. In the example below you could use code to hook after the theme was changed, this method we are using for theme change across multiple tabs, if you need to extend further use the sample code below as a boilerplate.
const realtime = new BroadcastChannel("headspin_theme_channel");
realtime.onmessage = (event) => {
console.log(event.data);
};