Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Node.js, PHP and APIs

Laravel pagination shows giant arrows or plain unstyled links

ErrorPagination arrows fill the whole page width

Short answer

Laravel's default pagination views are written for Tailwind CSS. If your page loads Bootstrap or no Tailwind at all, the links render unstyled with huge arrow icons. Switch the paginator to the Bootstrap views in AppServiceProvider, make Tailwind scan the pagination views, or point links() at a view of your own.

  • Applies to Laravel 12, PHP 8.3, Tailwind CSS 4, Bootstrap 5
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Open the page source and look at the markup that links() produced. Tailwind class names (flex, rounded-md, text-gray-700) mean the Tailwind view is in use. Then check which CSS framework your layout loads.

    php artisan view:clear
    grep -rn "links()" resources/views | head
    grep -n "tailwindcss\|bootstrap" resources/css/app.css resources/views/layouts/*.blade.php
  2. 2Match what you see, then jump to its fix

    1. 1The HTML contains Tailwind classes, while your layout loads Bootstrap CSSThe app uses Bootstrap but the paginator still renders Tailwind markupFix
    2. 2The HTML has Tailwind classes but the page looks unstyledTailwind 4 never scans the pagination views, so its classes are not generatedFix
    3. 3Your CSS is hand written and neither Tailwind nor Bootstrap is loadedThe project uses neither frameworkFix

What does the error look like?

  • Pagination arrows fill the whole page width
  • {{ $users->links() }} prints plain links with no styling

Cause 1 of 3

The app uses Bootstrap but the paginator still renders Tailwind markup

1Check

By default the views rendered for the pagination links are compatible with Tailwind. Nothing switches them to Bootstrap unless you ask.

grep -rn "useBootstrap" app/Providers/

2Fix

Call useBootstrapFive (or useBootstrapFour for Bootstrap 4) in the boot method of AppServiceProvider.

use Illuminate\Pagination\Paginator;

public function boot(): void
{
    Paginator::useBootstrapFive();
}

3Verify

Clear compiled views and reload the page; the links now use Bootstrap's pagination classes.

php artisan view:clear

Confirmed by laravel.com

Did this fix it?

Cause 2 of 3

Tailwind 4 never scans the pagination views, so its classes are not generated

1Check

Tailwind treats source files as plain text and skips files listed in .gitignore, which usually includes vendor. Class names that only appear in the pagination views are then never generated, so the stylesheet needs an explicit @source line for them.

grep -n "@source" resources/css/app.css

2Fix

Add the @source line for Laravel's pagination views to your main CSS file, then rebuild the assets.

@import 'tailwindcss';

@source '../../vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php';

3Verify

Rebuild the front end and reload the page.

npm run build

Confirmed by tailwindcss.com

Did this fix it?

Cause 3 of 3

The project uses neither framework

1Check

The built-in views only look right with the framework they target. Without it you need markup that matches your own CSS.

ls resources/views/vendor/pagination 2>/dev/null

2Fix

Publish the pagination views, edit the one you want as the default, and set it with defaultView in AppServiceProvider (or pass the view name to links()).

php artisan vendor:publish --tag=laravel-pagination

// AppServiceProvider::boot()
Paginator::defaultView('pagination.custom');
Paginator::defaultSimpleView('pagination.custom-simple');

3Verify

Reload the page and confirm the links use your markup.

php artisan view:clear

Confirmed by laravel.com

Did this fix it?

How do I stop it coming back?

  • Decide on one CSS framework per project and set the paginator view in AppServiceProvider on day one.
  • Keep the @source line for the pagination views in app.css when you upgrade Tailwind or rewrite the stylesheet.
  • Review published pagination views in resources/views/vendor/pagination when you change CSS frameworks.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Back end

composer require maatwebsite/excel fails to install

Composer says the package needs an older PHP than the one installed

Composer refuses maatwebsite/excel when the PHP version or a PHP extension does not match what the package and PhpSpreadsheet need.

3 causes, each with a fix

Back end

composer require laravel/horizon fails: ext-pcntl is missing

laravel/horizon v1.1.0 requires ext-pcntl * -> the requested PHP extension pcntl is missing from your system

Horizon needs the pcntl extension, and Composer refuses to install it where PHP lacks that extension.

3 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.