Upgrading from 1.x

Everything a 1.x app has to know to move to 2.0: what to add, which names changed meaning, and which of the forty-one 1.x components render differently. Nothing was removed: every prop, slot, token, utility and config key of 1.x is still there, and the package's tests hold that.

composer require shipbytes/blade-ui:^2.0

In short

  1. Add the script. Put <x-ds::scripts /> in your layout's head, above Alpine's script tag (or Livewire's). 1.x shipped no JavaScript; 2.0's date picker, a checkbox's indeterminate and most of the new components need it. See add the script.
  2. Alpine 3.11 or later (January 2023). The script's parts are fetched through Alpine.interceptInit; Livewire 3 and 4 bring a later Alpine. On an older one, write <x-ds::scripts all />.
  3. If you published the views (vendor:publish --tag=blade-ui-views), delete resources/views/vendor/ds or publish again. A published 1.x view wins over the package's, so it keeps the 1.x markup and never asks for the script's parts.
  4. Check the names below if you passed attributes to a 1.x component that 2.0 now reads as props.
  5. Rebuild your CSS. The @source line already points at the views, so new classes are picked up; nothing to add.

Requirements are unchanged: PHP 8.2+, Laravel 11, 12 or 13, Tailwind CSS v4.

What did not change

Read mechanically from the 1.x views (the last 1.x tag) against these:

  • No prop, slot or event of a 1.x component was removed or renamed. tests/OneXApiTest.php holds every 1.x prop and slot from a fixture.
  • No token or utility was removed or renamed. 2.0 adds tokens (the chart series, the heat ramp, ink-dark / ink-light, the motion tokens) and utilities (loader-*, shimmer, marquee, progress-indeterminate, heat-*). Two existing tokens changed value, in the light theme only: fg-muted and danger, a shade darker (see below); the rest are byte for byte the same.
  • Config: one key added, script (prefix, all). A published 1.x config/blade-ui.php still works: Laravel merges the new key in.
  • Still no Livewire. The package depends on illuminate/support, illuminate/view and blade-heroicons, as in 1.x.

Names that stopped being attributes

In 1.x an attribute a component did not declare fell through to its root element. 2.0 declares these props on 1.x components, so the same attribute is now read as the prop and no longer printed. If you passed one of them for your own markup (a data- attribute is never affected), rename yours.

ComponentNames now read as props
avatarinitials, status
bottom-navlabel (and an aria-label you pass names the bar; 1.x printed a second, ignored one)
buttonicon, badge
date-pickerhideLabel, months, presets, minDays, maxDays, confirm, today
drawerlabel (an aria-label attribute is read as it)
dropdown-itemdescription
file-uploadfiles, listLabel, summaryLabel
inputreveal, revealLabel, clearable, expanding, mode, shortcut
nav-itemcollapsed
paneltitleId, collapsible, open, name
selecthideLabel
sheetsnap, initialSnap, draggable, dismissible, handle, modal
skeletonshimmer
stat-tilerising, roll
switcherror
tablesort, direction, sortUrl, sortAction, tree, label, selectable, selectName, selectModel, selectAllLabel, stickyHead, stickyFirst, loading, loadingRows, loadingLabel
table-cellrowHeader
table-rowlevel, expandable, open, parent, value, selected, selectLabel
toastduration, actionLabel, shortcut
toast-regionflash, flashTone, flashTitle, flashDuration
tooltipdescribe

The test that holds the 1.x API also fails if a prop is added to a 1.x component without a row here.

Everywhere

  • Muted text and the danger colour are a shade darker in the light theme, so they reach AA on the app's sunken ground as well as on a card: fg-muted #71717b → #6e6e78 (4.39:1 → 4.60:1 on surface-sunken), danger #e7000b → #df000a (4.33:1 → 4.62:1). The same class names, a visual change only; dark is unchanged. If your own CSS paired fg-muted with a hard-coded zinc-500 to match it, use the token instead.
  • Motion respects reduced motion. Every transition and animation is motion-safe: and timed by the motion tokens (duration-popover-enter, ease-enter and the rest), where 1.x wrote transition ease-out duration-150 and the like. At rest the timings are the same numbers; with prefers-reduced-motion: reduce the change happens at once, and the button's loading spinner stops turning. Hover and colour transitions moved from Tailwind's default curve to ease-enter at the same 150 ms.
  • Focus rings that 1.x hid now show. Tailwind v4's focus:outline-hidden set the outline style to none on every focus, cancelling the focus-visible:outline-2 beside it, so ds::button (and the empty state's, toast's and tooltip's buttons, the modal's and drawer's ✕, select and combobox options, dropdown items) never drew a ring. They draw the system ring now. Panel's header link, stat-tile's link, nav-item, bottom-nav-item, sheet-item and the file field gained one where they had none.
  • Text fields show their focus ring at phone width (it was sm: and up).
  • Overlays stack. With two overlays open (a drawer, then a modal from it), Escape closes only the top one, the one below dims, and the page stays locked until the last one closes. A single overlay behaves as before. Nesting was a documented "don't" in 1.x; it works now.
  • No inline event handlers. 1.x printed none but the alert's ✕; 2.0 prints none at all, so a Content Security Policy without 'unsafe-inline' refuses nothing (the supported policy is in getting-started).
  • The components' words go through Laravel's translator (ds:: namespace): the form controls and everything the script says. In English nothing changes; in another locale they follow app()->getLocale() once you add a translation. See Translating.
  • With Alpine and no include, the console says so once. A component that needs the script, on a page without it, is left as the server rendered it, and the page logs one error naming every behaviour it did not find and the include that fixes it, instead of one per component and an echo from each binding inside.
  • The dropdown, select, combobox and tooltip stay on screen with the script: x-ds-anchor flips them away from the window's edge and out of an overflow: hidden box. Without the script they open at their placement, exactly as in 1.x.

