Spacing Bars

Introduction to Adding Spacing Bars in Element Studio

This tutorial explains how to enhance your web elements with responsive spacing bars using Element Studio, a feature of Breakdance that simplifies the application of consistent margins within your designs.

Creating an Element with Spacing Bars

Setting Up the Element

  1. Create a new element named “spacing bars demo” in Element Studio.
  2. Add a control section to the design controls and name it “test”.
  3. Place the new element on your page to prepare for further customization.

Adding Spacing Presets

  1. Add a spacing preset to the element; choose “spacing margin y” to control vertical spacing (margin top and bottom).
  2. Adjust the preset settings to define the margin values, avoiding the use of horizontal spacing, which is better managed through flexbox gap settings as recommended for Breakdance elements.

Configuring Spacing Bars

Implementing Spacing Bars

  1. Navigate to the special properties tab and select ‘spacing bars’.
  2. Add a new spacing bar and set it to affect the ‘margin-top’ CSS property on the root element.
  3. Ensure the spacing bar settings are responsive by incorporating breakpoints in the configuration (e.g., “design.spacing.breakpoint.margin_top”).

Testing and Adjusting Spacing

After configuring the spacing bars:

  1. Leave and re-enter the element to activate the spacing bars.
  2. Test the functionality by adjusting the top and bottom margins using the newly added spacing bars.
  3. Add similar settings for the ‘margin-bottom’ to ensure both top and bottom margins can be dynamically adjusted.

Finalizing Spacing Bar Functionality

Activating Spacing Bars with CSS

To make the spacing bars functional:

  1. Go back to the design controls and use the code help feature to generate the necessary CSS.
  2. Paste the provided macro into your generated CSS section to link the visual adjustments directly with the CSS properties.

Additional Notes

Spacing bars provide a user-friendly way to apply consistent spacing to elements within Breakdance. By following these steps, you can ensure that your web elements are both aesthetically pleasing and functionally responsive, adhering to modern web design practices.