Slots provide a powerful way to inject custom content into predefined locations
throughout Zudoku. They allow you to extend the default layout and functionality
without modifying the core components.
Configuration
You can define slots in your zudoku.config.tsx file using the slots
property:
Function components: Functions that return JSX elements and receive
routing props
Code
slots: { // JSX element "footer-after": <CustomFooter />, // Function with access to routing props "head-navigation-end": ({ navigate, location, searchParams }) => ( <Button onClick={() => navigate('/settings')} variant={location.pathname === '/settings' ? 'default' : 'ghost'} > Settings </Button> ),}
Functions receive an object with routing properties:
location - Current route location
navigate - Navigation function
searchParams - URL search parameters
setSearchParams - Function to update search parameters
params - Route parameters
Type Safety
Zudoku provides full TypeScript support for slot names. All predefined slot
names will show up with autocomplete when you type them in your configuration.
Advanced Usage
For more advanced slot usage, including programmatic slot management, dynamic
content, and adding custom slot names, see the
Slot Component documentation.