Replies: 1 comment
-
|
Maintaining a broad API similar to Shadcn has always been part of my plan. However, the reality is that Shadcn and GPUI Component offer fundamentally different mechanisms, such as DataTable and List. GPUI Component prioritizes high performance even with large-scale data, making it suitable for complex applications. Shadcn's design is flexible; component styles can even be customized after installation, which is unlikely to be possible in GPUI Component (due to different architectures). In fact, the current API design also references component designs from macOS and Windows, as well as other popular GUI frameworks. Therefore, my answer is that these changes will depend on the situation. PRs are welcome, but specific changes will be determined on a case-by-case basis. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi! I’m the author of
quoin, a project that aims to provide a single canonical API for all ShadCN‑style Rust UI libraries, built on top ofgpui-component. The idea is to use compile‑time macros so that developers can write a component once and generate it for GPUI, Leptos, or Dioxus.To make this possible, the underlying libraries need to align their APIs with the original ShadCN spec. I’ve done a full side‑by‑side review of
gpui-component,leptos-shadcn-ui, andshadcn-dioxus. The goal is to identify gaps and naming inconsistencies and gradually converge toward a shared standard.I’d love to open a discussion about what changes could be made in
gpui-componentto move in that direction, and whether the maintainers would be open to contributions that implement them.Key Findings for
gpui-componentVariant naming – The current names differ from the canonical ShadCN set:
primary→defaultdanger→destructivetext→linkThis affects
Button,Alert,Tag, etc.Component composition – Some components currently use a builder‑only pattern (e.g.,
.item(|item| …)forAccordion). However, the canonical spec uses distinct child components (AccordionItem,AccordionTrigger,AccordionContent).Adding those sub‑components (while keeping the existing API) would make the library easier to target with macros.
State management – Many components manage state internally via
Entityand subscriptions (e.g.,CalendarState,InputState). The canonical approach uses controlled/uncontrolled props withon_changecallbacks. A complementary API that accepts an optionalselected/valuesignal would greatly simplify cross‑framework code generation. This is already partially present in the declarativeDialogandAlertDialog.Missing core ShadCN components
I identified several components that are present in the other two libraries but absent in
gpui-component:Card(GroupBoxis similar but not identical)CarouselCombobox(though a searchableSelectexists)CommandpaletteEmptystateMenubarNavigationMenuScrollArea(currently just a CSS utility)SeparatorSidebar(already partially present but not as a provider‑based system)Adding these would make
gpui-componenta complete ShadCN implementation.Minor inconsistencies
Avatarshould supportAvatarImageandAvatarFallbackchildren, not just a.src()string.Badgeuses.count()and.dot()– these could be part of aBadgeVariantor kept as extras, but a standardBadgevariant prop would help.Checkboxlacks an indeterminate state.RadioGroupandTabsrely on index‑based selection rather than string values.Buttonis missing aloadingprop.How This Helps
quoinand the EcosystemIf
gpui-componentadopts the canonical ShadCN naming and composition patterns,quoin(and any other tool) can generate its components directly without hundreds of lines of polyfills. The same macros could target Leptos or Dioxus libraries with near‑trivial backend modules.More importantly, it makes the ShadCN ecosystem in Rust consistent, so that developers moving between frameworks don’t have to relearn APIs.
What I’m Proposing
I’d like to contribute PRs that:
AccordionItem,AccordionTrigger,AccordionContent) alongside the existing APIs (non‑breaking).Card,Separator, etc.) with standardised props.on_changecallbacks) to existing stateful components.All changes would be designed to be backwards‑compatible as much as possible.
I’d love to hear the maintainers’ thoughts. Is this direction acceptable? Are there any concerns about the scope or timeline? I’m happy to collaborate and help with the implementation.
Thank you for building
gpui-component– it’s a fantastic library, and I’m excited about its potential as the GPUI‑native ShadCN offering.Beta Was this translation helpful? Give feedback.
All reactions