# Blog Source: https://anvil.servicetitan.com/blog/index # Redefining Layout in Anvil2 Source: https://anvil.servicetitan.com/blog/posts/2024-08-16-redefining-layout-in-anvil2 In Anvil2, we have introduced new components and features to make creating dynamic, responsive page layouts a breeze. Read on to learn more! Fork [this codesandbox](https://codesandbox.io/p/sandbox/anvil2-layout-demo-vl5fcv) to play around with some of the new features! This was used during a tech talk on July 2nd, 2024. ## Layout changes from Anvil → Anvil2 ### Summary * Enable easy use of Flexbox and CSS Grid * Two new component – Flex and Grid * All Anvil2 components have some control over layout using layout utils props * Simplified APIs * Flexibility and responsiveness baked-in ### Page component updates *See [Anvil2 Page Implementation Docs](/docs/web/components/page/code)* * Simplified API * Headers, footers, and action toolbars should now be created independently as part of the layout * Sidebar and Panel are now sub-components * Background color can be controlled using CSS (`style` or `className`) * Better responsive behavior coming soon! ```tsx theme={null} Sidebar Header Nav Link {/* page content (including the header, action toolbar, footer, etc.) */} ``` ### Layout component updates *See [Anvil2 Layout Implementation Docs](/docs/web/components/layout/code)* * Simplified API with `Layout` and `Layout.Item` used to create columns * Responsiveness built-in, and customizable * Three density variants available using `variant` prop: `"default"`, `"narrow"`, and `"wide"` ```tsx theme={null} {/\* full-width content... \*/} {/\* one-quarter-width content... \*/} {/\* three-quarter-width content... \*/} ``` #### Column structure and responsive behavior​ Layouts use a 12-column structure that reduces columns based on the size of the layout. Note that the values below are based on the width of the Layout, not the entire screen (using container queries). This is important if the page includes a sidebar or panel. * On `sm` screens (and below), there are four columns * On `md` screens and up, there are twelve columns Responsive props can be used to override the `span` value at certain breakpoints (and higher). ```tsx theme={null} 767px = 3/4 width sm={3} // 768px -> 1023px = 1/3 width md={4} // 1024px -> 1279px = 1/2 width lg={6} // 1280px -> 1535px = 2/3 width xl={8} // >=1536px = 3/4 width xxl={9} > {/*...content */} ``` ## New layout features in Anvil2 ### Flex and Grid components *See the [Flex Implementation Docs](/docs/web/components/flex/code) and [Grid Implementation Docs](/docs/web/components/grid/code).* `Flex` is similar to `Stack`, with some minor differences. A `Flex` can be used both as a flex container and item, so instead of using `Stack.Item`, use another `Flex` or another Anvil2 component. This greatly reduces the amount of code required to build flex layouts! #### Anvil (legacy) example ```tsx theme={null}