Skip to main content
Inline tabs allow you to organize multiple inline formsets into a tabbed interface, making it easier to manage models with many related objects.

Overview

When you have multiple inlines on a single model, you can organize them into tabs by setting the tab attribute on each inline class. This creates a cleaner interface and improves the user experience.
Inline tabs showing different related models

Basic Setup

To enable inline tabs, add the tab attribute to your inline class:
admin.py
from django.contrib import admin
from unfold.admin import ModelAdmin, TabularInline, StackedInline
from .models import Author, Book, Review, Award

class BookInline(TabularInline):
    model = Book
    extra = 1
    tab = True  # Enable tab for this inline

class ReviewInline(StackedInline):
    model = Review
    extra = 0
    tab = True  # Enable tab for this inline

class AwardInline(TabularInline):
    model = Award
    extra = 0
    tab = True  # Enable tab for this inline

@admin.register(Author)
class AuthorAdmin(ModelAdmin):
    inlines = [BookInline, ReviewInline, AwardInline]
When tab=True is set on an inline, it will be displayed in a separate tab instead of being stacked vertically with other inlines.

Tab with Custom Label

The tab label is automatically derived from the model’s verbose name, but you can customize it:
admin.py
class BookInline(TabularInline):
    model = Book
    extra = 1
    tab = True
    verbose_name = "Published Book"
    verbose_name_plural = "Published Books"

Mixing Tabs and Regular Inlines

You can mix inlines with and without tabs. Inlines without tab=True will display normally above the tabbed interface:
admin.py
class PrimaryContactInline(StackedInline):
    model = PrimaryContact
    extra = 0
    max_num = 1
    # No tab attribute - displays normally

class BookInline(TabularInline):
    model = Book
    extra = 1
    tab = True  # Displays in tabs

class ReviewInline(TabularInline):
    model = Review
    extra = 0
    tab = True  # Displays in tabs

@admin.register(Author)
class AuthorAdmin(ModelAdmin):
    inlines = [
        PrimaryContactInline,  # Displays above tabs
        BookInline,            # Tab 1
        ReviewInline,          # Tab 2
    ]

Tab Error Indication

When an inline formset has validation errors, the tab will be highlighted to indicate which tab contains errors:
admin.py
class BookInline(TabularInline):
    model = Book
    extra = 1
    tab = True
    
    def get_formset(self, request, obj=None, **kwargs):
        formset = super().get_formset(request, obj, **kwargs)
        # Errors in this formset will highlight the tab
        return formset
The system automatically detects errors in inline formsets and highlights the corresponding tab. You don’t need to implement this manually.

Combining with Pagination

Inline tabs work seamlessly with pagination for large datasets:
admin.py
class BookInline(TabularInline):
    model = Book
    extra = 1
    tab = True
    per_page = 10  # Enable pagination with tabs

class ReviewInline(TabularInline):
    model = Review
    extra = 0
    tab = True
    per_page = 20  # Each tab can have different pagination

@admin.register(Author)
class AuthorAdmin(ModelAdmin):
    inlines = [BookInline, ReviewInline]
Learn more about pagination in Paginated Inlines.

Combining with Sortable Inlines

You can make inline tabs sortable for drag-and-drop ordering:
admin.py
class BookInline(TabularInline):
    model = Book
    extra = 1
    tab = True
    ordering_field = 'order'  # Enable sorting
    hide_ordering_field = True

@admin.register(Author)
class AuthorAdmin(ModelAdmin):
    inlines = [BookInline]
Learn more about sortable functionality in Sortable Inlines.

Active Tab Detection

The first tab with validation errors is automatically activated. If there are no errors, the first tab is active by default:
admin.py
from unfold.admin import ModelAdmin

@admin.register(Author)
class AuthorAdmin(ModelAdmin):
    inlines = [BookInline, ReviewInline, AwardInline]
    
    # The system automatically:
    # 1. Shows the first tab by default
    # 2. Switches to the first tab with errors on validation
    # 3. Highlights all tabs containing errors

Best Practices

Set clear verbose_name_plural values on your models so tab labels are meaningful.
Too many tabs can be overwhelming. Consider grouping related models or using a different organization strategy if you have more than 5-6 tabs.
For complex forms, consider making some inlines collapsible while keeping others in tabs:
class OptionalInfoInline(TabularInline):
    model = OptionalInfo
    tab = True
    collapsible = True  # Can be collapsed within its tab

Technical Details

tab
bool
default:"False"
When set to True, the inline will be displayed in a separate tab.
The tab system uses the unfold/helpers/tab_list.html template and integrates with:
  • Error detection via unfold.templatetags.unfold.tabs_primary_active
  • Error counting via unfold.templatetags.unfold.tabs_errors_count
Inline tabs are automatically detected when rendering the change form. No additional configuration is needed beyond setting tab=True.

Fieldset Tabs

Create tabs within fieldsets

Model Tabs

Configure navigation tabs for models

Paginated Inlines

Add pagination to your inline tabs

Sortable Inlines

Enable drag-and-drop ordering

Build docs developers (and LLMs) love