Adding Rozz to Your Website: Data Attributes Guide

The <rozz-box> web component allows for extensive customization using several data-* attributes. These attributes control the look and feel of the component, from button styling to box behavior.

WordPress Shortcode Users The attributes are simplified in WP: remove the ‘data-‘ and replace ‘-‘ with ‘_’. For example: data-button-background becomes button_background. The full list of shortcodes is available here. The WP plugin itself is available here.

Button Attributes

  <rozz-box data-button-background="linear-gradient(90deg, #ff0000, #00ff00)"></rozz-box>
  

  <rozz-box data-button-text=" Now"></rozz-box>
  

  <rozz-box data-button-animation="true"></rozz-box>
  

  <rozz-box data-button-top-position="70vh"></rozz-box>
  

  <rozz-box data-button-right-position="10vw"></rozz-box>
  

  <rozz-box data-button-positioning-method="absolute"></rozz-box>
  

Box Attributes

  <rozz-box data-max-width="50%"></rozz-box>
  

  <rozz-box data-max-height="600px"></rozz-box>
  

  <rozz-box data-font-family="'Courier New', monospace"></rozz-box>
  

  <rozz-box data-initial-status="open"></rozz-box>
  

  <rozz-box data-theme-color="blue"></rozz-box>
  

  <rozz-box data-query-background="pink"></rozz-box>
  

  <rozz-box data-query-text-color="red"></rozz-box>
  

  <rozz-box data-result-text-color="purple"></rozz-box>
  

Technical Details

All attributes are implemented using CSS variables and Lit component properties, ensuring flexibility and ease of customization. When these attributes are provided, they are reflected in the underlying DOM, allowing the user to change the appearance and behavior of the box without modifying the core code.

Example of Integrating Rozz

Here’s an example of integrating Rozz to your website with custom settings. Note that you only need to include in your code the attributes that you wish to customize, the others will fall back to defaults if they are not present.

<rozz-box
  data-button-background="pink"
  data-button-text="hello world"
  data-button-animation="true"
  data-button-top-position="50vh"
  data-button-right-position="5vw"
  data-button-positioning-method="fixed"
  data-max-width="900px"
  data-max-height="75%vh"
  data-font-family="courier"
  data-initial-status="closed"
  data-theme-color="blue"
  data-query-background="pink"
  data-result-text-color="purple"
  data-query-text-color="red"
></rozz-box>

By using these data attributes, you can easily customize Rozz to fit seamlessly into your website’s design and functionality!

Posted September 3, 2024

---

Searchbox Attributes

The following attributes pertain to the searchbox portion of Rozz and mirror many of the box attributes above.

  <rozz-box data-max-width="50%"></rozz-box>
  

  <rozz-box data-max-height="600px"></rozz-box>
  

  <rozz-box data-font-family="'Courier New', monospace"></rozz-box>
  

  <rozz-box data-initial-status="open"></rozz-box>
  

  <rozz-box data-theme-color="blue"></rozz-box>
  

  <rozz-box data-query-background="pink"></rozz-box>
  

  <rozz-box data-query-text-color="red"></rozz-box>
  

  <rozz-box data-result-text-color="purple"></rozz-box>
  

Example of Integrating Rozz (Searchbox-focused)

<rozz-box
  data-button-background="pink"
  data-button-text="hello world"
  data-button-animation="true"
  data-button-top-position="50vh"
  data-button-right-position="5vw"
  data-button-positioning-method="fixed"
  data-max-width="900px"
  data-max-height="75vh"
  data-font-family="courier"
  data-initial-status="closed"
  data-theme-color="blue"
  data-query-background="pink"
  data-result-text-color="purple"
  data-query-text-color="red"
></rozz-box>

Technical Details (continued)

Example of Integrating Rozz (Final)

<rozz-box
  data-button-background="pink"
  data-button-text="hello world"
  data-button-animation="true"
  data-button-top-position="50vh"
  data-button-right-position="5vw"
  data-button-positioning-method="fixed"
  data-max-width="900px"
  data-max-height="75vh"
  data-font-family="courier"
  data-initial-status="closed"
  data-theme-color="blue"
  data-query-background="pink"
  data-result-text-color="purple"
  data-query-text-color="red"
></rozz-box>

Posted September 3, 2024