Maximum items in a repeater

Hi, does anyone know of a way you can limit the amount of “items” in a repeater? I can see you can set how many items per row but I want to set a maximum of 4 items but as I have connected it to a collection it keeps adding more items when I add some new data in the collection?

Hi :raised_hand_with_fingers_splayed:

If you’re using a dataset, you can set the the page size on the dataset settings, however, if you’re using data binding, you can set a limit on the query to get you exactly 4 items.

wixData.query('Collection').limit(4).find();

Additionally, if you already have the array, you can use the JavaScript slice method to return a specific length or items.

const vendors = ['BMW', 'Shkoda', 'Seat', 'Volvo']; 

To get the first 3 items, use the following:

const firstItemIndex = 0;
const lastItemIndex = 2;

const modifiedArray = vendors.slice(0, 2);
/* Expected result:
['BMW', 'Shkoda', 'Seat']
*/

Hope this helps~!
Ahmad