←back to thread

144 points hunvreus | 2 comments | | HN request time: 0s | source

Basecoat ports the upcoming shadcn/ui v4 [1] to plain HTML + Tailwind (no React):

- Live demo & documentation: https://basecoatui.com

- MIT‑licensed and free: https://github.com/hunvreus/basecoat/

- Works with any backend (Flask, Django, Rails, PHP, etc.) or static site.

- Fully theme‑compatible with shadcn/ui [2].

- Uses a sliver of Alpine.js only for a few interactive bits (e.g. combobox). Swap in your own JS if you prefer.

- Dead simple to use, just drop in a class here and there:

  <button class="btn" data-tooltip="This is a tooltip text">Click me</button>
Why I built it: after moving from a Next.js stack back to Flask + Tailwind + HTMX, I missed shadcn/ui and didn’t want walls of Tailwind classes (like Flowbite or Preline).

Feedback is most welcome: bugs, requests for components, criticism.

[1]: https://v4.shadcn.com/

[2]: https://basecoatui.com/installation/#install-theming

[3]: https://pagescms.org

Show context
gsanderson ◴[] No.43974789[source]
Looks great!

One suggestion would be adding a focus trap, such as when a Dialog opens. It's nice to use the tab key to move around the Dialog (inputs and buttons). Currently focus leaves to the page behind. It might be as simple as adding https://alpinejs.dev/plugins/focus#x-trap

replies(1): >>43978820 #
hunvreus ◴[] No.43978820[source]
Yeah, I looked into it but wanted to avoid adding plugins.

I already do a bit of (simple) focusing here and there, so it shouldn't leave the focus on the background:

https://github.com/hunvreus/basecoat/blob/main/src/js/dialog...

But more complex scenario require you to be specific about the field you want to see focused. I was thinking about allowing you designate the field to focus on.

What would you suggest?

replies(1): >>43983798 #
1. dbbk ◴[] No.43983798[source]
Why aren't you just using the built-in dialog element that already handles this?
replies(1): >>43984317 #
2. hunvreus ◴[] No.43984317[source]
<dialog> is kind of a PITA to style (backdrop, transitions, etc), and doesn't really solve any of the tough problems with dialogs (e.g. locking scrolling).

I tried really hard to use <dialog> and popover but didn't succeed. Maybe somebody more skilled can make it happen.