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
- Add the script. Put
<x-ds::scripts />in your layout'shead, above Alpine's script tag (or Livewire's). 1.x shipped no JavaScript; 2.0's date picker, a checkbox'sindeterminateand most of the new components need it. See add the script. - 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 />. - If you published the views (
vendor:publish --tag=blade-ui-views), deleteresources/views/vendor/dsor 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. - Check the names below if you passed attributes to a 1.x component that 2.0 now reads as props.
- Rebuild your CSS. The
@sourceline 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.phpholds 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-mutedanddanger, a shade darker (see below); the rest are byte for byte the same. - Config: one key added,
script(prefix,all). A published 1.xconfig/blade-ui.phpstill works: Laravel merges the new key in. - Still no Livewire. The package depends on
illuminate/support,illuminate/viewandblade-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.
| Component | Names now read as props |
|---|---|
avatar | initials, status |
bottom-nav | label (and an aria-label you pass names the bar; 1.x printed a second, ignored one) |
button | icon, badge |
date-picker | hideLabel, months, presets, minDays, maxDays, confirm, today |
drawer | label (an aria-label attribute is read as it) |
dropdown-item | description |
file-upload | files, listLabel, summaryLabel |
input | reveal, revealLabel, clearable, expanding, mode, shortcut |
nav-item | collapsed |
panel | titleId, collapsible, open, name |
select | hideLabel |
sheet | snap, initialSnap, draggable, dismissible, handle, modal |
skeleton | shimmer |
stat-tile | rising, roll |
switch | error |
table | sort, direction, sortUrl, sortAction, tree, label, selectable, selectName, selectModel, selectAllLabel, stickyHead, stickyFirst, loading, loadingRows, loadingLabel |
table-cell | rowHeader |
table-row | level, expandable, open, parent, value, selected, selectLabel |
toast | duration, actionLabel, shortcut |
toast-region | flash, flashTone, flashTitle, flashDuration |
tooltip | describe |
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 onsurface-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 pairedfg-mutedwith 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-enterand the rest), where 1.x wrotetransition ease-out duration-150and the like. At rest the timings are the same numbers; withprefers-reduced-motion: reducethe change happens at once, and the button's loading spinner stops turning. Hover and colour transitions moved from Tailwind's default curve toease-enterat the same 150 ms. - Focus rings that 1.x hid now show. Tailwind v4's
focus:outline-hiddenset the outline style to none on every focus, cancelling thefocus-visible:outline-2beside it, sods::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 followapp()->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-anchorflips them away from the window's edge and out of anoverflow: hiddenbox. Without the script they open at theirplacement, 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 inlineonclick, which a strict Content Security Policy refuses; 2.0's button carriesdata-ds-remove="[role]"instead, read by the one listener the script's core installs. Without the include the ✕ renders and does nothing. -
ds::date-pickerneeds the package's script. Put<x-ds::scripts />in the layout, above Alpine. Its calendar is now the oneds::calendardraws, 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}_startand{name}_end, asY-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:modelandx-modelnow 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 withclass(class="w-64",class="w-full"). New:hideLabel, andaria-labelwith nolabel.
-
ds::selectpasses on what you write on it.wire:modelandx-modelgo on its root and bind the value;aria-*,autofocusandtitlego on the trigger (anaria-labelwith nolabelalso names the list);formon the input that posts;requiredadds a field the browser validates. Any other attribute goes on the root, as in 1.x. While bound, its own state is nameddsOpen,dsValueanddsLabel, so yourvalueis yours. New:hideLabel.- It fires
changewhen a different option is picked: a bubbling CustomEvent from its hidden input,detailthe value. A listener forchangearound 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.
- It fires
-
ds::comboboxposts 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:modelandx-modelnow 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), andindeterminaterendersx-ds-indeterminatein place ofx-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.labelandhelptake slots. -
ds::nav-itemwithcollapsedWhenis drawn by the server in the state the rail starts in (expanded unlesscollapsed), where 1.x drew neither and left the item unpadded until Alpine started. Its:classbinding is now the object form. Nothing to change unless you matched those attributes. -
ds::bottom-navtakeslabel, still "Primary" by default. Anaria-labelyou passed used to print a second attribute, which the browser ignored; it now names the bar. -
ds::drawerneeds a name. Without atitleit takeslabel(anaria-labelattribute still works, and is read as it), and with none oftitle,labeloraria-labelledbyit 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::drawerandds::sheetjoin the overlay stack (data-ds-layer; a scrim on the covered one). The modal takes an explicitid. -
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::tooltipputsaria-describedbyon 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-cellmerges aclassyou pass into its own, where it printed a secondclassattribute (which the browser ignored). -
ds::file-uploaddraws 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.