The Table component is a versatile element for displaying tabular data in the Unfold theme. It features responsive design that adapts to different screen sizes while maintaining consistent styling with the Unfold design system. The component supports table headers and rows with a mobile-friendly layout that includes data labels for smaller screens. Users can enable optional features such as striped rows and scrollable content with height limitations. The table component integrates seamlessly with the Card component and handles empty states gracefully when no data is available. It also includes full dark mode support with appropriate color adjustments to maintain readability and visual harmony in both light and dark environments.
The table component requires a dictionary with the following structure:
def dashboard_callback(request):
return {
"table_data": {
"headers": ["col 1", "col 2"],
"rows": [
["a", "b"],
["c", "d"],
]
}
}
{% load unfold %}
{% component "unfold/components/card.html" with title="Card title" %}
{% component "unfold/components/table.html" with table=table_data card_included=1 striped=1 %}{% endcomponent %}
{% endcomponent %}
Parameter | Description |
---|---|
table | Table data: headers, rows |
title | Custom table title |
striped | Stripes for odd rows |
card_included | Special styling when in "card" component |
height | Max height, displays scroolbar |
© 2023 - 2025 Created by unfoldadmin.com. All rights reserved.