Community Posts Widget Theming via CSS Variables

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

🎨 Visual Customizer

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

Quick Start

1<legion-community-posts 2 page-size="10" 3 filter="recent" 4 show-filters="true" 5 show-actions="true" 6 theme="light" 7 height="800px" 8 api-url="https://your-domain.com" 9 posts-primary-color="#228be6" 10 posts-card-radius="12px" 11> 12</legion-community-posts>

Core Attributes

AttributeTypeDefaultDescription
page-sizenumber10Posts per page (5-50)
filterstringrecent"recent", "popular", or "unanswered"
channel-idstring-Optional channel UUID to filter posts
show-filtersbooleantrueShow filter tabs
show-actionsbooleantrueShow Support and Start conversation buttons
auth-tokenstring-JWT token for authenticated actions
user-idstring-Current user ID for reactions
usernamestring-Current user display name
themestringlight"light" or "dark"
heightstring800pxWidget height
api-urlstringoriginYour deployment URL

CSS Theming Attributes

Container Theming

AttributeCSS VariableDefaultDescription
posts-primary-color--posts-primary-color#228be6Primary accent color
posts-background-color--posts-background-colortransparentContainer background
posts-text-color--posts-text-color#1a1b1ePrimary text color
posts-secondary-text-color--posts-secondary-text-color#868e96Secondary text
posts-border-color--posts-border-color#dee2e6Border color

Card Theming

AttributeCSS VariableDefaultDescription
posts-card-bg--posts-card-bg#ffffffCard background
posts-card-radius--posts-card-radius12pxCard radius
posts-card-shadow--posts-card-shadow0 2px 8px rgba(0,0,0,0.06)Card shadow
posts-card-padding--posts-card-padding16pxCard padding

Avatar Theming

AttributeCSS VariableDefaultDescription
posts-avatar-size--posts-avatar-size44pxAvatar size
posts-avatar-radius--posts-avatar-radius50%Avatar radius

Typography

AttributeCSS VariableDefaultDescription
posts-font-family--posts-font-familyinheritFont family
posts-title-size--posts-title-size14pxTitle text size
posts-title-weight--posts-title-weight600Title weight
posts-body-size--posts-body-size14pxBody text size
posts-meta-size--posts-meta-size12pxMeta text size

Tags/Badges

AttributeCSS VariableDefaultDescription
posts-tag-bg--posts-tag-bg#e7f5ffTag bg color
posts-tag-color--posts-tag-color#1c7ed6Tag text
posts-tag-radius--posts-tag-radius4pxTag radius

Actions

AttributeCSS VariableDefaultDescription
posts-action-bg--posts-action-bgtransparentAction btn bg
posts-action-color--posts-action-color#868e96Action btn color
posts-action-hover-bg--posts-action-hover-bg#f1f3f5Hover background
posts-like-color--posts-like-color#fa5252Active like color

Animations

AttributeCSS VariableDefaultDescription
posts-transition-duration--posts-transition-duration0.2sAnimation speed
posts-gap--posts-gap16pxPost gap

Dark Theme Example

1<legion-community-posts 2 page-size="10" 3 theme="dark" 4 api-url="https://your-domain.com" 5 posts-card-bg="#25262b" 6 posts-text-color="#c1c2c5" 7 posts-border-color="#373a40" 8> 9</legion-community-posts>

Authenticated Example

1<legion-community-posts 2 page-size="15" 3 filter="popular" 4 theme="light" 5 api-url="https://your-domain.com" 6 auth-token="eyJhbGciOiJIUzI1NiIs..." 7 user-id="user_12345" 8 username="JaneDoe" 9> 10</legion-community-posts>

WordPress Integration

Add to your theme's header:

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

Use in any Custom HTML block:

1<legion-community-posts 2 page-size="10" 3 theme="light" 4 height="600px" 5 api-url="https://your-domain.com" 6> 7</legion-community-posts>
Documentation | Legion Hand Technologies