Layout components
Layout components allow you to customize the visual appearance and structure of the K3 configurator. You can use higher-order components (HOCs) to extend or completely replace existing components.
Higher-Order Components (HOCs)
A HOC is a function that takes a React component and returns a new, extended component:
__PROTECTED_0__
const myHOC: HOC = (OriginalComponent) => {
return (props) => {
// Eigene Logik vor dem Rendering
console.log("Rendering component with props:", props);
// Original-Komponente mit modifizierten oder zusätzlichen Props rendern
return (
<div className="my-wrapper">
<OriginalComponent {...props} customProp="value" />
</div>
);
};
};
Basic structure
Layout extensions are registered in the ui.layout object:
// In Plugin.tsx
export default {
// ...
ui: {
layout: {
header: {
hoc: myHeaderHOC,
description: "Erweitert die Kopfzeile mit einem Custom Badge"
},
sidebar: {
hoc: mySidebarHOC,
description: "Fügt zusätzliche Navigation hinzu"
}
}
}
}
Each layout slot requires:
- hoc: The HOC function
- description: Description of the extension point (string or localized string)
Available layout slots
root
Overwrites the topmost wrapper component of the entire application. Wraps everything - header, sidebar, content and footer.
Application examples:
- Global theme providers
- Error Boundaries
- App-wide contexts
root: {
hoc: (Original) => (props) => (
<MyThemeProvider>
<Original {...props} />
</MyThemeProvider>
),
description: "Fügt einen globalen Theme-Provider hinzu"
}
header
Overwrites the header of the configurator (header bar).
Typically contains:
- Logo/Branding
- Navigation buttons
- Scene buttons
- Price display
header: {
hoc: (Original) => (props) => (
<>
<div className="custom-banner">Sonderaktion!</div>
<Original {...props} />
</>
),
description: "Fügt einen Banner über dem Header hinzu"
}
sidebar
Overwrites the entire sidebar, which contains the groups and variables.
sidebar: {
hoc: (Original) => (props) => (
<div className="custom-sidebar-wrapper">
<Original {...props} />
<div className="sidebar-footer">Zusätzliche Infos</div>
</div>
),
description: "Erweitert die Sidebar mit Footer"
}
sidebarHeader
Overwrites the header area of the sidebar (above the group list).
sidebarFooter
Overwrites the footer area of the sidebar (below the group list).
footer
Overwrites the footer of the configurator.
contentView
Overwrites the main content area (3D viewer, gallery etc.).
gallery
Overwrites the gallery view for image configurators.
branding
Overwrites the branding component (logo + brand name).
branding: {
hoc: (Original) => (props) => (
<div style={{ display: "flex", alignItems: "center", gap: "10px" }}>
<Original {...props} />
<span className="beta-badge">BETA</span>
</div>
),
description: "Fügt ein Beta-Badge neben dem Logo hinzu"
}
logo
Overwrites only the logo element within the branding.
navigationButtons
Overwrites the navigation buttons (back/forward between groups).
exitButtons
Overwrites the exit buttons.