Opportunities Widget Theming via CSS Variables

Partners can fully customize the appearance of the Opportunities widget without forking code. Use custom attributes on the <legion-opportunities> element to pass values that map to CSS variables inside the widget iframe.

The card system keeps text off the image: the photo lives in a fixed-ratio frame and all copy sits on a solid surface, so cards read the same whether the image is bright, dark, busy, or missing entirely. One anatomy, five sizes (portrait, square, banner, list, hero).

🎨 Visual Customizer

For an interactive customization experience with live preview, visit: /widgets/opportunities/customize

Quick Start

1<legion-opportunities 2 count="5" 3 layout="horizontal" 4 base-url="https://your-domain.com" 5 opp-accent="#5a48e6" 6 opp-card-radius="18px" 7 opp-title-size="19px" 8> 9</legion-opportunities>

Notes:

  • base-url should point to your Legion deployment domain.
  • If an attribute is omitted, sensible defaults are used.
  • Legacy overlay-panel attributes (opp-panel-*, opp-title-shadow, opp-animation-scale, …) from the previous card design are no longer used and are safely ignored.

Card Variants

Use the variant attribute to pick a card style:

VariantBest for
portraitFeeds & discovery — media-forward (5:4 image)
squareGrids & dashboards — compact 1:1 tile
bannerPromoted slots — image and copy side by side
listDense lists & sidebars — thumbnail + one line
heroFeatured — full-bleed image, copy on a panel

If omitted, horizontal layouts use portrait and vertical layouts use list.

1<legion-opportunities 2 variant="square" 3 count="6" 4 base-url="https://your-domain.com" 5> 6</legion-opportunities>

Preset Themes

Use the theme attribute for quick preset styling:

ThemeDescription
lightDefault — white surface, dark accent button
darkDark card surface with light text
minimalBorder-only cards, no shadows
boldLarger titles, rounder corners
corporateSlate accent, sharp corners, no animations
vibrantIndigo accent with colored hover glow
<legion-opportunities theme="bold" count="5" base-url="https://your-domain.com"> </legion-opportunities>

Complete Attributes Reference

Core Attributes

AttributeTypeDefaultDescription
countnumber5Number of opportunities (1-20)
layoutstringhorizontal"horizontal" or "vertical"
variantstringautoportrait, square, banner, list, hero
tagsstring-Comma-separated filter tags
themestringlightPreset theme name
heightstringauto"auto", "100%", or specific px
base-urlstringcurrent originYour deployment URL
api-keystring-Optional API key

Card Surface

AttributeCSS VariableDefaultDescription
opp-accent--opp-accent#16181dCTA button background
opp-accent-contrast--opp-accent-contrast#ffffffText/icon color on the accent
opp-card-bg--opp-card-bg#ffffffCard surface background
opp-text-color--opp-text-color#16181dBase text color
opp-card-radius--opp-card-radius18pxCard border radius
opp-card-shadow--opp-card-shadowsoft layered shadowCard box-shadow
opp-card-hover-shadow--opp-card-hover-shadowdeeper layered shadowCard box-shadow on hover
opp-card-border--opp-card-border1px solid #e6e8ecCard border
opp-font-family--opp-font-familyHanken GroteskBody font family

Media Frame & Chips

AttributeCSS VariableDefaultDescription
opp-media-ratio--opp-media-ratio5 / 4Aspect ratio of the image frame
opp-media-bg--opp-media-bg#dfe2e7Background behind images
opp-category-bg--opp-category-bgrgba(16,18,24,.5)Category chip background
opp-category-color--opp-category-color#ffffffCategory chip text color
opp-reward-bg--opp-reward-bg#fdeecbReward pill background
opp-reward-color--opp-reward-color#8a5a00Reward pill text color
opp-reward-size--opp-reward-size12.5pxReward pill font size

Typography

AttributeCSS VariableDefaultDescription
opp-title-size--opp-title-size19px (per variant)Title font size
opp-title-color--opp-title-colorinherits text colorTitle color
opp-title-weight--opp-title-weight700Title font weight
opp-title-font-family--opp-title-font-familyBricolage GrotesqueTitle font family
opp-description-size--opp-description-size13.5pxDescription size
opp-description-color--opp-description-color#626a78Description color
opp-description-font-family--opp-description-font-familyinheritDescription font
opp-description-line-height--opp-description-line-height1.45Line height
opp-expires-size--opp-expires-size12.5pxExpiry text size
opp-expires-color--opp-expires-color#8b93a1Expiry text color

Buttons

AttributeCSS VariableDefaultDescription
opp-button-radius--opp-button-radius12pxCTA and save button radius
opp-save-border--opp-save-border#e0e3e8Save (bookmark) button border
opp-save-bg--opp-save-bgtransparentSave button background
opp-save-color--opp-save-color#626a78Save button icon color

Animations

AttributeCSS VariableDefaultDescription
opp-transition-duration--opp-transition-duration0.3sHover lift/shadow speed (0s = off)

Visual Examples

Brand accent with rounder cards:

1<legion-opportunities 2 count="3" 3 base-url="https://your-domain.com" 4 opp-accent="#0f766e" 5 opp-card-radius="22px" 6> 7</legion-opportunities>

Dense list for a sidebar:

1<legion-opportunities 2 count="6" 3 layout="vertical" 4 variant="list" 5 base-url="https://your-domain.com" 6> 7</legion-opportunities>

Corporate look with sharp corners:

1<legion-opportunities 2 count="5" 3 base-url="https://your-domain.com" 4 opp-accent="#1e293b" 5 opp-card-radius="6px" 6 opp-button-radius="6px" 7 opp-transition-duration="0s" 8> 9</legion-opportunities>

WordPress Integration

Step 1: Add the Script (One Time)

Add this script to your theme's header.php or use a plugin like "Header Footer Code Manager":

<script src="https://your-domain.com/js/opportunities-widget.js"></script>

Step 2: Add the Widget

Gutenberg/Block Editor: Use a "Custom HTML" block and paste the widget code.

Classic Editor: Switch to "Text" mode (not Visual) and paste the code.

Elementor: Use the "HTML" widget and paste the complete embed code.

Widget Areas: Use a "Custom HTML" widget in your sidebar or footer.

Example for WordPress:

1<!-- Add to Custom HTML block or widget --> 2<legion-opportunities 3 count="5" 4 layout="horizontal" 5 base-url="https://your-domain.com" 6 theme="bold" 7> 8</legion-opportunities>

How it works

  1. The web component appends your attributes as query parameters to the widget iframe URL.
  2. The widget page reads those values and injects them as CSS variables on the root container.
  3. The opportunity card component uses those variables in its CSS, with sensible defaults for anything you don't set.

Tips

  • Match opp-accent to your brand color and keep opp-accent-contrast readable on it.
  • Text never sits on the photo, so you don't need shadows or overlays for readability.
  • Use the visual customizer at /widgets/opportunities/customize for real-time preview.
  • For WordPress, add the script tag only once per page (in header or footer).

Troubleshooting

  • If styles don’t change, ensure attributes are set on the <legion-opportunities> element and you’re loading the latest widget bundle.
  • Confirm your base-url points to the right environment (staging vs production).
  • WordPress issues: Make sure you're in "Text/HTML" mode, not "Visual" mode when pasting code.
  • CORS errors: Ensure your domain is allowed in the widget's CORS configuration.
Documentation | Legion Hand Technologies