cardgrid.rst 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. .. _card-grid:
  2. Card Grid Block
  3. ===============
  4. Creates a card grid layout with content and button options. Card Grid puts cards in a row by default,
  5. however you can use bootstrap classes to achieve specific layouts. Take a look at our example.
  6. See bootstrap `docs <https://getbootstrap.com/docs/5.2/components/card/#grid-cards>`_ for more information.
  7. Field Reference
  8. ---------------
  9. Fields and purposes:
  10. * **Full Width** - If selected, sets whether the card grid spans the entire width of the screen
  11. * **Content** - The individual cards in the grid. See :ref:`card-block` for more on cards.
  12. Example
  13. -------
  14. In your page editor (we used the "career" page we setup in the getting start tutorial):
  15. * Choose **Card Grid**
  16. * Select the **Card**
  17. * Enter some info about in the card
  18. * Make at least 4 cards total.
  19. .. figure:: img/card_grid_start.jpeg
  20. :alt: 4 cards in a row with different heights.
  21. 4 cards in a row with different heights.
  22. We can see here that the cards, show up in a row, and the height fits the content.
  23. If we look at the `docs <https://getbootstrap.com/docs/5.2/components/card/#grid-cards>`_,
  24. we'll see you can add "h-100" to each card and they will be the same height. Let's try it.
  25. In the page editor, go to each card and open the advanced settings. Add "h-100" to the Custom CSS Class.
  26. .. figure:: img/card_grid_h100.jpeg
  27. :alt: Card block with h-100 added to Custom CSS Class
  28. Card block with h-100 added to Custom CSS Class
  29. Save and preview
  30. .. figure:: img/card_grid_h100_preview.jpeg
  31. :alt: Card grid with bootstrap class h-100 added to every card
  32. Card grid with bootstrap class h-100 added to every card.
  33. Cool. Let's make this a 2 by 2 grid. Looking at the docs we see, the card grid uses specific classes
  34. to determine how many cards should be in each row, based on a screen size.
  35. For our example, we'll add `row-cols-1 row-cols-md-2`. So the smallest screen size will have 1 card per row
  36. and medium (tablet size) and up will have 2 per row. Let's take a look.
  37. In the page editor, open the advanced settings on the card grid.
  38. Add `row-cols-1 row-cols-md-2` to the Custom CSS Class field.
  39. Save and preview.
  40. .. figure:: img/card_grid_2by2edit.jpeg
  41. :alt: The page editor screen with Custom CSS Class on the Card Grid Block
  42. The page editor screen with Custom CSS Class on the Card Grid Block
  43. .. figure:: img/card_grid_2by2.jpeg
  44. :alt: Preview of Custom CSS Class on the Card Grid Block
  45. Preview of Custom CSS Class on the Card Grid Block
  46. The last thing we will look at is gutters. The bootstrap card grid has built in classes that make
  47. spaces uniform between the card.
  48. These are known as `gutters <https://getbootstrap.com/docs/5.2/layout/gutters/#how-they-work>`_.
  49. Let's add class `g-4` on our card grid and see what that looks like. Our custom class now
  50. looks like this `row-cols-1 row-cols-md-2 g-4`. Save and Preview.
  51. .. figure:: img/card_grid_2by2gutters.jpeg
  52. :alt: Preview of Custom CSS Class on the Card Grid Block with gutters
  53. Preview of Custom CSS Class on the Card Grid Block with gutters