Campaigns Carousel Widget – React SDK

Install the Campaigns Carousel Widget as an NPM package for first-class React (and TypeScript) support. Features gradient-styled campaign cards with configurable display limits and expiration badges.

Installation

npm install @legionhandtech/lht-react-widgets

React 17+ is a peer dependency. If your project already has React installed you're good to go.

Quick Start

1import { LegionCampaignsCarousel } from '@legionhandtech/lht-react-widgets'; 2 3function App() { 4 return ( 5 <LegionCampaignsCarousel 6 baseUrl="https://your-legion-domain.com" 7 maxCampaigns={5} 8 theme="light" 9 /> 10 ); 11}

You can also import from the dedicated sub-path:

import { LegionCampaignsCarousel } from '@legionhandtech/lht-react-widgets/campaigns-carousel';

Props Reference

Core Props

PropTypeDefaultDescription
baseUrlstringrequiredBase URL of your Legion deployment
apiKeystringAPI key for authorization
maxCampaignsnumber5Maximum campaigns to show
showExpirationbooleantrueWhether to show expiration dates
theme"light" | "dark""light"Theme preset
widthstring"100%"Widget width (CSS value)
heightnumber280Widget height in pixels
classNamestringCSS class applied to the outer container
styleReact.CSSPropertiesInline styles merged into the container
onLoad(detail) => voidCalled when the widget iframe finishes loading
onError(message: string) => voidCalled if the widget iframe fails to load

Theming Props

All 8 theming props are optional. Unlike other widgets, the carousel uses camelCase parameters.

PropQuery ParamExample
panelStartpanelStart"#1a1b5e"
panelMidpanelMid"#2d2f8e"
panelEndpanelEnd"#4a4dc4"
panelShadowpanelShadow"0 4px 12px rgba(0,0,0,0.3)"
titleSizetitleSize"1.5rem"
descriptionSizedescriptionSize"0.9rem"
titleShadowtitleShadow"0 2px 4px rgba(0,0,0,0.5)"
descriptionShadowdescriptionShadow"0 1px 2px rgba(0,0,0,0.3)"

See the TypeScript CampaignsCarouselThemingProps interface for the complete list.

Imperative Ref API

1import { useRef } from 'react'; 2import { LegionCampaignsCarousel, LegionCampaignsCarouselHandle } from '@legionhandtech/lht-react-widgets'; 3 4function App() { 5 const widgetRef = useRef<LegionCampaignsCarouselHandle>(null); 6 7 return ( 8 <> 9 <button onClick={() => widgetRef.current?.refresh()}> 10 Refresh Campaigns 11 </button> 12 <LegionCampaignsCarousel 13 ref={widgetRef} 14 baseUrl="https://your-legion-domain.com" 15 /> 16 </> 17 ); 18}
MethodDescription
refresh()Reloads the widget iframe

Web Component (from NPM)

import '@legionhandtech/lht-react-widgets/campaigns-carousel-web-component';
1<legion-campaigns-carousel 2 api-url="https://your-legion-domain.com" 3 max-campaigns="5" 4 theme="light"> 5</legion-campaigns-carousel>

TypeScript

1import type { 2 CampaignsCarouselWidgetProps, 3 CampaignsCarouselThemingProps, 4 LegionCampaignsCarouselHandle, 5} from '@legionhandtech/lht-react-widgets';

Callbacks

onLoad

1<LegionCampaignsCarousel 2 baseUrl="https://your-legion-domain.com" 3 onLoad={(detail) => { 4 console.log(detail.widget); // "campaigns-carousel" 5 console.log(detail.maxCampaigns); // 5 6 console.log(detail.theme); // "light" | "dark" 7 }} 8/>

onError

1<LegionCampaignsCarousel 2 baseUrl="https://your-legion-domain.com" 3 onError={(message) => console.error(message)} 4/>
Documentation | Legion Hand Technologies