Abdulkader Safi

LaralCN-UI docs fixes: the phone overflow was a sidebar bug

A design review of the LaralCN-UI docs found the main column running off the screen on a 390px phone, plus a handful of smaller problems such as tabs with no ARIA roles and counts that still said 25 components. The overflow came from the sidebar component, not the docs page, so the fix went into the registry and reached every app that uses the sidebar.

5 min read

Share
The LaralCN-UI button docs page on a phone-width screen, with the code block fitting inside the viewport and its Copy button in view.

I ran a design review of the LaralCN-UI docs at v0.5.1 and the first thing it found was a page that scrolled sideways on a phone. The docs column was 660px wide on a 390px screen. I expected a bug in the docs layout, but the cause sat in the sidebar component, which means every app built on it had the same problem. This post covers that fix (PR #3) and the smaller things the review caught on 29 Nov 2026.

The docs column was 660px wide on a 390px phone

The docs site uses its own sidebar component for the page shell. The main column is <x-ui.sidebar.inset>, a <main> element that is a flex child of the sidebar wrapper. Flex children default to min-width: auto, so they refuse to shrink below the width of their content. A long line in a code block is wide content. The code block pushed the inset to 660px and the whole page scrolled sideways.

The fix is one class. This is the inset file as it ships now:

@props([])

@php
    $classes = \TailwindMerge\Laravel\Facades\TailwindMerge::merge(
        'relative flex min-h-svh min-w-0 flex-1 flex-col bg-background',
        $attributes->get('class'),
    );
@endphp

<main {{ $attributes->except('class')->merge(['class' => $classes]) }}>
    {{ $slot }}
</main>

With min-w-0 the inset can shrink to the viewport, and the code block scrolls inside its own box the way it was meant to.

The fix had to go in the registry

My first instinct was to patch the docs view. That would have fixed my site and left the bug in every project that installed sidebar. The docs render the real registry files, so the right place was registry/components/sidebar/files/inset.blade.php, plus the site's copy so php artisan ui:diff stayed clean.

Registry changes reach users without a release, because ui:add reads from the main branch. Anyone who runs php artisan ui:add sidebar gets the fix on any CLI version, and so does the sidebar-01 block, which composes the same inset.

The overflow had also hidden a second bug. Every code block has a Copy button in its top corner, and on mobile nobody could find it. It was never hidden: the overflow had pushed it to x=624, outside a 390px screen. After the fix it sits at x=354. I checked every docs page at 390px in Chrome and document.documentElement.scrollWidth is now 390 on all of them.

The tabs were plain buttons

The Preview/Code switch on component pages and the Command/Manual switch on install instructions looked like tabs but were plain buttons to a screen reader. Each button is now a role="tab" inside a role="tablist" wrapper, and aria-controls points it at its role="tabpanel", with aria-selected tracking which one is open. The ARIA tabs pattern also expects arrow keys, so the site script handles those:

// Left/Right arrows move between tabs, as the ARIA tabs pattern expects.
document.addEventListener('keydown', (event) => {
    if (event.key !== 'ArrowLeft' && event.key !== 'ArrowRight') return;
    const tab = event.target.closest('[data-site-tab]');
    if (!tab) return;

    const tabs = [...tab.closest('[role=tablist]').querySelectorAll('[data-site-tab]')];
    const step = event.key === 'ArrowRight' ? 1 : -1;
    const next = tabs[(tabs.indexOf(tab) + step + tabs.length) % tabs.length];
    next.focus();
    next.click();
});

This is site code, not a registry component. The tabs component in the registry already had its own keyboard handling.

Stale numbers and missing steps

The rest of the review was copy that had drifted while the library grew:

  • The README and the OG image alt text still said 25 components. They now say 35 components and 15 blocks, and the README's command list includes ui:add-block.
  • llms.txt and all-components.md claimed collapsible and sheet used Alpine. Collapsible uses an inline script and sheet uses a native <dialog>, so I removed the claim.
  • Getting started now says up front that you need Laravel with Tailwind CSS v4, and it has a fifth step for php artisan ui:add-block navbar-01.
  • Theming has a dark mode section, in the HTML page and its Markdown copy.

I also switched "Getting Started" and "Copy Page" to sentence case, cut the preview box minimum height from 280px to 180px, and added a booking link to the footer for people who want a Laravel site built with these components. website/public/build was rebuilt and committed, since the VPS does not run Vite.

A rename that broke a test nobody ran

The sentence-case rename had a cost I did not see that day. The website has its own feature tests, and one of them asserted the old title:

$response = $this->get('/getting-started');
$response->assertSee('Getting Started');

assertSee is case-sensitive, so it failed. CI only runs the package suite at the repo root (123 tests passed on this PR), and the website suite lives in website/tests, so the red test sat there unnoticed until PR #5, the right-to-left work, fixed the assertion. The lesson is plain: a suite that CI never runs is a suite that fails quietly.

The review also turned up a real bug I left out of this PR on purpose. The theme stub had no @custom-variant dark line, so colours followed the .dark class while dark: utilities followed the OS. Changing the stub changes what ui:init writes, so it went into its own CLI release.

Where it is

composer require --dev safi/laralcn-ui
php artisan ui:init
php artisan ui:add sidebar
php artisan ui:add-block sidebar-01

The docs are at https://laralcn-ui.abdulkadersafi.com (the sidebar page is /components/sidebar). The code is on GitHub at https://github.com/Abdulkader-Safi/LaralCN-UI, MIT licensed.

Next: LaralCN-UI 0.5.2, where that dark mode bug and a too-forgiving ui:init get fixed in the CLI.

Last updated 1 Dec 2026 · filed under Laravel, blade, tailwindcss, frontend, laralcn-ui, accessibility

Every entry on this project

26 build notes, in order

Including the ones where nothing worked. You are on part 7.

Read the series →

FAQ

Frequently asked questions

I installed the sidebar before this fix. How do I get it?

Run php artisan ui:add sidebar again and accept the overwrite for inset.blade.php, or add min-w-0 to the inset's base classes by hand. No CLI upgrade is needed, because the fix lives in the registry.

Why does a flex child need min-w-0 at all?

Flex items default to min-width: auto, which stops them shrinking below their content's width. A wide <pre> inside the item then forces the whole layout wider than the screen, and min-w-0 lets the item shrink so the <pre> scrolls instead.

Do the docs tabs work with a keyboard now?

Yes. Tab onto the tab list, then Left and Right arrows move between Preview and Code, wrapping at the ends.

Does the sidebar-01 block need a separate update?

No. The block composes the sidebar component's inset, so re-adding sidebar or running php artisan ui:add-block sidebar-01 gives you the fixed file.

Written by

Abdulkader Safi

Software Engineer

Lead engineer at DSRPT, from Lebanon and based in Kuwait. I write about the tools and bugs from real client work, with the numbers I measured.

About me → GitHub LinkedIn

Need this kind of work done on your project?

Start a project →

Keep reading

More from LaralCN-UI: shadcn-style Blade components and blocks you own

All 26 entries →