@front10/flexible-layout
v0.0.2
Published
Allow use a flexible layout for components
Downloads
172
Readme
Example
import React from "react";
import { useLayout, useAriaLabel } from "@front10flexible-layout";
const Text = () => <span>Hello</span>;
const Box = ({ children }) => <div>{children}</div>;
const MyComponent = ({ layout }) => {
const { dom, ariaLabel } = useLayout(layout, {
Text,
Box
});
return <Box ariaLabel={ariaLabel}>{dom}</Box>;
};
const MyPage = () => {
const layout = {
type: "Box",
children: [
{
type: "Text"
}
]
};
return <MyComponent layout={layout} />;
};