What's the simplest way to have a component that can show/hide rows

Hey. I have a component with a bunch cell rows. I want the component settings on to be able to choose how many rows displayed 1, 2, 3… up to 25. Rather than create 1 component, with 25 variants each containing from 1 to 25 list cells I figured there must be a simpler way, where there is one component that maybe utilized show/hide using true/false booleons, where selecting 23 rows, simply turns the 24th and 25th ‘off’… but I just cant figure out how to do that. Any help would be appreciated!