Document library layout
The Document Library Pro plugin comes with a choice of two layout options, which allow you to control the appearance of your lists of documents. You can choose a layout for all your document libraries globally on the settings page, and you can override this in the shortcode for each library.
The table layout is the most advanced way to list your documents because it is incredibly flexible. You have full control over which columns of information to include in the table, and can display advanced data such as custom fields and taxonomies.
You also have fine-grained control over other elements such as how the table behaves on different screen sizes and devices.
The table layout is designed for listing large numbers of documents. It has sortable columns, keyword search box and filter dropdowns to help visitors to find specific documents quickly and easily.
The grid layout presents documents in a more visual way by listing them in a tiled format. Where there is space available, there will be 4 tiles per row. This adjusts as needed to fit smaller spaces, such as mobiles.
The document grid is intended to be simpler than the table, as you can fit a limited amount of information within each file. It supports a fixed number of fields about each document which you can enable or disable as needed.
If you have enabled the 'Image' field in the document grid then it will show the document's featured image if there is one. If there is no image then the file type icon will show instead.
Which layout should I use?
The following advice will help you choose which layout to use for your document libraries:
- Appearance - Choose whichever layout you like the look of best.
- Number of documents - The grid layout is perfect for displaying small numbers of documents. You can enable the Folders option to structure the library into categories, so that visitors will only see documents from one category at a time. If you have a large number of documents in each category then we recommend using the table layout because of its search and filter options. The table also comes with a lazy load option which helps with performance for larger document libraries.
- Information to display - If you want to display standard information such as the document image, title, file size, file type, categories, excerpt and download/preview buttons then either layout is fine. However, you should use the table layout if you want to display additional fields (e.g. custom fields or taxonomies), or more advanced content such as embedded audio files or videos.
Can users switch between the table and grid views?
While Document Library Pro doesn't have a 'Switch Layout' button which people can use to toggle between the two layouts, you can easily achieve this. Simply create two tabs or toggles using your chosen page builder plugin, and add a different document library shortcode to each one. The following instructions are based on the Elementor page builder, but you can use any method for adding tabs/toggles/accordions:
- Create a page and edit it using Elementor.
- Add a 'Tabs' element to the page. (This will have two tabs by default, which is what you want.)
- Rename Tab 1 to "Table" and add the following shortcode to the tab content: [doc_library layout="table"]
- Rename Tab 3 to "Grid" and add the following shortcode to the tab content: [doc_library layout="grid"]
- Save and view the page.