mirror of
https://github.com/cloud-shuttle/leptos-shadcn-ui.git
synced 2026-05-14 10:30:41 +00:00
1.2 KiB
1.2 KiB
Registry Component API
A component registry for managing and accessing components.
Installation
# Cargo.toml
[dependencies]
shadcn-ui-leptos-registry = "0.7"
use shadcn_ui_leptos_registry::Registry;
Component API
Registry
The registry provides component discovery and metadata.
Usage Examples
Using the Registry
use shadcn_ui_leptos_registry::Registry;
#[component]
pub fn MyComponent() -> impl IntoView {
// Get component metadata
let components = Registry::get_all_components();
view! {
<div>
{components.iter().map(|c| {
view! {
<div>
<h3>{c.name.clone()}</h3>
<p>{c.description.clone()}</p>
</div>
}
}).collect::<Vec<_>>()}
</div>
}
}
TypeScript API
export const Registry: {
getAllComponents: () => ComponentMetadata[];
getComponent: (name: string) => ComponentMetadata | null;
};