Repository navigation
1.10.0
No new components. This one is about the question that follows installing a component library and using it for a week: how do I change how this looks, when the design language and I disagree about one thing on one screen.
className was never the missing half — every component already took one and merged it with its own. What it could never reach was everything behind the root. A TextField's className lands on the column holding the label, the shell and the two lines under it, which means the <input> itself had no name a caller could use; a Table's lands on the sheet the table scrolls inside, leaving the <table>, its header band, its rows and its cells unreachable; and a Select's popup, a Dialog's backdrop and a Tour's mask all render at the end of <body>, outside the element className reaches, so no selector written against the root would ever find them. Thirteen components now take a classNames map — seventy-six named parts between them.
The standing scenarios say what that cost the people who do not use it:
| What you import | 1.9.0 | 1.10.0 |
|---|---|---|
Button |
5.0 kB | 5.0 kB |
Chip |
3.0 kB | 3.0 kB |
LineChart |
11.3 kB | 11.3 kB |
CodeBlock |
4.9 kB | 4.9 kB |
| a whole page shell | 28.4 kB | 28.4 kB |
| 12 components — a typical app | 67.2 kB | 67.3 kB |
| 12 components, with Korean | 69.7 kB | 69.9 kB |
| 25 components — a large one | 111.4 kB | 111.7 kB |
| all exports | 240.3 kB | 240.7 kB |
A slot is one more argument into a cx() that was already being called, so nothing was added to the runtime and the five unchanged rows did not move. neba/styles.css does not move at all — there is no new CSS in this release. The 1.9.0 column is the budget as last recorded, which for two rows is a tenth or two above the table in those release notes — four commits of perf and refactor work landed after they were written.
Added
-
classNameson thirteen components —TextField,NumberField,Select,Combobox,Checkbox,Switch,RadioGroup,Radio,Table,Dialog,ToastProvider,TourandCommandPalette. One class name per part, merged with the component's own rather than replacing it.There is never a
rootkey.classNameis the root, on every component in the library, and aclassNames.rootbeside it would be a second spelling of an idea that already has one — which is the rulesrc/types.tsexists to hold.NebaSlotsandNebaFieldSlotare in that file for the same reasonNebaStylePropsis:label,control,descriptionanderrormean the same four things on aTextField, aSelect, aCheckboxand aRadioGroup, and what a component adds past them lives with the component.The slots worth knowing about are the ones with no other way in.
Select's andCombobox'spopupanditem,Dialog's andCommandPalette'sbackdropandviewport, andTour'smaskare all portalled or siblings of the elementclassNamelands on. A descendant selector written against the root does not reach any of them, and before this there was nothing that did. -
classNameonTourandCommandPalette, on the card and on the sheet — the same elementDialogputs one on, because in all three that is what a caller means when they name the component.ToastProviderstill takes none, and that is the answer rather than an omission: it renders no element of its own — it wraps the application and puts a portalled stack on the page — so there is nothing for a root class name to land on. Itsviewportandtoastare slots instead.
Changed
-
A
Tablecell's padding, alignment and background are still inline styles, and now say so. They have to be —.vp-doc tdand.prose tdoutrank any one-class utility, which is why the styling moved inline in the first place — so a class handed tocell,headCelloremptycan add anything the component does not already set inline and needs an important utility (p-4!) to change what it does. The slot type and the component page both carry that caveat rather than leaving it to be discovered. -
ToastProvider's description no longer builds an empty class name out of a nested ternary. Same output, one condition instead of two.
Fixed
npm run size:updateno longer leaves the working tree failingprettier --check. It serialised withJSON.stringify(…, 2), which puts"imports": ["Button"]on three lines where Prettier wants one; the file stayed unformatted from the moment the script finished until something else rewrote it, and the only reason that was survivable is thatnpm run buildrunsformat:fixfirst, so it was usually undone by accident before anyone looked. The formatter now does the layout, loaded on that path only so the check path — the one CI runs — does not pay for a formatter it never calls.
Documentation
-
The getting-started guide stopped promising the wrong thing. It told a Tailwind user that a
classNamethey pass "sorts correctly against the component's own classes", which reads as a promise that theirs wins. Same-pass generation is only what lets the two be ordered against each other at all; the order is Tailwind's own, so a component'sh-10beats a caller'sh-8and itsrounded-lgbeats a caller'srounded-full, whilebg-red-500wins — decided by the value rather than by who wrote it. The important modifier (h-8!) is the form that always wins, and it is now documented as such. -
A new section in prop conventions covering all three channels:
classNameon the root,classNameson the parts behind it, andstylewriting one of the hundred-odd--n-*custom properties a component reads its colour and depth out of. The last of those is the one override in the library that cannot lose — a caller'sstyleis merged after the component's own, and an inline custom property has no cascade to compete in. -
Twenty-four component pages — twelve components in both locales — gain a
classNamessection, with their rows in the props tables. -
test/package/resolution.test.tsnow holds the override contract, which fails the way everything else in that file fails: silently, and in someone else's project. Four invariants — that no component drops theclassNameorstyleit was handed into a props spread, in JSX and in thepropsobjectuseRendertakes; that a slot union is declared beside the component that offers it; that it never namesroot; and that every slot offered is actually read. A slot that type-checks, reads as supported and does nothing is exactly what this catches. -
Thirty-nine new test cases across thirteen files, taking the suite to 2,466.
Every release is in the changelog on the docs site and in CHANGELOG.md at this tag.