Skip to main content

Render tile

The renderTile render function is called for each tile rendered in the slider. Use the props.item property to access the data off the current item in the TileSlider#items array.

For the best performance, it's advised to keep the tile component simple.

The renderTile prop is required.

Example

import type { RenderTile } from './TileSlider';

const renderTile: RenderTile<Tile> = ({ item, isVisible }) => (
<div className={'exampleTile'}>
<img src={item.image} alt={item.title} />
</div>
);

Props

The renderTile function receives the following props:

NameTypeDescription
itemTThe item rendered for this tile
itemIndexnumberThe index used to address the item in the items array
indexnumberThe index relative to the current rendered index
isVisiblebooleantrue when the tile is visible (inside viewport)
slide(direction: 'left' | 'right') => voidCall this function to slide left or right