block-quote On this pagechevron-down
copy Copy chevron-down
diamonds-4 ComponentsWieldyLayout The WieldyLayout component provides a flexible and customizable layout solution for your React applications. It is built using Ant Design's Layout components and is highly configurable via styles, classes, and layout options. The WieldyLayout supports a modular architecture for the header, footer, sidebar, and content areas, allowing developers to create dynamic and adaptive layouts effortlessly.
Here is a basic example of how to use the WieldyLayout component:
Copy import React from " react " ;
import { WieldyLayout } from " ./WieldyLayout " ;
const layoutConfig = {
styles : {
header : { backgroundColor : " #fff " },
sidebar : { backgroundColor : " #f0f2f5 " },
},
classes : {
root : " custom-root-class " ,
},
layoutOptions : {
header : { fixed : true },
sidebar : { hidden : false , fixed : true },
footer : { hidden : false },
},
};
const App = () => (
< WieldyLayout
header = { < div >Header Content</ div > }
sidebar = { < div >Sidebar Content</ div > }
footer = { < div >Footer Content</ div > }
styles = {layoutConfig . styles }
classes = {layoutConfig . classes }
layoutOptions = {layoutConfig . layoutOptions }
>
< div > Main Content </ div >
</ WieldyLayout >
) ;
export default App ; The WieldyLayout component accepts the following props:
Description: Content to render in the header.
Description: Content to render in the footer.
Description: Content to render in the sidebar.
Description: Content to render in the right sidebar.
Description: Inline CSS styles for various layout sections.
Type: WieldyLayoutClasses
Description: CSS class names for various layout sections.
Type: WieldyLayoutOptions
Description: Configuration options for the header, footer, sidebar, and right sidebar.
Description: Main content to render within the layout.
WieldyLayoutClasses
Defines class names for various layout sections.
WieldyLayoutStyles
Defines inline styles for various layout sections.
WieldyLayoutOptions
Configuration options for layout sections.
Header Options
Sidebar Options
Footer Options
The WieldyLayoutContextType allows developers to dynamically update layout options during runtime.
setHeaderOptions(options: WieldyLayoutHeaderOptions)
setSidebarOptions(options: WieldyLayoutSidebarOptions)
setRightSidebarOptions(options: WieldyLayoutSidebarOptions)
setFooterOptions(options: WieldyLayoutFooterOptions)
Advanced Example
Dynamically updating layout options using context:
The styles and classes props provide complete flexibility for styling:
Use the context API for dynamic layout changes.
Combine styles and classes for optimal customization.
Modularize reusable components like headers, footers, and sidebars.
Can I hide specific layout sections? Yes, use the hidden property in layoutOptions.
How do I style individual sections? Use the styles or classes props.
Does WieldyLayout support responsive design? Yes, you can leverage Ant Design’s grid system and media queries.
For further assistance, refer to the official documentation or contact support.