Community Gallery Widget Theming via CSS Variables

Customize the appearance of the Community Gallery widget using custom attributes on the <legion-community-gallery> element.

🎨 Visual Customizer

For an interactive customization experience with live preview, visit: /widgets/community-gallery/customize

Quick Start

1<legion-community-gallery 2 count="4" 3 theme="light" 4 show-view-all="true" 5 view-all-url="/gallery" 6 community-url="/community" 7 api-url="https://your-domain.com" 8 gallery-card-radius="12px" 9> 10</legion-community-gallery>

Core Attributes

AttributeTypeDefaultDescription
countnumber4Number of items to display (1-12)
themestringlight"light" or "dark"
show-view-allbooleantrueShow "View all in Gallery" link
view-all-urlstring/galleryURL for the "View all" link
community-urlstring-URL to open when clicking media items
api-urlstringoriginYour deployment URL

CSS Theming Attributes

Container Theming

AttributeCSS VariableDefaultDescription
gallery-primary-color--gallery-primary-color#228be6Primary accent color
gallery-background-color--gallery-background-colortransparentContainer background
gallery-text-color--gallery-text-color#1a1b1ePrimary text color

Card Theming

AttributeCSS VariableDefaultDescription
gallery-card-radius--gallery-card-radius12pxCard radius
gallery-card-shadow--gallery-card-shadow0 2px 8px rgba(0,0,0,0.1)Card shadow
gallery-gap--gallery-gap8pxGrid gap

Overlay Theming

AttributeCSS VariableDefaultDescription
gallery-overlay-bg--gallery-overlay-bglinear-gradient(0deg, rgba(0,0,0,0.6)...)Overlay gradient

Typography

AttributeCSS VariableDefaultDescription
gallery-font-family--gallery-font-familyinheritFont family
gallery-username-size--gallery-username-size12pxUsername text size
gallery-username-color--gallery-username-color#ffffffUsername color
gallery-icon-size--gallery-icon-size20pxMedia icon size

Animations

AttributeCSS VariableDefaultDescription
gallery-transition-duration--gallery-transition-duration0.2sAnimation speed
gallery-hover-scale--gallery-hover-scale1.03Hover scale

Click-Through Behavior

When a user clicks on a gallery item, the widget opens the community-url with these query parameters:

  • postId - The original post ID
  • mediaIndex - Index of the media in the post's images array
  • gridIndex - Index in the gallery grid
  • utm_source=gallery_widget
  • utm_medium=embed

Use these parameters to scroll/focus to the correct post on your community page.

Dark Theme Example

1<legion-community-gallery 2 count="4" 3 theme="dark" 4 api-url="https://your-domain.com" 5 gallery-card-shadow="0 2px 8px rgba(0,0,0,0.3)" 6> 7</legion-community-gallery>
1<legion-community-gallery 2 count="8" 3 theme="light" 4 api-url="https://your-domain.com" 5 gallery-card-radius="8px" 6 gallery-hover-scale="1.05" 7 community-url="https://your-domain.com/community" 8> 9</legion-community-gallery>

WordPress Integration

Add to your theme's header:

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

Then use in any Custom HTML block:

1<legion-community-gallery 2 count="4" 3 theme="light" 4 api-url="https://your-domain.com" 5 community-url="https://your-domain.com/community" 6> 7</legion-community-gallery>
Documentation | Legion Hand Technologies