How to get started real quick with Headspin
How to get started real quick with Headspin
How to get started real quick with Headspin
As Headspin offers CSS variables, you can use it in many ways. So far this is my favorite and fastest way how to get started.
- install and set colors I need in Copilot plugin
- sync colors so they will appear in Breakdance palette
- set font weights for text, headings via Global settings (BD)
- set font family via Global settings
-> start building website. In case I need some repetitive styles -> I will use presets and apply headspin css variables (e.g. –hfs-h3).
If I feel like the font sizes and spacings are too small -> I will go to Copilot plugin dashboard and change the ratio there.
Works in 95% cases, I am building mostly simple sites.
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.
Getting Started
Slider framework architecture
It is important to understand following terms:
- Carousel
- Main Slider (master)
- Components
- Thumbnail slider (slave)
- Connected Sliders (slave)
1. Carousel
Special div which is uses as reference for all of the components. If you put components outside this div, they won’t work. Please check structure and locate element named 0. carousel this is where all magic happens.
2. Main Slider
Inside Carousel we could have multiple sliders in some configuration. Only one can act as master and other are slave sliders. This is important because master has bi-directional event connection to slave sliders, and slave sliders have uni-directional connection to Main slider. This slider has data-swiper=”main”custom attribute. If you have more than one slider with this attribute, the first slider in DOM will become master. All custom components needs to be inside Carousel and they will show progress data, and controls for the Main Slider.
If you add slave sliders, you should keep in mind that they should have same number of the slides as the Main or controls will correspond just to Main slider data and other slave sliders could show irrelevant content.
3. Components
Components are special block which are acting as custom controls for Main Slider. Some of them include functions like:
- Prev/Next navigation
- Play/Pause controls for autoplay
- Bullet navigation
- Fractional pagination
- Active teleport
- or could be combined in hybrid when placed in another div like fraction + bullet
4. Thumbnail slider
This slider functions as a slave slider. The content within this slider cannot be manually controlled; instead, it automatically extracts segments of content from the main slide. By setting data-swiper-thumbnail=”true” the content will be transferred into a thumbnail. The fallback option is a complete copy of the entire slide.
From a UX/A11Y perspective, this serves as a replacement for bullet or numbered navigation. Therefore, refrain from using those if you are already utilizing thumbnails.
5. Connected sliders
If you insert an additional slider within the Carousel div, it will function as a connected slider. Please ensure that it does not possess the data-swiper=”main” attribute, as there should only be one master slide. In the event of having two master sliders, the initial one will serve as the master, while the subsequent slider will act as the slave.
Components
We have different components which will work with Main slider based
Advanced slider setup
Setup docs for Advanced Slider
Post list setup
Coming soon: Setup docs for Dynamic Slider.
Components
Table – components overview
When you copy/paste Slider framework component, in structure panel you will see numbered elements. This table below explains each of them.
No | Name | Description |
---|---|---|
0 | Carousel | Carousel is a special div where magic happens. Everything here works when it is placed within the Carousel div. This is used to distinguish which controls should control which slider in case you are using more than one slider. |
0.1 | Skip link | This is link which is invisible until users enters Carousel by using keyboard. It will give users option to skip carousel and enhance accessibility. |
0.2 | Framework API | Main code which enables all the magic. Don’t remove it or move outside Carousel div [0]. |
0.3 | Main slider | All controls are connected to this slider |
0.4 | Thumb slider | Secondary slider which teleports all elements from Main Slider [0.3] or you could select manually content to teleport by using attribute data-swiper=”teleport” |
ELEMENTS | ||
1 | Controls | |
1.1 | Next/Prev controls | Buttons that are switching to next or previous slide |
1.2 | Pause/Play controls | Buttons that control slider autoplay. If you’re using autoplay, you should incorporate them in the design. |
2 | Pagination | |
2.1 2.2 | Numbered pagination | Gives an indicator of the active slide and also provides the option to switch slides. |
2.3 2.4 | Steps pagination | Gives indication about the current slide and where it is placed among all slides. |
3 | Indicators | |
3.1 3.2 | Fraction Indicator | Non-interactive element. Gives feedback about the current slide and the count of slides. |
3.3 | Progress indicator | Non-interactive element. Gives feedback about the % of slides from the total count of slides. |
4 | Autoplay elements | |
4.1 | Autoplay duration circular progress bar | Gives feedback on how much time is left until autoplay switches to new slide |
4.2 | Autoplay duration circular progress bar with textual feedback in seconds | Gives feedback on how much time is left until autoplay switches to new slide |
4.3 | Autoplay duration textual feedback in seconds | Gives feedback on how much time is left until autoplay switches to new slide |
4.4 | Next/Prev slide controls with autoplay progress bar | – Buttons that are switching to next or previous slide – Gives feedback on how much time is left until autoplay switches to new slide |
4.5 | Autoplay duration progress bar | Gives feedback on how much time is left until autoplay switches to new slide |
4.6 | Fraction indicator with autoplay duration progress bar | – Non-interactive element. Gives feedback about the current slide and the count of slides. – Gives feedback on how much time is left until autoplay switches to new slide |
4.7 | Steps navigation with autoplay duration circular progress bar | – Gives indication about the current slide and where it is placed among all slides. – Gives feedback on how much time is left until autoplay switches to new slide |
4.8 | Pause/Play controls with autoplay duration circular progress bar | – Buttons that control slider autoplay. If you’re using autoplay, you should incorporate them in the design. – Gives feedback on how much time is left until autoplay switches to new slide |
Style guide
When you copy/paste Slider framework component, in structure panel you will see numbered elements. This table below explains each of them.
Next/Prev controls [1.1]
Style them as you would normally style buttons in Breakdance.
Pause/Play controls [1.2]
Style them as you would normally style buttons in Breakdance.
Numbered pagination [2.1, 2.2, 2.3, 2.4]
This element is dynamically made so you need to style it under Advanced > Custom CSS. We have prepared.
There are 3 comments explaining which styles it affect:
- Active – styles related to active slider
- Focus – style related to focus state
- Default – style applied to all elements
Fractional indicator [3.1, 3.2]
Style them as you would normally style text elements in Breakdance.
Progress indicator [3.3]
There are 2 comments explaining which styles it affect:
- Progress bar styles
- Track under progress bar styles
Circular autoplay progress [4.1]
There are 2 comments explaining which styles it affect:
- Circular progress bar styles
- Size styles (max-width)
Circular autoplay progress with countdown [4.2]
Countdown element you should style as you would any text element
There are 2 comments explaining which styles it affect for circular progress:
- Circular progress bar styles
- Size styles (max-width)
Circular autoplay progress with countdown [4.3]
Countdown element you should style as you would any text element.
Next/Prev buttons with circular progress [4.4]
Style them as you would normally style buttons in Breakdance.
Circular progress element you style with Custom CSS, there is one comment which points where you could change color. Style stroke to adjust.
Autoplay progress line [4.5]
There are 2 comments explaining which styles it affect:
- Progress bar styles
- Track under progress bar styles
Fraction indicators with autoplay progress line [4.6]
Style fraction elements as you would style Breakdance text element
There are 2 comments explaining which styles it affect:
- Progress bar styles
- Track under progress bar styles
Dot navigation with circular autoplay progress [4.7]
There are 4 comments explaining which styles it affect:
- Active dot style
- Progress color
- Focus dot styles
- Default dot styles (applies to all dots, active and focus override it)
Pause/Play buttons with circular progress [4.8]
Style them as you would normally style buttons in Breakdance.
Circular progress element you style with Custom CSS, there is one comment which points where you could change color. Style stroke to adjust.
Magics
Magic attributes
Magic attributes
Magics within the Slider Framework are unique custom attributes that transform Breakdance elements into Slider functionalities. These include displaying the number of the current slide, the total count of all slides, an autoplay countdown, and features such as pausing and playing autoplay.
Attribute | Element | Description |
---|---|---|
data-swiper=”currentSlideNum” | Text | This magic attribute will convert any text element to show current slide number on any text element. |
data-swiper=”countSlideNum” | Text | This magic attribute will convert any text element to show total slide number. |
data-swiper-autoplay=”countdown” | Text | This magic attribute will convert any text element to show autoplay slide time left. It will count down each second. |
data-swiper=”stop” | Button | This magic attribute will convert any button element to act as autoplay pause button. |
data-swiper=”start” | Button | This magic attribute will convert any button element to act as autoplay play button. |
Events
Additional events
Accessibility
Overview – todo
dasd
UX Guidlines
0. Avoid sliders
Sliders are notoriously bad for UX and A11Y. If you could use alternative design, please consider this. If you really want or need to use them please take points below to make it less sucking UX for users.
1. Use bigger dots, or even thumbnails
Usually slider dots are small and hard to click. Clickable area should be at least 24×24 pixels.
2. Alternatives to dots navigation
As alternative approach you could use thumbnail component for navigation instead just dots. Dots don’t provide much information. Also you could use number page navigation instead of dots (bullets) which would at least give more clue about slide numbers.
3. Use only one pagination pattern
Within Slide Framework there are many pagination patterns (bullets-dots, numbers, fraction, and thumbnail). We recommend usage of only one pattern as using dots and thumbnails would make usage of two element with same purpose and lead to harder navigation. Fraction pagination is only exception because it does not offer navigation option, rather just visual indication.
4. Avoid autoplay
Autoplay/autorotation sliders are notoriously hard to use avoid them if you can. If you need autoplay please consider this list:
- Autoplay duration should be at least 5-7s to give users enough time
- Pause button is must, and should be placed above slider in HTML order, if you need it at another position use CSS. Before entering autorotation slider, user should have option to pause it for easier navigation.
- Place next/previous arrows below slider at mobile because this way user interacting with slider will not cover slides by hand in order to navigate. Tip: You could use two sets of elements, and display: none to hide desktop arrows on mobile, and show mobile ones below at smaller screens
- Pause on interaction – when user hovers or interacts with slider, you should pause autoplay as probably he wants to interact and autoplay could move desired content to interact off visible portion of the screen
Autoplay
Autoplay/autorotation sliders are notoriously hard to use avoid them if you can. If you need autoplay please consider this list:
Pause on interaction – when user hovers or interacts with slider, you should pause autoplay as probably he wants to interact and autoplay could move desired content to interact off visible portion of the screen
Autoplay duration should be at least 5-7s to give users enough time
Pause button is must, and should be placed above slider in HTML order, if you need it at another position use CSS. Before entering autorotation slider, user should have option to pause it for easier navigation.
Place next/previous arrows below slider at mobile because this way user interacting with slider will not cover slides by hand in order to navigate. Tip: You could use two sets of elements, and display: none to hide desktop arrows on mobile, and show mobile ones below at smaller screens
Bullet navigation – todo
dasd
Pause/Play Controls – todo
dasd
Previous/Next Controls – todo
dasd
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, providing 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, appropriate ARIA roles and attributes, and proper focus management, making navigation easy 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. 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 display either a dark or light theme. The default theme is taken from the app settings. If we set this to true, the theme setter will check the user’s preferences in the browser and system to determine if they prefer a dark or light theme, and will set the theme accordingly.
data-buttonstate
Value: current or next
As there isn’t a clear standard regarding toggles, should they display the current state or the next state? With this option, you could reverse the user experience of a component and force it to show an inverted 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;
}