ContentCarousel
A responsive horizontal strip of arbitrary content with swipe, arrows and position indicators.
Live TypeScript example
Try the component here, then use the source below in your application.
- JavaScript
- 3.3 KiB
- Component CSS
- 1.2 KiB
- Shared theme CSS
- 3.8 KiBonce per application
How sizes are measured
The JavaScript figure includes this component’s required helpers. CSS includes its styling dependencies. Each entry is bundled separately for ES2022, minified, then compressed with gzip level 9. Your bundler may share helpers across components. Images, fonts, examples and application code are excluded.
Before compression: JavaScript 8.5 KiB; component CSS 3.4 KiB. These figures describe browser assets, not the complete package download.
View all component measurements →Tab to the track; Left/Right and Home/End scroll. Previous and Next work without swiping. There is no automatic rotation.
import '@blukavantui/web/theme.css'
import {createMediaCard} from '@blukavantui/web/media-card';
import {createContentCarousel} from '@blukavantui/web/content-carousel';
import '@blukavantui/web/media-card.css';
import '@blukavantui/web/content-carousel.css';
export function mount(host:HTMLElement) {
const owned:{destroy():void}[]=[];
const keep=<T extends {destroy():void}>(c:T)=>{owned.push(c);return c;};
const content=document.createElement("div");host.append(content);
for(const [i,photo] of ["architecture","coast","studio","mountains"].entries()){const h=document.createElement("div");content.append(h);keep(createMediaCard(h,{Title:["Spaces with purpose","A wider perspective","A place to create","Beyond the familiar"][i],ImageUrl:"https://blukavantui.blutekmedia.com/bluui/rich/"+photo+".jpg",ImageDescription:"Sample creative project",Description:"Thoughtful work, shaped around people.",Variant:i%2?"Overlay":"Below"}));}
const status=document.createElement("p");status.setAttribute("role","status");
keep(createContentCarousel(host,{
"ItemsVisible": 3,
"Gap": 24,
"ShowArrows": true,
"ShowIndicators": true,
"PeekNext": true,
"ItemLabel": "Item"
,Content:content},{IndexChanged: (index) => {status.textContent="IndexChanged: "+String(index);},Error: (message) => {status.textContent="Error: "+String(message);}}));host.append(status);
return {destroy(){owned.reverse().forEach(c=>c.destroy());status.remove();}};
}
const instance = mount(document.getElementById('example')!)
// When this page or framework component is removed:
// instance.destroy()
Install the library and add the host element
npm install https://blukavantui.blutekmedia.com/downloads/blukavantui-web-0.6.0.tgz<div id="example"></div>This example uses the downloadable @blukavantui/web package. Your application handles persistence and authentication through its typed callbacks. The starter ZIP includes this same example.
createContentCarousel
Pass options as the second argument and callbacks in the third argument. Keep the returned instance to update options or dispose it when its view is removed.
import { createContentCarousel } from '@blukavantui/web/content-carousel';
import '@blukavantui/web/content-carousel.css';Load @blukavantui/web/theme.css once in your app shell.createContentCarousel(host: HTMLElement, options: T.ContentCarouselOptions, events?: T.ContentCarouselEvents)Reference for @blukavantui/web 0.6.0. Required and optional follow the shipped TypeScript declarations; optional does not imply a particular default. Pass typed arrays and objects directly where shown.
Options
10| Name | Type / requirement | Usage |
|---|---|---|
ItemsVisible | numberOptional | Desktop items per viewport, from 1 to 6; adapts to smaller containers. Default: 3. |
Gap | numberOptional | Space between items in CSS pixels, from 0 to 64. Default: 24. |
ShowArrows | booleanOptional | Display previous and next buttons. Default: True. |
ShowIndicators | booleanOptional | Display a position indicator and progress track. Default: True. |
PeekNext | booleanOptional | Leave part of the next item visible. Default: True. |
ActiveIndex | numberOptional | Zero-based requested first item; echo OnIndexChanged.Index. Default: 0. |
ItemLabel | stringOptional | Accessible label prefix for slide positions. Default: "Item". |
AccessibleLabel | stringOptional | Optional accessible name; empty uses a sensible component label. Default: "". |
ExtendedClass | stringOptional | Additional classes on the component root. Default: "". |
Content | SlotOptional | Consumer-owned content, preserved during updates. |
Callbacks
2| Name | Type / requirement | Usage |
|---|---|---|
IndexChanged | (index: number) => void | Promise<void>Optional | |
Error | (message: string) => void | Promise<void>Optional |
Instance methods & properties
3| Name | Signature / type | Usage |
|---|---|---|
element | HTMLElement | Root owned by this instance. Dispose before removing its host. |
update | (patch: Partial<T.ContentCarouselOptions>) => void | Apply a partial options update to this instance. |
destroy | () => void | Dispose the instance and its listeners when the view is removed. |
Related data types
Expand a type for its fields and allowed values.
Slot
type Slot = Node | string;Use these inputs, events, actions and structures in Service Studio. Names and data bindings are specific to the native Blocks.
Part of the full commercial BluKavantUI for OutSystems edition. View OutSystems editions →
Open OutSystems showcase ↗- Web runtime
- Partially supported
- TypeScript
- Partially supported
- OutSystems
- Partially supported
Statuses describe the component’s rendered code and interactions. Supply accessible content and follow the component guidance when integrating it.
Accessibility guidance →Purpose and use
A responsive horizontal strip of arbitrary content with swipe, arrows and position indicators.
Keyboard design guidance
Tab to the track; Left/Right and Home/End scroll. Previous and Next work without swiping. There is no automatic rotation.
See the support status above for review coverage and any limitations.
In your application
Provide useful labels, preserve visible focus, and test the component with your actual content. Use text alongside status colors and check contrast in each state.
Events0No events yet.
Interact with an example to see its events.