Can you utilize component custom properties in html-embed to have unique html-embed with different svg elements for each component?

TL;DR
  • Add custom properties like color and size to the component for SVG variations.
  • Use an HTML Embed to insert SVG code with placeholders referencing custom properties.
  • Apply different property values to each component instance for unique SVG variations.
  • Preview and adjust property values to ensure correct rendering of the SVGs in the project.

Modifying individual SVGs in components using custom properties allows for unique designs. Here's how to achieve it in Webflow:

1. Use Component Custom Properties

  • Add custom properties to the component for SVG variations. For example, color and size might be properties to modify.

2. Embed HTML with Properties

  • Insert an HTML Embed in the component.
  • Use placeholders in your SVG code that reference the custom properties. For example: <svg width="${widthProperty}" height="${heightProperty}" fill="${colorProperty}">.

3. Configure Each Component

  • Apply unique values to the custom properties for each component instance.
  • Ensure that each instance displays the desired variation of the SVG by inputting the respective property values.

4. Test the Outputs

  • Preview the project and ensure each component renders the SVG as expected.
  • Make adjustments to property values as necessary for visual adjustments.

Summary

By setting custom properties within Webflow components, you can dynamically modify SVG elements using HTML Embed, making each component instance visually distinct.

Rate this answer

Other Webflow Questions