### MUI ThemeProvider Setup with MUI Flexy Components
Source: https://context7.com/brandonscript/mui-flexy/llms.txt
Provides a complete example of setting up a React application with MUI's `ThemeProvider` and `CssBaseline`, demonstrating how to integrate MUI Flexy components like `FlexBox` and `FlexGrid` within a themed environment. This ensures consistent styling across the application.
```tsx
import { ThemeProvider, createTheme } from "@mui/material/styles";
import { CssBaseline, Typography } from "@mui/material";
import { FlexBox, FlexGrid } from "@mui-flexy/v7";
const theme = createTheme({
palette: {
mode: "light",
primary: { main: "#1976d2" },
},
});
const App = () => (
WelcomeContent area
);
export default App;
```
--------------------------------
### FlexGrid Migration Examples (v5, v6, v7+)
Source: https://github.com/brandonscript/mui-flexy/blob/main/README.md
Provides code examples for migrating from FlexGrid (v5) to FlexGrid2 (v6) and then to the updated FlexGrid (v7+) structure, highlighting changes in item props.
```jsx
// FlexGrid (v5), based on @mui/material/Grid
Grids are cool
// FlexGrid2 (v6), based on @mui/material/Grid2
Grids are cool
// FlexGrid (v7+), based on @mui/material/Grid
Grids are cool
```
--------------------------------
### Installing mui-flexy Packages
Source: https://github.com/brandonscript/mui-flexy/blob/main/README.md
Provides installation commands for mui-flexy, specifying different packages for Material UI v5, v6, and v7, as well as a core package for shared utilities.
```shell
# For @mui/material v7
npm install @mui-flexy/v7
# For @mui/material v6
npm install @mui-flexy/v6
# For @mui/material v5
npm install @mui-flexy/v5
# or using yarn
yarn add @mui-flexy/v{5,6,7}
# or using pnpm
pnpm add @mui-flexy/v{5,6,7}
```
--------------------------------
### Install MUI and Emotion Dependencies
Source: https://github.com/brandonscript/mui-flexy/blob/main/README.md
Installs the necessary Material-UI (MUI) and Emotion packages required for mui-flexy and other MUI-based projects. These are foundational dependencies for using MUI components.
```bash
npm install @mui/material @emotion/react @emotion/styled react react-dom
```
--------------------------------
### Install mui-flexy Packages
Source: https://context7.com/brandonscript/mui-flexy/llms.txt
Installs the appropriate mui-flexy package based on the installed Material UI version. This ensures compatibility and optimal bundle size.
```bash
# For @mui/material v7
npm install @mui-flexy/v7
# For @mui/material v6
npm install @mui-flexy/v6
# For @mui/material v5
npm install @mui-flexy/v5
```
--------------------------------
### React Initialization and Rendering with mui-flexy
Source: https://github.com/brandonscript/mui-flexy/blob/main/docs/index.template.html
This snippet demonstrates the setup required to run a React application using mui-flexy. It includes essential imports and a workaround for Babel/standalone issues by reassigning React and ReactDOM to the window object. The code then attempts to dynamically import an 'App' component and render it into the DOM.
```javascript
import * as React from "react";
import * as ReactDOM from "react-dom";
import { createRoot } from "react-dom/client";
/**
* ! Without window reassignment the imported modules are
* ! not available in the JSX transformed Babel script below.
* ! This is a hacky workaround to deal with Babel/standalone issue.
**/
window.React = React;
window.useContext = React.useContext;
window.useState = React.useState;
window.useEffect = React.useEffect;
window.useRef = React.useRef;
window.useMemo = React.useMemo;
window.useCallback = React.useCallback;
window.useReducer = React.useReducer;
window.forwardRef = React.forwardRef;
window.createContext = React.createContext;
window.createElement = React.createElement;
window.ReactDOM = ReactDOM;
window.createRoot = createRoot;
console.log('Page loaded, checking for basic objects');
console.log('React available:', typeof window.React);
console.log('ReactDOM available:', typeof window.ReactDOM);
console.log('createRoot available:', typeof window.createRoot);
try {
const { default: App } = await import('__BASEPATH__/static/docs.js');
window.createRoot(document.querySelector("#root")).render(window.React.createElement(App));
} catch (error) {
console.error('Error loading app:', error);
}
```
--------------------------------
### Styled Inline Component with styled()
Source: https://github.com/brandonscript/mui-flexy/blob/main/README.md
Shows how to create a styled component from an inline component definition using styled(). This example defines a ResetBox that wraps a FlexBox, adding an onClick handler and specific max-width/max-height styles.
```jsx
const ResetBox = styled(
({ resetFn, ...props }: FlexBoxProps & { resetFn?: () => void }) => ,
)(({ theme }) => ({
maxWidth: 100,
maxHeight: 100,
}));
```
--------------------------------
### FlexBox Component Override Examples
Source: https://github.com/brandonscript/mui-flexy/blob/main/README.md
Shows how to override the default HTML element rendered by FlexBox using the `component` prop, providing examples for 'span' and a custom 'Typography' component.
```jsx
const SpanFlex = ;
const TypographyFlex = ;
```
--------------------------------
### SSR Setup with Emotion Cache (Next.js)
Source: https://context7.com/brandonscript/mui-flexy/llms.txt
Configures Emotion cache for server-side rendering frameworks like Next.js to prevent hydration errors. It initializes a cache, theme, and wraps the application with necessary providers.
```tsx
import { CacheProvider } from "@emotion/react";
import createCache from "@emotion/cache";
import { ThemeProvider, createTheme } from "@mui/material/styles";
import { CssBaseline } from "@mui/material";
import { FlexBox } from "@mui-flexy/v7";
const emotionCache = createCache({ key: "my-app-css" });
const theme = createTheme({ palette: { mode: "light" } });
const App = ({ Component, pageProps }) => (
);
export default App;
```
--------------------------------
### Create Centered Box with styled()
Source: https://github.com/brandonscript/mui-flexy/blob/main/README.md
Demonstrates creating a styled FlexBox component that centers its content both horizontally and vertically using the styled() function. This is a basic example of applying styles to a FlexBox.
```jsx
const CenterCenterBox = styled(FlexBox)({
display: "flex",
justifyContent: "center",
alignItems: "center",
});
```
--------------------------------
### Styled Component with theme.unstable_sx
Source: https://github.com/brandonscript/mui-flexy/blob/main/README.md
Demonstrates using `theme.unstable_sx` within a styled FlexBox component to apply theme-aware styles. This example sets background color, border-radius, and padding using values from the MUI theme.
```jsx
const SquircleishBox = styled(FlexBox)(({ theme }) =>
theme.unstable_sx({
backgroundColor: theme.palette.primary.light,
borderRadius: 2, // use theme.unstable_sx to use theme values
px: 1, // use theme.unstable_sx to use theme values
}),
);
```
--------------------------------
### FlexGrid Component for MUI v7 (TSX)
Source: https://context7.com/brandonscript/mui-flexy/llms.txt
Details the FlexGrid component for MUI v7, which extends MUI's Grid (formerly Grid2) and incorporates the 'x' and 'y' alignment props. It utilizes the 'size' prop for defining grid item dimensions across breakpoints. Examples show basic grid setup, flexible sizing with 'grow', and nested grids.
```tsx
import { FlexGrid } from "@mui-flexy/v7";
import { Typography } from "@mui/material";
// Basic grid with alignment
Grid Item 1Grid Item 2Grid Item 3
// Grid with size="grow" for flexible sizing
Flexible width itemFixed 4-column item
// Nested grid with column alignment
Left ColumnCentered contentRight Column
```
--------------------------------
### FlexGrid for MUI v5 (Legacy Grid) (TSX)
Source: https://context7.com/brandonscript/mui-flexy/llms.txt
Details the FlexGrid component for MUI v5, which is designed to work with the legacy Grid component. It requires the `item` prop for grid items and uses individual breakpoint props (xs, sm, md, lg, xl) for sizing, alongside the 'x' and 'y' props for alignment. Examples show basic setup and alignment on individual items.
```tsx
import { FlexGrid } from "@mui-flexy/v5";
import { Typography } from "@mui/material";
// v5 syntax with individual breakpoint props
Grid Item 1Grid Item 2
// With alignment on individual items
Left-aligned itemRight-aligned item
```
--------------------------------
### FlexGrid2 for MUI v6 (TSX)
Source: https://context7.com/brandonscript/mui-flexy/llms.txt
Provides documentation for FlexGrid2, the component to use with MUI v6. It leverages MUI's Grid2 component and supports the same 'x', 'y', and 'size' prop syntax for alignment and responsive sizing. Examples demonstrate basic usage and equal item distribution using `size`.
```tsx
import { FlexGrid2 } from "@mui-flexy/v6";
import { Typography } from "@mui/material";
// v6 syntax with FlexGrid2
Centered grid itemAnother item
// size can be true for equal distribution
Equal widthEqual width
```
--------------------------------
### Set up MUI ThemeProvider
Source: https://github.com/brandonscript/mui-flexy/blob/main/README.md
Demonstrates how to wrap your application with MUI's ThemeProvider and CssBaseline. This is essential for applying global styles and theme configurations to your MUI components.
```jsx
import { ThemeProvider, createTheme } from "@mui/material/styles";
import { CssBaseline } from "@mui/material";
const theme = createTheme({
palette: {
mode: "light", // or "dark"
},
});
const App = () => (
);
```
--------------------------------
### Initialize React DOM with MUI Flexy
Source: https://github.com/brandonscript/mui-flexy/blob/main/docs/index.html
This JavaScript snippet demonstrates how to initialize the React DOM with the createRoot API and render a root App component. It includes a workaround for Babel/standalone issues by assigning React and ReactDOM properties to the window object. It also dynamically imports an App component and handles potential errors during loading.
```javascript
import * as React from "react";
import * as ReactDOM from "react-dom";
import { createRoot } from "react-dom/client";
/**
* ! Without window reassignment the imported modules are
* ! not available in the JSX transformed Babel script below.
* ! This is a hacky workaround to deal with Babel/standalone issue.
**/
window.React = React;
window.useContext = React.useContext;
window.useState = React.useState;
window.useEffect = React.useEffect;
window.useRef = React.useRef;
window.useMemo = React.useMemo;
window.useCallback = React.useCallback;
window.useReducer = React.useReducer;
window.forwardRef = React.forwardRef;
window.createContext = React.createContext;
window.createElement = React.createElement;
window.ReactDOM = ReactDOM;
window.createRoot = createRoot;
console.log('Page loaded, checking for basic objects');
console.log('React available:', typeof window.React);
console.log('ReactDOM available:', typeof window.ReactDOM);
console.log('createRoot available:', typeof window.createRoot);
try {
const { default: App } = await import('./static/docs.js');
window.createRoot(document.querySelector("#root")).render(window.React.createElement(App));
} catch (error) {
console.error('Error loading app:', error);
}
```
--------------------------------
### Basic FlexBox Usage with mui-flexy
Source: https://github.com/brandonscript/mui-flexy/blob/main/README.md
Demonstrates the simplified syntax of mui-flexy for centering content using 'x' and 'y' props, compared to standard Material UI Box component.
```jsx
import { FlexBox } from "@mui-flexy/v7";
// Standard Material UI Box
// mui-flexy equivalent
```
--------------------------------
### Use FlexGrid with MUI v5 and v7 (Grid)
Source: https://github.com/brandonscript/mui-flexy/blob/main/README.md
Shows how to use FlexGrid for MUI v5 and v7, which are based on MUI's standard Grid component. It highlights the usage of container and item props along with alignment features.
```jsx
// For MUI v5
import { FlexBox, FlexGrid } from "@mui-flexy/v5";
Grids are cool;
```
--------------------------------
### FlexBox Responsive Style Object Notation
Source: https://github.com/brandonscript/mui-flexy/blob/main/README.md
Illustrates using object notation for responsive styles in FlexBox's `x` and `y` props, mapping to MUI's breakpoint-specific style objects.
```jsx
// ...is equivalent to:
```
--------------------------------
### Import and Use FlexBox (MUI v5-v7)
Source: https://github.com/brandonscript/mui-flexy/blob/main/README.md
Shows how to import and use the FlexBox component from mui-flexy for different MUI versions. FlexBox offers enhanced alignment capabilities over MUI's standard Box component.
```jsx
import { Typography } from "@mui/material"; // or use a
if you don't like fun typography
// For MUI v5
import { FlexBox, FlexGrid } from "@mui-flexy/v5";
// For MUI v6
import { FlexBox, FlexGrid } from "@mui-flexy/v6";
// For MUI v7
import { FlexBox, FlexGrid } from "@mui-flexy/v7";
Hello, Bajor;
```
--------------------------------
### Alternative FlexBox Implementation with MUI Box
Source: https://github.com/brandonscript/mui-flexy/blob/main/README.md
Illustrates how to achieve similar flexbox alignment using MUI's built-in Box component with the `sx` prop or by creating a styled component. This serves as a comparison to mui-flexy's approach.
```jsx
// Use sx:
Hello, Bajor;
// Use a styled component (to prevent re-creating the flexbox styles for every instance):
const CenteredFlexBox = styled(Box)({
display: "flex",
justifyContent: "center",
alignItems: "center",
});
Hello, Bajor;
```
--------------------------------
### FlexBox Responsive Style Array Notation
Source: https://github.com/brandonscript/mui-flexy/blob/main/README.md
Shows how FlexBox supports responsive styling using array notation for `x`, `y`, and `row` props, mapping to MUI's responsive style arrays.
```jsx
// ...is equivalent to:
```
--------------------------------
### mui-flexy Alignment with Column Direction
Source: https://github.com/brandonscript/mui-flexy/blob/main/README.md
Shows how to use mui-flexy's 'column' prop along with 'x' and 'y' for alignment in a flex column layout.
```jsx
import { FlexBox } from "@mui-flexy/v7";
```
--------------------------------
### Use FlexGrid with MUI v6 (Grid2)
Source: https://github.com/brandonscript/mui-flexy/blob/main/README.md
Demonstrates the usage of FlexGrid (specifically FlexGrid2 for MUI v6) with its container and item props, including alignment options. This component enhances MUI's Grid2 with `x` and `y` alignment props.
```jsx
// For MUI v6 (uses Grid2)
import { FlexBox, FlexGrid2 } from "@mui/v6";
// Usage is the same across versions:
Grids are cool;
```
--------------------------------
### FlexBox with Forwarded Ref
Source: https://github.com/brandonscript/mui-flexy/blob/main/README.md
Demonstrates how to use `forwardRef` with FlexBox to access DOM elements or component instances, showing how to attach a ref and access its properties.
```jsx
import { forwardRef } from "react";
const boxRef = useRef(null);
{`I'm a FlexBox with id ${boxRef.current?.id}`};
```
--------------------------------
### Responsive FlexBox Alignment with mui-flexy
Source: https://github.com/brandonscript/mui-flexy/blob/main/README.md
Illustrates mui-flexy's capability to handle responsive changes in flexbox properties like alignment and direction using breakpoint-specific props.
```jsx
import { FlexBox } from "@mui-flexy/v7";
import Box from "@mui/material/Box";
// mui-flexy responsive usage
// Equivalent standard Material UI Box with responsive sx prop
```
--------------------------------
### Styling MUI Flexy Components with Styled Components
Source: https://context7.com/brandonscript/mui-flexy/llms.txt
Illustrates how to integrate MUI Flexy components with MUI's `styled()` function to create reusable, styled flex components. It covers basic styling, using `shouldForwardProp` for custom props, and the inline component pattern.
```tsx
import { styled } from "@mui/material/styles";
import { FlexBox, FlexBoxProps } from "@mui-flexy/v7";
// Basic styled FlexBox
const CenteredCard = styled(FlexBox)(({ theme }) => ({
backgroundColor: theme.palette.background.paper,
borderRadius: theme.shape.borderRadius,
padding: theme.spacing(3),
boxShadow: theme.shadows[2],
}));
Styled centered card
// With shouldForwardProp for custom props
interface CountBoxProps extends FlexBoxProps {
count: number;
}
const CountBox = styled(FlexBox, {
shouldForwardProp: (prop) => prop !== "count",
})(({ theme, count }) =>
theme.unstable_sx({
color: count > 8 ? theme.palette.warning.main : theme.palette.primary.main,
fontWeight: count > 5 ? "bold" : "normal",
padding: 2,
})
);
Count: 10
// Inline component pattern with custom props
interface ResetBoxProps extends FlexBoxProps {
resetFn?: () => void;
}
const ResetBox = styled(
({ resetFn, ...props }: ResetBoxProps) => (
)
)(({ theme }) => ({
maxWidth: 100,
maxHeight: 100,
cursor: "pointer",
"&:hover": {
backgroundColor: theme.palette.action.hover,
},
}));
console.log("Reset clicked")}>
Reset
```
--------------------------------
### FlexBox Mixed Responsive Array and Object Notation
Source: https://github.com/brandonscript/mui-flexy/blob/main/README.md
Illustrates the flexibility of FlexBox in mixing array and object notations for responsive props like `x`, `y`, and `row`, showing the complex equivalent MUI Box styles.
```jsx
// ...is equivalent to:
```
--------------------------------
### FlexBox Responsive Row/Column Switching with Breakpoints
Source: https://github.com/brandonscript/mui-flexy/blob/main/README.md
Shows how FlexBox handles switching `flexDirection` between 'row' and 'column' at different breakpoints using responsive object notation for the `row` prop.
```jsx
// ...is equivalent to:
```
--------------------------------
### FlexBox Flex Wrap Configuration
Source: https://github.com/brandonscript/mui-flexy/blob/main/README.md
Demonstrates how to set the `flexWrap` property in FlexBox to 'nowrap', with the corresponding MUI Box style.
```jsx
// ...is equivalent to:
```
--------------------------------
### Using Refs and Overriding Components with MUI Flexy
Source: https://context7.com/brandonscript/mui-flexy/llms.txt
Demonstrates how to use `useRef` to access FlexBox and FlexGrid DOM elements and how to override the default HTML element rendered by FlexBox using the `component` prop. It also shows how to use other MUI components as the base for FlexBox.
```tsx
import { useRef } from "react";
import { FlexBox, FlexGrid } from "@mui-flexy/v7";
import { Typography, Paper } from "@mui/material";
// Using refs
const MyComponent = () => {
const boxRef = useRef(null);
return (
Box ID: {boxRef.current?.id}
);
};
// Component override - render as different element
Inline flex span
HomeAbout
// Using MUI components
FlexBox rendered as Paper
Typography with flex display
```
--------------------------------
### Responsive FlexBox Alignment with Object Notation
Source: https://context7.com/brandonscript/mui-flexy/llms.txt
Demonstrates how to use Material UI's responsive style object notation with the 'x', 'y', and 'row' props in FlexBox. This allows for different alignments and flex directions at various screen breakpoints.
```tsx
import { FlexBox } from "@mui-flexy/v7";
import { Typography } from "@mui/material";
// Responsive alignment using breakpoint object notation
Responsive alignment
// Responsive direction change with automatic alignment recalculation
// mui-flexy handles the complex CSS mapping when direction changes
{/* row on xs/sm, column on md+ */}
Direction-aware responsive layout
// The above generates the complex CSS equivalent:
//
```
--------------------------------
### Updating Imports for mui-flexy v2.0.0+
Source: https://github.com/brandonscript/mui-flexy/blob/main/README.md
Shows the change in import paths required after version 2.0.0 of mui-flexy, moving from a single package to version-specific packages.
```jsx
// Old import
import { FlexBox } from "mui-flexy";
// New import for v7
import { FlexBox } from "@mui-flexy/v7";
// New import for v6
import { FlexBox } from "@mui-flexy/v6";
// New import for v5
import { FlexBox } from "@mui-flexy/v5";
```
--------------------------------
### FlexBox Responsive Style Array for Flex Direction
Source: https://github.com/brandonscript/mui-flexy/blob/main/README.md
Demonstrates using array notation for `flexDirection` in FlexBox, allowing different directions at various breakpoints, with corresponding MUI Box styles.
```jsx
// ...is equivalent to:
```
--------------------------------
### FlexBox Component Basic Usage and Column Layout
Source: https://context7.com/brandonscript/mui-flexy/llms.txt
Demonstrates the basic usage of the FlexBox component, including centering content and aligning items in a column layout. The 'x' and 'y' props automatically map to `justifyContent` and `alignItems` based on the flex direction.
```tsx
import { FlexBox } from "@mui-flexy/v7";
import { Typography } from "@mui/material";
// Basic centering - x="center" and y="center"
// automatically resolve to justifyContent and alignItems
Centered Content
// Column layout - x and y props swap their CSS mappings automatically
Bottom-left aligned in column
// With reverse direction
Row-reverse layout
// Nowrap white-space handling
No text wrapping
```
--------------------------------
### FlexBox Row vs. Column Orientation Switching
Source: https://github.com/brandonscript/mui-flexy/blob/main/README.md
Illustrates the difference in layout when switching between `row` and `column` props on FlexBox, showing the corresponding MUI Box styles.
```jsx
<>
>
// ...is equivalent to:
<>
>
```
--------------------------------
### FlexBox Row/Column Orientation Equivalent
Source: https://github.com/brandonscript/mui-flexy/blob/main/README.md
Demonstrates how the `row` prop on FlexBox is equivalent to setting `flexDirection: 'row'` in MUI's Box component, along with centering content.
```jsx
// ...is equivalent to:
```
--------------------------------
### Theme Integration with unstable_sx in MUI Flexy
Source: https://context7.com/brandonscript/mui-flexy/llms.txt
Explains how to leverage `theme.unstable_sx` within styled MUI Flexy components for accessing theme properties like spacing, breakpoints, and palette colors. This allows for responsive design and conditional styling based on theme values.
```tsx
import { styled } from "@mui/material/styles";
import { FlexBox } from "@mui-flexy/v7";
const ThemedFlexBox = styled(FlexBox)(({ theme }) =>
theme.unstable_sx({
backgroundColor: "primary.light",
borderRadius: 2, // theme.shape.borderRadius * 2
px: 3, // theme.spacing(3) horizontal padding
py: 2, // theme.spacing(2) vertical padding
gap: 2, // theme.spacing(2) gap between children
minHeight: { xs: 100, md: 200 }, // responsive minHeight
width: { xs: "100%", md: "50%" }, // responsive width
})
);
Left contentRight content
// Combining with theme palette conditionally
const StatusBox = styled(FlexBox)<{ status: "success" | "error" | "warning" }>(
({ theme, status }) =>
theme.unstable_sx({
backgroundColor: `${status}.light`,
color: `${status}.contrastText`,
borderLeft: 4,
borderColor: `${status}.main`,
p: 2,
})
);
Operation successful
```
--------------------------------
### SSR Emotion Cache for MUI
Source: https://github.com/brandonscript/mui-flexy/blob/main/README.md
Provides a solution for avoiding hydration errors in SSR frameworks like Next.js by using an Emotion cache. This ensures consistent styling between server-rendered and client-rendered applications.
```jsx
import { CacheProvider } from "@emotion/react";
import createCache from "@emotion/cache";
const cache = createCache({ key: "my-app-css" });
const App = () => (
);
```
--------------------------------
### Responsive Alignment with Array Notation in FlexBox (TSX)
Source: https://context7.com/brandonscript/mui-flexy/llms.txt
Demonstrates using FlexBox with MUI's responsive array notation for alignment properties (x, y) and direction (flexDirection). Each index in the array corresponds to a breakpoint (xs, sm, md, lg, xl). This allows for dynamic alignment changes across different screen sizes.
```tsx
import { FlexBox } from "@mui-flexy/v7";
// Array notation: [xs, sm, md, lg, xl]
Content shifts alignment at breakpoints
// Mixed direction with array alignment
Item 1
Item 2
// Complex responsive with direction change
Adapts alignment based on direction at each breakpoint
```
--------------------------------
### FlexBox Reverse Row Direction
Source: https://github.com/brandonscript/mui-flexy/blob/main/README.md
Shows how to use the `reverse` prop with `row` in FlexBox to achieve a `flex-direction: 'row-reverse'`, with its MUI Box equivalent.
```jsx
// ...is equivalent to:
```
--------------------------------
### FlexBox Row/Column Switch with Specific Breakpoints
Source: https://github.com/brandonscript/mui-flexy/blob/main/README.md
Demonstrates a FlexBox configuration where `flexDirection` switches from 'row' to 'column' at the 'md' breakpoint, with corresponding MUI Box styles.
```jsx
// ...is equivalent to:
```
--------------------------------
### FlexBox Alignment Props Mapping
Source: https://context7.com/brandonscript/mui-flexy/llms.txt
Illustrates how semantic alignment values for 'x' and 'y' props map to standard CSS flexbox properties. It also shows how these mappings change when the flex direction is set to 'column'.
```tsx
import { FlexBox } from "@mui-flexy/v7";
// Semantic alignment values
{/* flex-start, flex-start */}
{/* flex-end, flex-end */}
{/* center, center */}
{/* space-between, stretch */}
// Column mode - x controls alignItems, y controls justifyContent
Item 1
Item 2
Item 3
// Equivalent vanilla MUI (column mode):
//
```
--------------------------------
### Styled Component with shouldForwardProp
Source: https://github.com/brandonscript/mui-flexy/blob/main/README.md
Illustrates creating a styled FlexBox component that conditionally forwards props. The `shouldForwardProp` option prevents the 'count' prop from being passed down to the DOM element, while still allowing it to be used for styling via TypeScript generics and theme injection.
```jsx
const CountBox =
styled(FlexBox, {
shouldForwardProp: (prop) => !["count"].includes(String(prop)),
}) <
{ count: number } >
(({ theme, count }) =>
theme.unstable_sx({
color: (theme) => (count > 8 ? theme.palette.primary.warning : theme.palette.primary.main),
}));
```
--------------------------------
### FlexRowBox and FlexColumnBox Variants (TSX)
Source: https://context7.com/brandonscript/mui-flexy/llms.txt
Introduces FlexRowBox and FlexColumnBox as pre-configured FlexBox variants with fixed orientations. These components offer improved TypeScript inference and a simpler API when the layout orientation is known beforehand. They are equivalent to using FlexBox with explicit 'row' or 'column' props.
```tsx
import { FlexBox, FlexRowBox, FlexColumnBox } from "@mui-flexy/v7";
// FlexRowBox - always row orientation, x/y types are constrained
// FlexColumnBox - always column orientation
Top
Middle
Bottom
// Equivalent to FlexBox with explicit orientation
......
```
=== COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.