Skip to main content

useResponsiveSize

Not a component, but a hook :-) for generating a value for the tilesToShow prop based on the current screen size.

Example

See a working example here!

const Example = () => {
const [tilesToShow] = useResponsiveSize([{ xs: 1, sm: 2, md: 3, lg: 4, xl: 5 }]);

return (
<TileSlider
tilesToShow={3}
renderTile={renderTile}
items={items}
renderRightControl={renderRightControl}
renderLeftControl={renderLeftControl}
/>
);
}

Arguments

NameTypeDefaultsDescription
sizesSizeConfig[]A list of size configs with all breakpoints

Breakpoints

NameMax size
xs479px
sm767px
md1023px
lg1199px
xl