Consuming the Registry
This guide covers how to install components from the Mukoko Registry, customize them after installation, and keep them updated.
Prerequisites
Before installing components, ensure your project has:
- A
components.jsonfile (created bynpx shadcn@latest init) - The
cn()utility inlib/utils.ts - Tailwind CSS with the Five African Minerals tokens in
globals.css
See the Installation guide for full setup instructions.
Installing components
Single component
npx shadcn@latest add https://registry.mukoko.com/api/v1/ui/buttonMultiple components
npx shadcn@latest add \
https://registry.mukoko.com/api/v1/ui/card \
https://registry.mukoko.com/api/v1/ui/badge \
https://registry.mukoko.com/api/v1/ui/dialogHooks
npx shadcn@latest add https://registry.mukoko.com/api/v1/ui/use-toast
npx shadcn@latest add https://registry.mukoko.com/api/v1/ui/use-mobileLibrary utilities
npx shadcn@latest add https://registry.mukoko.com/api/v1/ui/utils
npx shadcn@latest add https://registry.mukoko.com/api/v1/ui/circuit-breakerDependency resolution
When you install a component, the CLI automatically:
- Installs npm dependencies — packages like
radix-ui,class-variance-authority,recharts - Installs registry dependencies — other Mukoko components the installed component needs (e.g.,
dialogpulls inbutton)
You do not need to manually resolve dependencies.
What you get
Components are installed as local files in your project. A typical install creates:
components/
ui/
button.tsx ← Full source code, you own itThe file contains:
- TypeScript source with full type annotations
- CVA variant definitions
- Radix UI primitive usage for accessibility
cn()class compositiondata-slotattributes for styling hooks
Customization after install
Since components are local files, you can modify them freely:
Adding a variant
// In components/ui/button.tsx
const buttonVariants = cva("...", {
variants: {
variant: {
default: "...",
outline: "...",
// Add your custom variant
cobalt: "bg-[var(--color-cobalt)] text-white hover:bg-[var(--color-cobalt)]/90",
},
},
})Adjusting styles
// Change the default border radius
const buttonVariants = cva(
"inline-flex items-center justify-center rounded-xl ...", // Changed from rounded-md
{ ... }
)Extending props
interface ButtonProps extends React.ComponentProps<"button">,
VariantProps<typeof buttonVariants> {
loading?: boolean // Add custom prop
}Updating components
To update a component to the latest registry version:
npx shadcn@latest add https://registry.mukoko.com/api/v1/ui/buttonThis overwrites the local file. If you have made customizations:
- Commit your current changes to version control
- Run the update
- Review the diff and re-apply your customizations
Using the API directly
You can also fetch component data via the API without the CLI:
# Get component metadata and source
curl https://registry.mukoko.com/api/v1/ui/button
# List all components
curl https://registry.mukoko.com/api/v1/uiThe JSON response includes the full source code in the files[].content field, which you can copy manually if needed.
Best practices
- Install from the registry — do not copy-paste component code from the documentation
- Keep the utility function — components depend on
cn()from@/lib/utils - Maintain the token system — components reference CSS custom properties; ensure your
globals.csshas all required tokens - Test after updates — verify visual consistency and behavior after updating components
- Track changes — use version control to track modifications to installed components