-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RFC: styling the UI library #1406
Conversation
|
f6bcd47
to
04319e9
Compare
04319e9
to
6cbe936
Compare
It's really too bad there isn't some build tool that allows non-tailwind projects to use tailwind components. Given that's the case, I think the reasoning here makes sense. The question then becomes, which css-in-js framework/method should we use? Ideas:
|
@grod220 @jessepinho Tailwind can be built just like any other solutions – by extracting CSS from JS, and consumers won't need to know about Tailwind existence. Take a look at the vite-react-component-library-starter template, it builds into |
@VanishMax we'd still run into the issues I've outlined here — particularly the last one, where we'd either have to duplicate CSS classes across component CSS files, or we'd have to export a massive kitchen-sink CSS with a bunch of code that consumers don't need. |
@jessepinho CSS chunks might solve the issue if configured correctly. Referencing your example, if three different Penumbra UI library components use This is still a theory since I've done the same with JS chunks but not CSS but might be considered |
@VanishMax good point — if we could figure that out, then perhaps consumers' CSS compilers could compile all the resultant CSS chunks into a single CSS file, to prevent browsers from having to download a ton of tiny, single-class CSS files. That said, that might force us to either A) create a ton of tiny single-class CSS files to avoid making CSS compilers compile more than they need to, or B) create utility CSS files (for things like To me, the biggest issue is that we would be requiring consumers to import CSS files in addition to component JS files, which — while not uncommon — isn't a great DX if it can be avoided. I've added a note about this here: 3265a81 |
@grod220 I could make a separate ADR/RFC for which framework to use, but I was personally leaning toward styled-components. It's the most popular one, and I've used it extensively in the past. However, Notes on the others:
* You wrote "Plain objects passed to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe styled-components had some issues with the new server components? Not sure, but we should ensure there's compatibility there with whatever we go with. It's a 👍 from me, but @VanishMax any further thoughts on this?
One important aspect I forgot to mention previously about the UI kit is the accessibility. Using Radix-ui helps us maintain quality across UI components in terms of the full keyboard support but we should not forget about the color contrast, HTML semantics and screen reader accessibility. Saying that, I propose we keep working with radix and possibly use some components from react-aria (e.g. Calendar or DatePicker, which is not supported in Radix). Anyway, it doesn't relate to this RFC, just a thought. An approve from my side:) |
Excellent call-out, @VanishMax — I definitely will be leaning on existing libraries more complex components like date pickers, calendars, etc. For simpler components, I'll likely roll them myself to avoid messy base style overrides, or I'll use headless UI libraries (like Radix, as you suggested) when needed. |
This PR is a request for comments on the ADR I've written. Please read the ADR (Markdown preview here), and make inline comments on the file or general comments here in the PR thread.
I've written the ADR as though it's a finished decision, but obviously it's not — I just wrote what my decision would be, as a starting point for the rest of the team to comment on it.
Since our web weekly tomorrow is canceled for July 4th, we'll need to talk about this issue asynchronously here in the PR. Perhaps we can come to a final decision at next Thursday's web weekly, if we haven't already resolved the issue here.
Related to prax-wallet/prax#81