Performance: List group component
MEDIUM IMPACT
This affects page load speed and rendering performance by how many DOM nodes are created and how complex the styles are for list items.
<ul class="list-group"> <li class="list-group-item list-group-item-action" tabindex="0">Item 1</li> <li class="list-group-item list-group-item-action" tabindex="0">Item 2</li> <!-- repeated many times --> </ul>
<ul class="list-group"> <li class="list-group-item"> <button class="btn btn-link">Item 1</button> </li> <li class="list-group-item"> <button class="btn btn-link">Item 2</button> </li> <!-- repeated many times --> </ul>
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| List items with nested buttons | High (extra button nodes per item) | Multiple reflows per item interaction | High paint cost due to complex styles | [X] Bad |
| List items with list-group-item-action only | Low (one node per item) | Single reflow on list update | Low paint cost with simple styles | [OK] Good |