Pagiflow Solid
Documentation
Official SolidJS integration docs for Pagiflow. Learn component props, primitives (createPagiflow), custom render props, imperative methods, and responsive integration.
Solid Integration
Install and use Pagiflow in SolidJS with pagiflow/solid.
npm i pagiflowimport { Pagiflow } from 'pagiflow/solid';
import 'pagiflow/css';
export default function App() {
return (
<Pagiflow id="slider-a" nav loop itemsPerSlide={1}>
<div>Slide 1</div>
<div>Slide 2</div>
<div>Slide 3</div>
</Pagiflow>
);
}The createPagiflow primitive returns a reactive controller for a headless integration.
import { createPagiflow } from 'pagiflow/solid';
function CustomSlider() {
const slider = createPagiflow({ loop: true, itemsPerSlide: 2 });
return (
<div>
<div class="controls">
<button onClick={slider.prev}>Prev</button>
<span>Active: {slider.currentIndex() + 1}</span>
<button onClick={slider.next}>Next</button>
</div>
<div ref={slider.ref} class="pagiflow">
<div class="pagiflow-slide">1</div>
<div class="pagiflow-slide">2</div>
<div class="pagiflow-slide">3</div>
</div>
</div>
);
}Custom Rendering
Use renderNav and renderPagination props for custom UI logic.
<Pagiflow
renderNav={(props) => (
<div class="my-nav">
<button onClick={props.prev}>Left</button>
<button onClick={props.next}>Right</button>
</div>
)}
renderPagination={(props) => (
<div class="dots">
<For each={new Array(props.total)}>
{(_, i) => (
<button
class={props.currentIndex === i() ? 'active' : ''}
onClick={() => props.goTo(i())}
/>
)}
</For>
</div>
)}
>
<div>Slide 1</div>
<div>Slide 2</div>
</Pagiflow>Options usage
Solid props are reactive. Updating a prop will automatically call setOptions.
import { createSignal } from 'solid-js';
const [items, setItems] = createSignal(1);
<Pagiflow itemsPerSlide={items()} gap={12} loop>
{/* slides */}
</Pagiflow>
<button onClick={() => setItems(2)}>Show 2 Items</button>Thumbnail Navigation
Show thumbnail strip that syncs with the main slider.
<Pagiflow
loop
thumbnails={{
enabled: true,
position: 'bottom',
thumbWidth: 100,
gap: 8
}}
>
<img src="/1.jpg" />
<img src="/2.jpg" />
</Pagiflow>
Slider Sync
Connect two slider instances together.
<Pagiflow id="main-slider" loop>...</Pagiflow>
<Pagiflow sync="#main-slider" itemsPerSlide={4} loop>...</Pagiflow>
Responsive Breakpoints
Customize slider behavior across screen sizes.
<Pagiflow
nav
responsive={{
0: { itemsPerSlide: 1, gap: 0 },
768: { itemsPerSlide: 3, gap: 16 }
}}
>
<div>1</div>
<div>2</div>
<div>3</div>
</Pagiflow>
Methods
Use controller methods directly from createPagiflow, and access raw instance methods via instance().
createPagiflow controller ref callback. Attach with ref={slider.ref} to initialize the slider on that element.createPagiflow that returns the current active slide index.PagiflowInstance (or null before mount) for full low-level access.<Pagiflow> component, you can retrieve the raw instance directly from the DOM element (e.g., document.getElementById('id').pagiflowInstance).{ silent?: boolean; instant?: boolean }.'dom' returns slide elements.Solid vs React Usage
Migrating from React carousel code? The Solid API is nearly identical, with Solid reactivity patterns.
- Install once:
npm i pagiflow, then import frompagiflow/solid. - Use
<Pagiflow />for drop-in UI, orcreatePagiflow()for headless control. - Replace React state hooks with Solid signals for options and UI.
- Use
renderNavandrenderPaginationfor custom controls without extra wrappers. - Use
onSlideChangeto sync analytics, captions, or external UI state.
Component Props (Solid-Specific)
Props supported by <Pagiflow /> in addition to all core options.
| Prop | Type | Default | Description |
|---|---|---|---|
| children | JSX.Element | - | Slide content rendered inside the track. |
| class | string | undefined | Extra CSS class on the root track element. |
| style | string|CSSProperties | undefined | Inline style for the root track element. |
| id | string | undefined | ID attribute for the root track element. |
| onSlideChange | (index: number) => void | undefined | Called with the active real index (0-based) on slide change. |
| renderNav | function | undefined | Custom navigation renderer. Receives { next, prev, currentIndex, instance }. |
| renderPagination | function | undefined | Custom pagination renderer. Receives { goTo, currentIndex, total, instance }. |
Solid Best Practices
Recommended patterns for performance, accessibility, and maintainable slider code in SolidJS apps.
- Keep slides as direct children of
<Pagiflow />for predictable indexing. - Prefer numeric values for
itemsPerSlide,gap, andspeedto avoid layout ambiguity. - Use
responsiveto control mobile-first behavior instead of custom resize logic. - Enable
keyboardfor better accessibility on content-heavy pages. - Use
lazyLoadwith image slides to reduce LCP impact and bandwidth. - Use
createPagiflowwhen you need full custom markup or advanced integration with external controls.
Events
Listen for changes with the onSlideChange prop.
<Pagiflow onSlideChange={(index) => console.log('Current:', index)}>
<div>Slide 1</div>
<div>Slide 2</div>
</Pagiflow>All Options Reference
Complete list of all configuration options.
| Option | Type | Default | Description |
|---|---|---|---|
| direction | string | 'horizontal' | Slide axis: 'horizontal' or 'vertical'. |
| itemsPerSlide | number | 1 | Visible slides at once. |
| slidesToScroll | number | 1 | Steps per navigation click. |
| gap | number | 8 | Pixels between slides. |
| height | string|number | auto | Viewport height (Required when using vertical, fade, or thumbnails mode.). |
| startIndex | number | 0 | Initial slide index. |
| loop | boolean | false | Infinite loop with DOM clones. |
| speed | number | 400 | Transition duration (ms). |
| animate | boolean | true | Enable CSS transitions. |
| fade | boolean | false | Crossfade instead of slide. |
| nav | boolean | false | Show built-in prev/next buttons. |
| navDisabledEnd | boolean | false | Disable (not hide) buttons at ends. |
| navigation | object | null | External buttons { prev, next }. |
| prevIcon | string | '‹' | Prev button HTML. |
| nextIcon | string | '›' | Next button HTML. |
| prevPosition | string|obj | null | Absolute position for prev button. |
| nextPosition | string|obj | null | Absolute position for next button. |
| paginate | boolean | false | Show pagination dots. |
| paginationPosition | string|obj | null | Custom pagination position. |
| autoplay | boolean | false | Auto-advance slides. |
| autoplayDelay | number | 3000 | Delay between auto advances (ms). |
| pauseOnHover | boolean | true | Pause autoplay on hover. |
| autoScroll | boolean | false | Continuous marquee scrolling. |
| autoScrollSpeed | number | 0.5 | Pixels per animation frame. |
| autoScrollDirection | string | 'left' | 'left' or 'right'. |
| swipeThreshold | number | 60 | Min swipe distance to trigger change. |
| grid | boolean | false | Enable grid mode per slide. |
| gridColumns | number | 2 | Grid column count. |
| gridFill | boolean | false | Fill last page with recycled items. |
| thumbnails.enabled | boolean | false | Show thumbnail strip. |
| thumbnails.position | string | 'bottom' | top / bottom / left / right. |
| thumbnails.thumbWidth | number | 80 | Thumbnail width in px. |
| thumbnails.gap | number | 5 | Gap between thumbnails. |
| thumbnails.sidebarHeight | string | null | Sidebar height for left/right mode. |
| centerMode | boolean | false | Center active slide with peeking neighbors. |
| centerPadding | number|string | 0 | Side padding for center mode. |
| rtl | boolean | false | Right-to-left mode. |
| keyboard | boolean | false | Arrow key navigation. |
| lazyLoad | boolean | false | IntersectionObserver image lazy load. |
| sync | string|inst | null | Selector or instance to sync with. |
| responsive | object | {} | Breakpoint → options map. |
| html | str|arr | null | Inject initial slide HTML content during initialization. |
See All Docs for the full list of 30+ options.
Frequently Asked Questions
Common questions about pagiflow/solid.
pagiflow/solid is designed as a zero-dependency Solid slider with component and primitive APIs, responsive options, autoplay, sync, thumbnails, and runtime option updates.createPagiflow for headless control, attach ref={slider.ref}, and render your own buttons, indicators, or progress UI using controller methods like next, prev, and goTo.pagiflow/solid, keep slider options, then adapt UI state to Solid signals and render props.responsive option with breakpoint keys and per-breakpoint settings such as itemsPerSlide, gap, and navigation behavior.npm i pagiflow, then import from pagiflow/solid.createPagiflow, use slider.instance(). In the component, the instance is passed to render props.