Commit 710bc10
Take the Base UI build of the same shadcn style (#200)
* Take the Base UI build of the same shadcn style
The registry ships every style twice, once per primitive library, and
`components.json` names which one: `radix-maia` becomes `base-maia`, the 17
components are re-added from it, and `radix-ui` leaves for `@base-ui/react`.
The look is the same pack of styles either way -- what changes is what is
underneath the wrappers, and the handful of call sites that were talking to
Radix through them.
None of the 17 were modified locally (`add --diff` had only prettier's
quarrel with the registry to report), so the swap is the registry's to make.
Two of them are edited on purpose afterwards, below.
The call sites, in the order the type checker found them:
- `asChild` is Radix's. Base UI composes with `render`, handing a part the
element it should become, so a trigger wrapping a `Button` becomes
`render={<Button/>}` and a `Badge` that was a `<li>` becomes
`render={<li/>}`.
- `--radix-popover-content-available-height` is now `--available-height`,
published on the positioner and inherited by the panel.
- `<SelectContent position="popper">` is `alignItemWithTrigger={false}`.
Same reasoning as before -- a trigger 26px from the top of the window
cannot have the menu laid over it, and the pre-scroll that follows is what
was mounting a scroll-up arrow over an option already in view.
- `<SelectValue/>` prints the *value*, not the item's text, unless the root
is handed the value/label map. Without `items` the trigger read `__all__`.
Two edits to the registry files, both because the call sites need them:
- `PopoverContent` forwards `collisionPadding` to the positioner. It picks
four positioner props and this is a fifth; without it the prop lands on the
popup as an unknown DOM attribute.
- The info button is a tooltip trigger *and* a popover trigger, the nesting
the composition guide prescribes. Two levels of `render` deep, the server
keeps the outermost `data-slot` and the client the innermost, which is a
hydration mismatch on that attribute alone; pinning it at each level to
the one it describes settles it.
The social bar's links keep `buttonVariants` on the `<a>` rather than
becoming a `Button`: Base UI's is a real `<button>` and asks to stay one --
rendered as an anchor it wants `nativeButton={false}`, which trades the link
role for `role="button"`. They are links.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* Let Base UI's defaults stand
The migration carried three props whose only job was to keep the Radix
behaviour, and the registry file it edited to carry one of them. A different
library is allowed to look a little different.
`collisionPadding={12}` goes, and with it the fifth positioner prop
`PopoverContent` had to forward: Base UI keeps 5px off the edge on its own,
which on a 375px viewport puts the panel at 19px/5px rather than 12px/12px.
`alignItemWithTrigger={false}` goes. The arrow-over-an-option-already-in-view
it was avoiding is Radix's item-aligned mode, not this one -- laid over the
trigger by Base UI the menu opens at `scrollTop: 0` with neither scroll
button mounted, which is what the prop was there to obtain.
The `__all__` sentinel goes, and the value/label map with it. Base UI has a
cleared value of its own -- `null` -- so the option that drops the filter
carries it, `SelectValue` falls back to its `placeholder`, and every other
option is its own label. The state is still "" and the URL still empties.
`data-slot` is pinned once rather than at each level: the outermost is the
one the server keeps, so it alone decides what the client has to agree with.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* Scroll the tag strip natively, with no bar to show
Radix's `ScrollArea` defaults to `type="hover"`: the bar is not in the DOM
until the pointer is over the area. Base UI has no such mode -- its scrollbar
is mounted whenever the axis overflows, and the registry's classes give it no
resting state -- so every tag strip long enough to scroll grew a permanent
2.5px bar across the bottom of the card.
The strip never wanted a bar. The fade at its edges is what says there is
more, which is why `scroll-fade-x` was aimed through the component at the
element that actually scrolls. A plain `overflow-x-auto` div scrolls the same
way, takes the fade directly, and has no bar to hide -- and its overflow is
declared in CSS rather than written by the component, which is one less thing
between the utility and the scroller it reads.
`components/ui/scroll-area.tsx` has no callers left, so it goes; `shadcn add
scroll-area` brings it back the day something wants it.
Checked against the deployed `main` in the same browser, same viewport: same
strips overflow by the same amounts, and both fade their ends once the page
has settled.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* Revert "Scroll the tag strip natively, with no bar to show"
This reverts commit b3833c4.
* Give the tag strip's scrollbar a resting state
The bar the last commit removed the component to get rid of: Radix kept it out
of the DOM until the pointer was over the area (`type="hover"`), Base UI mounts
it as soon as the axis overflows and leaves it to CSS to say when it shows.
The registry's classes give it no resting state, so every strip long enough to
scroll wore one permanently.
Which is a call-site fix, and `data-hovering` / `data-scrolling` are the API
for it -- the scrollbar publishes both. `opacity-0` plus those two is Radix's
hover mode, spelled out where it belongs.
The fade was never the casualty here. With the vendored `ScrollArea` back, the
three overflowing strips report the same `--scroll-fade-e` as the deployed
`main`, to six decimal places.
AGENTS.md says `components/ui/*` is never edited; it now says never deleted
either, and spells out the two ways this migration found around the rule --
adding a prop the registry chose not to forward, and swapping a component out
of a call site for hand-rolled markup. Its shadcn line also names the style the
app is actually on now.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* No scrollbar on the tag strip at all
The last commit gave the bar a resting state. This one asks what it was for.
The fade already says there is more, it says it without being pointed at, and
that is the whole of what a finger gets -- a bar that appears on hover tells a
touch screen nothing. On a 32px strip it was 10px of it, laid across the pills
it described.
So the strip keeps `ScrollArea` -- the viewport, the hidden native scrollbar,
the wheel and swipe behaviour -- and simply doesn't mount a `ScrollBar`. Base
UI mounts none of its own for an axis that doesn't overflow, so the strips now
render with zero scrollbar elements.
A/B'd on the same page, same protocol: with the bar and without it, the three
overflowing strips report the same `--scroll-fade-e` to six decimal places.
The bar was the only thing that changed.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>1 parent e19f54c commit 710bc10
21 files changed
Lines changed: 786 additions & 1904 deletions
File tree
- apps/website
- app
- examples/[examplename]
- components
- ui
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
24 | 29 | | |
25 | 30 | | |
26 | 31 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
81 | 95 | | |
82 | 96 | | |
83 | 97 | | |
84 | 98 | | |
85 | 99 | | |
86 | 100 | | |
87 | 101 | | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
97 | 107 | | |
98 | 108 | | |
99 | 109 | | |
| |||
124 | 134 | | |
125 | 135 | | |
126 | 136 | | |
127 | | - | |
128 | | - | |
| 137 | + | |
| 138 | + | |
129 | 139 | | |
130 | 140 | | |
131 | 141 | | |
| |||
136 | 146 | | |
137 | 147 | | |
138 | 148 | | |
139 | | - | |
140 | | - | |
| 149 | + | |
| 150 | + | |
141 | 151 | | |
142 | 152 | | |
143 | 153 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
92 | 93 | | |
93 | 94 | | |
94 | 95 | | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
101 | 103 | | |
102 | 104 | | |
103 | 105 | | |
104 | 106 | | |
105 | 107 | | |
106 | | - | |
107 | | - | |
108 | | - | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
109 | 117 | | |
110 | 118 | | |
111 | 119 | | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
125 | 133 | | |
126 | 134 | | |
127 | 135 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
121 | | - | |
| 121 | + | |
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
0 commit comments