Component by component

Each change is either a fix or something new that a 1.x page did not have; the default output of every other 1.x component is held byte for byte by the "unchanged" tests.

  • ds::alert's ✕ needs the package's script (any page with <x-ds::scripts />; Alpine is not needed). 1.x removed the alert with an inline onclick, which a strict Content Security Policy refuses; 2.0's button carries data-ds-remove="[role]" instead, read by the one listener the script's core installs. Without the include the ✕ renders and does nothing.

  • ds::date-picker needs the package's script. Put <x-ds::scripts /> in the layout, above Alpine. Its calendar is now the one ds::calendar draws, rendered by the server, so it is right before any script runs (the day marked today is the server's, not the browser's). Without the script it is the browser's own date field, or two for a range, and posts the same names: {name}, or {name}_start and {name}_end, as Y-m-d.

    • Its keys follow the ARIA date grid: Home and End go to the start and end of the week (they went to the ends of the month), and Shift+PageUp / Shift+PageDown move a year.
    • A second pick before a range's start swaps the ends, where 1.x started the range again from there.
    • wire:model and x-model now bind the value (Y-m-d, or [from, to]).
    • Its root is no longer w-full, so it sits in a filter row like a select. In a column (a form) it is as wide as before; inside a flex row, give it a width with class (class="w-64", class="w-full"). New: hideLabel, and aria-label with no label.
  • ds::select passes on what you write on it. wire:model and x-model go on its root and bind the value; aria-*, autofocus and title go on the trigger (an aria-label with no label also names the list); form on the input that posts; required adds a field the browser validates. Any other attribute goes on the root, as in 1.x. While bound, its own state is named dsOpen, dsValue and dsLabel, so your value is yours. New: hideLabel.

    • It fires change when a different option is picked: a bubbling CustomEvent from its hidden input, detail the value. A listener for change around a select (a form that submits on change) now hears it; 1.x fired nothing.
    • Escape is no longer swallowed while the list is closed, so an Escape on a closed select inside a modal or popover closes that.
  • ds::combobox posts the reader's choice without Alpine. A native select of the same options is drawn in the filter field's place until Alpine runs (which disables and hides it), and the hidden input that posts is drawn disabled until Alpine enables it. In 1.x a page without Alpine posted the initial value. wire:model and x-model now bind it. Escape is no longer swallowed while closed.

  • ds::checkbox: the box sits on the label's first line (its cell is one line tall; it was centred against the label and help together), and indeterminate renders x-ds-indeterminate in place of x-init="$el.indeterminate = true", so it needs the package's script as well as Alpine, and a Livewire morph that drops it clears the mixed mark. label and help take slots.

  • ds::nav-item with collapsedWhen is drawn by the server in the state the rail starts in (expanded unless collapsed), where 1.x drew neither and left the item unpadded until Alpine started. Its :class binding is now the object form. Nothing to change unless you matched those attributes.

  • ds::bottom-nav takes label, still "Primary" by default. An aria-label you passed used to print a second attribute, which the browser ignored; it now names the bar.

  • ds::drawer needs a name. Without a title it takes label (an aria-label attribute still works, and is read as it), and with none of title, label or aria-labelledby it throws: 1.x drew a dialog announced only as "dialog". Without a title there is no longer an empty header bar with a Close button in it: the button sits in the top corner, so leave the first row room for it.

  • ds::modal, ds::drawer and ds::sheet join the overlay stack (data-ds-layer; a scrim on the covered one). The modal takes an explicit id.

  • ds::panel's subtitle wraps (text-pretty) where it was cut with an ellipsis, in a feature panel and a collapsible one; a long one is a line taller. New: titleId, collapsible.

  • ds::tooltip puts aria-describedby on the element it describes (the trigger in its slot), where 1.x put it on its own wrapper, which nothing focuses, so the trigger was never described.

  • ds::table-cell merges a class you pass into its own, where it printed a second class attribute (which the browser ignored).

  • ds::file-upload draws the focus ring on its visible box when the transparent input inside it is focused.

What is new on 1.x components

The props in the table above, in short: ds::button's icon and badge; ds::input's reveal, clearable and expanding; ds::table's sorting, tree, selectable, head slot, stickyHead / stickyFirst and loading; ds::toast's undo countdown; ds::toast-region's flash; ds::sheet's snap points and drag; ds::panel's collapsible; ds::stat-tile's roll, rising and trend slot; ds::avatar's initials and status; ds::alert's actions slot. Each is on its component's page. 129 components are new; see the changelog.


From the package repo: edit this page on GitHub.

Was this page helpful?