@redis-ui/components 50.0.2 → 51.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,6 +14,6 @@ var FlexGroup = (0, styled_components.default)(require_FlexItem.FlexItem).withCo
14
14
  ";flex-direction:",
15
15
  ";gap:",
16
16
  ";"
17
- ], ({ $wrap }) => $wrap ? "wrap" : "nowrap", ({ $align }) => $align, ({ $justify }) => $justify, (props) => props["data-flex-direction"], ({ $gap }) => (0, _redislabsdev_redis_ui_styles.useTheme)().components.layouts.flexGroup.gap[$gap] ?? $gap);
17
+ ], ({ $wrap }) => $wrap ? "wrap" : "nowrap", ({ $align }) => $align, ({ $justify }) => $justify, (props) => props["data-flex-direction"], ({ $gap }) => (0, _redislabsdev_redis_ui_styles.useTheme)().components.layouts.gap[$gap] ?? $gap);
18
18
  //#endregion
19
19
  exports.FlexGroup = FlexGroup;
@@ -1,6 +1,6 @@
1
- import { FlexAlign } from '../FlexItem/FlexItem.types';
1
+ import { FlexAlign } from '../layout.types';
2
2
  import { FlexDirection, FlexGroupGapSize, FlexJustify } from './FlexGroup.types';
3
- export declare const FlexGroup: import("styled-components").StyledComponent<({ flex, selfAlign, component, ...restProps }: import("..").FlexItemProps) => import("react/jsx-runtime").JSX.Element, any, {
3
+ export declare const FlexGroup: import("styled-components").StyledComponent<({ flex, selfAlign, component, padding, paddingInline, paddingBlock, margin, marginInline, marginBlock, width, minWidth, maxWidth, height, minHeight, maxHeight, ...restProps }: import("..").FlexItemProps) => import("react/jsx-runtime").JSX.Element, any, {
4
4
  $gap: FlexGroupGapSize;
5
5
  $align: FlexAlign;
6
6
  $justify?: FlexJustify;
@@ -12,6 +12,6 @@ var FlexGroup = _styled(FlexItem).withConfig({
12
12
  ";flex-direction:",
13
13
  ";gap:",
14
14
  ";"
15
- ], ({ $wrap }) => $wrap ? "wrap" : "nowrap", ({ $align }) => $align, ({ $justify }) => $justify, (props) => props["data-flex-direction"], ({ $gap }) => useTheme().components.layouts.flexGroup.gap[$gap] ?? $gap);
15
+ ], ({ $wrap }) => $wrap ? "wrap" : "nowrap", ({ $align }) => $align, ({ $justify }) => $justify, (props) => props["data-flex-direction"], ({ $gap }) => useTheme().components.layouts.gap[$gap] ?? $gap);
16
16
  //#endregion
17
17
  export { FlexGroup };
@@ -1,9 +1,13 @@
1
- import { AnyOtherString } from '../../Helpers';
2
- import { FlexAlign, OwnFlexItemProps, RestFlexItemProps } from '../FlexItem/FlexItem.types';
1
+ import { AnyOtherString, ComposeElementProps } from '../../Helpers';
2
+ import { BoxProps, FlexAlign, FlexFlex } from '../layout.types';
3
3
  export type FlexGroupGapSize = 'XXS' | 'XS' | 'S' | 'M' | 'L' | 'XL' | 'XXL' | AnyOtherString;
4
4
  export type FlexDirection = 'column' | 'row' | 'column-reverse' | 'row-reverse';
5
5
  export type FlexJustify = 'start' | 'end' | 'center' | 'space-between' | 'space-around' | 'space-evenly';
6
- export type OwnFlexGroupProps = OwnFlexItemProps & {
6
+ export type OwnFlexGroupProps = BoxProps & {
7
+ /** Flex grow/shrink/basis value (when this group is itself a flex child) */
8
+ flex?: FlexFlex;
9
+ /** Align self in the parent flex/grid container along its cross axis */
10
+ selfAlign?: FlexAlign;
7
11
  /** Gap size between items. Supports predefined T-Shirt sizes and free text for applying values from theme */
8
12
  gap?: FlexGroupGapSize;
9
13
  /** Flex direction */
@@ -15,5 +19,5 @@ export type OwnFlexGroupProps = OwnFlexItemProps & {
15
19
  /** Whether items should wrap to new lines */
16
20
  wrap?: boolean;
17
21
  };
18
- export type RestFlexGroupProps = RestFlexItemProps;
22
+ export type RestFlexGroupProps = ComposeElementProps;
19
23
  export type FlexGroupProps = OwnFlexGroupProps & RestFlexGroupProps;
@@ -1,11 +1,23 @@
1
1
  const require_FlexItem_style = require("./FlexItem.style.cjs");
2
2
  let react_jsx_runtime = require("react/jsx-runtime");
3
3
  //#region src/Layouts/FlexItem/FlexItem.tsx
4
- var FlexItem = ({ flex, selfAlign, component, ...restProps }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_FlexItem_style.FlexItem, {
4
+ var FlexItem = ({ flex, selfAlign, component, padding, paddingInline, paddingBlock, margin, marginInline, marginBlock, width, minWidth, maxWidth, height, minHeight, maxHeight, ...restProps }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_FlexItem_style.FlexItem, {
5
5
  ...restProps,
6
6
  $flex: flex,
7
7
  $selfAlign: selfAlign,
8
- as: component
8
+ as: component,
9
+ $padding: padding,
10
+ $paddingInline: paddingInline,
11
+ $paddingBlock: paddingBlock,
12
+ $margin: margin,
13
+ $marginInline: marginInline,
14
+ $marginBlock: marginBlock,
15
+ $width: width,
16
+ $minWidth: minWidth,
17
+ $maxWidth: maxWidth,
18
+ $height: height,
19
+ $minHeight: minHeight,
20
+ $maxHeight: maxHeight
9
21
  });
10
22
  //#endregion
11
23
  exports.FlexItem = FlexItem;
@@ -1,2 +1,2 @@
1
1
  import { FlexItemProps } from './FlexItem.types';
2
- export declare const FlexItem: ({ flex, selfAlign, component, ...restProps }: FlexItemProps) => import("react/jsx-runtime").JSX.Element;
2
+ export declare const FlexItem: ({ flex, selfAlign, component, padding, paddingInline, paddingBlock, margin, marginInline, marginBlock, width, minWidth, maxWidth, height, minHeight, maxHeight, ...restProps }: FlexItemProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,11 +1,23 @@
1
1
  import { FlexItem as FlexItem$1 } from "./FlexItem.style.js";
2
2
  import { jsx } from "react/jsx-runtime";
3
3
  //#region src/Layouts/FlexItem/FlexItem.tsx
4
- var FlexItem = ({ flex, selfAlign, component, ...restProps }) => /* @__PURE__ */ jsx(FlexItem$1, {
4
+ var FlexItem = ({ flex, selfAlign, component, padding, paddingInline, paddingBlock, margin, marginInline, marginBlock, width, minWidth, maxWidth, height, minHeight, maxHeight, ...restProps }) => /* @__PURE__ */ jsx(FlexItem$1, {
5
5
  ...restProps,
6
6
  $flex: flex,
7
7
  $selfAlign: selfAlign,
8
- as: component
8
+ as: component,
9
+ $padding: padding,
10
+ $paddingInline: paddingInline,
11
+ $paddingBlock: paddingBlock,
12
+ $margin: margin,
13
+ $marginInline: marginInline,
14
+ $marginBlock: marginBlock,
15
+ $width: width,
16
+ $minWidth: minWidth,
17
+ $maxWidth: maxWidth,
18
+ $height: height,
19
+ $minHeight: minHeight,
20
+ $maxHeight: maxHeight
9
21
  });
10
22
  //#endregion
11
23
  export { FlexItem };
@@ -1,14 +1,42 @@
1
1
  const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
2
2
  let styled_components = require("styled-components");
3
3
  styled_components = require_runtime.__toESM(styled_components, 1);
4
+ let _redislabsdev_redis_ui_styles = require("@redis-ui/styles");
4
5
  //#region src/Layouts/FlexItem/FlexItem.style.ts
6
+ /**
7
+ * Resolves a spacing prop value against the given theme spacing scale:
8
+ * predefined T-Shirt sizes map to the scale (`gap`/`padding`/`margin` each
9
+ * have their own); any other string (`'auto'`, `'0'`, `'1.6rem'`,
10
+ * `'1.6rem 2.4rem'`, ...) is returned verbatim as CSS.
11
+ */
12
+ var resolveSpacing = (scale, value) => value == null ? void 0 : scale[value] ?? value;
13
+ /** Emits a CSS declaration only when the value is set, so unused props add no CSS. */
14
+ var decl = (property, value) => value == null || value === "" ? "" : `${property}: ${value};`;
5
15
  var FlexItem = styled_components.default.div.withConfig({
6
16
  displayName: "FlexItemstyle__FlexItem",
7
17
  componentId: "RedisUI__sc-sfog54-0"
8
18
  })([
9
- "flex:",
10
- ";align-self:",
11
- ";"
12
- ], ({ $flex }) => $flex, ({ $selfAlign }) => $selfAlign);
19
+ "",
20
+ " ",
21
+ " ",
22
+ " ",
23
+ " ",
24
+ " ",
25
+ " ",
26
+ " ",
27
+ " ",
28
+ ""
29
+ ], ({ $flex }) => decl("flex", $flex), ({ $selfAlign }) => decl("align-self", $selfAlign), (props) => {
30
+ const { padding, margin } = (0, _redislabsdev_redis_ui_styles.useTheme)().components.layouts;
31
+ return [
32
+ decl("padding", resolveSpacing(padding, props.$padding)),
33
+ decl("padding-inline", resolveSpacing(padding, props.$paddingInline)),
34
+ decl("padding-block", resolveSpacing(padding, props.$paddingBlock)),
35
+ decl("margin", resolveSpacing(margin, props.$margin)),
36
+ decl("margin-inline", resolveSpacing(margin, props.$marginInline)),
37
+ decl("margin-block", resolveSpacing(margin, props.$marginBlock))
38
+ ].join("");
39
+ }, ({ $width }) => decl("width", $width), ({ $minWidth }) => decl("min-width", $minWidth), ({ $maxWidth }) => decl("max-width", $maxWidth), ({ $height }) => decl("height", $height), ({ $minHeight }) => decl("min-height", $minHeight), ({ $maxHeight }) => decl("max-height", $maxHeight));
13
40
  //#endregion
14
41
  exports.FlexItem = FlexItem;
42
+ exports.resolveSpacing = resolveSpacing;
@@ -1,5 +1,24 @@
1
- import { FlexAlign, FlexFlex } from './FlexItem.types';
1
+ import { FlexAlign, FlexFlex } from '../layout.types';
2
+ /**
3
+ * Resolves a spacing prop value against the given theme spacing scale:
4
+ * predefined T-Shirt sizes map to the scale (`gap`/`padding`/`margin` each
5
+ * have their own); any other string (`'auto'`, `'0'`, `'1.6rem'`,
6
+ * `'1.6rem 2.4rem'`, ...) is returned verbatim as CSS.
7
+ */
8
+ export declare const resolveSpacing: (scale: Record<string, string>, value?: string) => string | undefined;
2
9
  export declare const FlexItem: import("styled-components").StyledComponent<"div", any, {
3
10
  $selfAlign?: FlexAlign;
4
11
  $flex?: FlexFlex;
12
+ $padding?: string;
13
+ $paddingInline?: string;
14
+ $paddingBlock?: string;
15
+ $margin?: string;
16
+ $marginInline?: string;
17
+ $marginBlock?: string;
18
+ $width?: string;
19
+ $minWidth?: string;
20
+ $maxWidth?: string;
21
+ $height?: string;
22
+ $minHeight?: string;
23
+ $maxHeight?: string;
5
24
  }, never>;
@@ -1,12 +1,39 @@
1
1
  import _styled from "styled-components";
2
+ import { useTheme } from "@redis-ui/styles";
2
3
  //#region src/Layouts/FlexItem/FlexItem.style.ts
4
+ /**
5
+ * Resolves a spacing prop value against the given theme spacing scale:
6
+ * predefined T-Shirt sizes map to the scale (`gap`/`padding`/`margin` each
7
+ * have their own); any other string (`'auto'`, `'0'`, `'1.6rem'`,
8
+ * `'1.6rem 2.4rem'`, ...) is returned verbatim as CSS.
9
+ */
10
+ var resolveSpacing = (scale, value) => value == null ? void 0 : scale[value] ?? value;
11
+ /** Emits a CSS declaration only when the value is set, so unused props add no CSS. */
12
+ var decl = (property, value) => value == null || value === "" ? "" : `${property}: ${value};`;
3
13
  var FlexItem = _styled.div.withConfig({
4
14
  displayName: "FlexItemstyle__FlexItem",
5
15
  componentId: "RedisUI__sc-sfog54-0"
6
16
  })([
7
- "flex:",
8
- ";align-self:",
9
- ";"
10
- ], ({ $flex }) => $flex, ({ $selfAlign }) => $selfAlign);
17
+ "",
18
+ " ",
19
+ " ",
20
+ " ",
21
+ " ",
22
+ " ",
23
+ " ",
24
+ " ",
25
+ " ",
26
+ ""
27
+ ], ({ $flex }) => decl("flex", $flex), ({ $selfAlign }) => decl("align-self", $selfAlign), (props) => {
28
+ const { padding, margin } = useTheme().components.layouts;
29
+ return [
30
+ decl("padding", resolveSpacing(padding, props.$padding)),
31
+ decl("padding-inline", resolveSpacing(padding, props.$paddingInline)),
32
+ decl("padding-block", resolveSpacing(padding, props.$paddingBlock)),
33
+ decl("margin", resolveSpacing(margin, props.$margin)),
34
+ decl("margin-inline", resolveSpacing(margin, props.$marginInline)),
35
+ decl("margin-block", resolveSpacing(margin, props.$marginBlock))
36
+ ].join("");
37
+ }, ({ $width }) => decl("width", $width), ({ $minWidth }) => decl("min-width", $minWidth), ({ $maxWidth }) => decl("max-width", $maxWidth), ({ $height }) => decl("height", $height), ({ $minHeight }) => decl("min-height", $minHeight), ({ $maxHeight }) => decl("max-height", $maxHeight));
11
38
  //#endregion
12
- export { FlexItem };
39
+ export { FlexItem, resolveSpacing };
@@ -1,14 +1,10 @@
1
- import { ComponentType } from 'react';
2
- import { AnyOtherString, ComposeElementProps } from '../../Helpers';
3
- export type FlexAlign = 'start' | 'end' | 'center' | 'stretch';
4
- export type FlexFlex = 'auto' | 'none' | AnyOtherString;
5
- export type OwnFlexItemProps = {
1
+ import { ComposeElementProps } from '../../Helpers';
2
+ import { BoxProps, FlexAlign, FlexFlex } from '../layout.types';
3
+ export type OwnFlexItemProps = BoxProps & {
6
4
  /** Flex grow/shrink/basis value */
7
5
  flex?: FlexFlex;
8
- /** Align self in parent flex container along the cross axis of the parent flex */
6
+ /** Align self in the parent flex/grid container along its cross axis */
9
7
  selfAlign?: FlexAlign;
10
- /** Use different component with Flex styling, default is `div` */
11
- component?: string | ComponentType;
12
8
  };
13
9
  export type RestFlexItemProps = ComposeElementProps;
14
10
  export type FlexItemProps = OwnFlexItemProps & RestFlexItemProps;
@@ -0,0 +1,23 @@
1
+ const require_Grid_style = require("./Grid.style.cjs");
2
+ let react_jsx_runtime = require("react/jsx-runtime");
3
+ //#region src/Layouts/Grid/Grid.tsx
4
+ var Grid = ({ columns, rows, areas, gap = "S", columnGap, rowGap, align, justify, autoFlow, autoRows, autoColumns, inline, gridColumn, gridRow, gridArea, ...restProps }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Grid_style.Grid, {
5
+ ...restProps,
6
+ $columns: columns,
7
+ $rows: rows,
8
+ $areas: areas,
9
+ $gap: gap,
10
+ $columnGap: columnGap,
11
+ $rowGap: rowGap,
12
+ $align: align,
13
+ $justify: justify,
14
+ $autoFlow: autoFlow,
15
+ $autoRows: autoRows,
16
+ $autoColumns: autoColumns,
17
+ $inline: inline,
18
+ $gridColumn: gridColumn,
19
+ $gridRow: gridRow,
20
+ $gridArea: gridArea
21
+ });
22
+ //#endregion
23
+ exports.Grid = Grid;
@@ -0,0 +1,2 @@
1
+ import { GridProps } from './Grid.types';
2
+ export declare const Grid: ({ columns, rows, areas, gap, columnGap, rowGap, align, justify, autoFlow, autoRows, autoColumns, inline, gridColumn, gridRow, gridArea, ...restProps }: GridProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,23 @@
1
+ import { Grid as Grid$1 } from "./Grid.style.js";
2
+ import { jsx } from "react/jsx-runtime";
3
+ //#region src/Layouts/Grid/Grid.tsx
4
+ var Grid = ({ columns, rows, areas, gap = "S", columnGap, rowGap, align, justify, autoFlow, autoRows, autoColumns, inline, gridColumn, gridRow, gridArea, ...restProps }) => /* @__PURE__ */ jsx(Grid$1, {
5
+ ...restProps,
6
+ $columns: columns,
7
+ $rows: rows,
8
+ $areas: areas,
9
+ $gap: gap,
10
+ $columnGap: columnGap,
11
+ $rowGap: rowGap,
12
+ $align: align,
13
+ $justify: justify,
14
+ $autoFlow: autoFlow,
15
+ $autoRows: autoRows,
16
+ $autoColumns: autoColumns,
17
+ $inline: inline,
18
+ $gridColumn: gridColumn,
19
+ $gridRow: gridRow,
20
+ $gridArea: gridArea
21
+ });
22
+ //#endregion
23
+ export { Grid };
@@ -0,0 +1,36 @@
1
+ const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
2
+ const require_FlexItem_style = require("../FlexItem/FlexItem.style.cjs");
3
+ const require_FlexItem = require("../FlexItem/FlexItem.cjs");
4
+ let styled_components = require("styled-components");
5
+ styled_components = require_runtime.__toESM(styled_components, 1);
6
+ let _redislabsdev_redis_ui_styles = require("@redis-ui/styles");
7
+ //#region src/Layouts/Grid/Grid.style.ts
8
+ var decl = (property, value) => value == null || value === "" ? "" : `${property}: ${value};`;
9
+ var Grid = (0, styled_components.default)(require_FlexItem.FlexItem).withConfig({
10
+ displayName: "Gridstyle__Grid",
11
+ componentId: "RedisUI__sc-g580qm-0"
12
+ })([
13
+ "display:",
14
+ ";",
15
+ " ",
16
+ " ",
17
+ " ",
18
+ " ",
19
+ " ",
20
+ " ",
21
+ " ",
22
+ " ",
23
+ " ",
24
+ " ",
25
+ " ",
26
+ ""
27
+ ], ({ $inline }) => $inline ? "inline-grid" : "grid", ({ $columns }) => decl("grid-template-columns", $columns), ({ $rows }) => decl("grid-template-rows", $rows), ({ $areas }) => decl("grid-template-areas", $areas), ({ $autoFlow }) => decl("grid-auto-flow", $autoFlow), ({ $autoRows }) => decl("grid-auto-rows", $autoRows), ({ $autoColumns }) => decl("grid-auto-columns", $autoColumns), ({ $align }) => decl("align-items", $align), ({ $justify }) => decl("justify-items", $justify), ({ $gridColumn }) => decl("grid-column", $gridColumn), ({ $gridRow }) => decl("grid-row", $gridRow), ({ $gridArea }) => decl("grid-area", $gridArea), (props) => {
28
+ const gap = (0, _redislabsdev_redis_ui_styles.useTheme)().components.layouts.gap;
29
+ return [
30
+ decl("gap", require_FlexItem_style.resolveSpacing(gap, props.$gap)),
31
+ decl("column-gap", require_FlexItem_style.resolveSpacing(gap, props.$columnGap)),
32
+ decl("row-gap", require_FlexItem_style.resolveSpacing(gap, props.$rowGap))
33
+ ].join("");
34
+ });
35
+ //#endregion
36
+ exports.Grid = Grid;
@@ -0,0 +1,19 @@
1
+ import { FlexAlign, SpacingSize } from '../layout.types';
2
+ import { GridAutoFlow, GridJustifyItems } from './Grid.types';
3
+ export declare const Grid: import("styled-components").StyledComponent<({ flex, selfAlign, component, padding, paddingInline, paddingBlock, margin, marginInline, marginBlock, width, minWidth, maxWidth, height, minHeight, maxHeight, ...restProps }: import("..").FlexItemProps) => import("react/jsx-runtime").JSX.Element, any, {
4
+ $columns?: string;
5
+ $rows?: string;
6
+ $areas?: string;
7
+ $gap?: SpacingSize;
8
+ $columnGap?: SpacingSize;
9
+ $rowGap?: SpacingSize;
10
+ $align?: FlexAlign;
11
+ $justify?: GridJustifyItems;
12
+ $autoFlow?: GridAutoFlow;
13
+ $autoRows?: string;
14
+ $autoColumns?: string;
15
+ $inline?: boolean;
16
+ $gridColumn?: string;
17
+ $gridRow?: string;
18
+ $gridArea?: string;
19
+ }, never>;
@@ -0,0 +1,34 @@
1
+ import { resolveSpacing } from "../FlexItem/FlexItem.style.js";
2
+ import { FlexItem } from "../FlexItem/FlexItem.js";
3
+ import _styled from "styled-components";
4
+ import { useTheme } from "@redis-ui/styles";
5
+ //#region src/Layouts/Grid/Grid.style.ts
6
+ var decl = (property, value) => value == null || value === "" ? "" : `${property}: ${value};`;
7
+ var Grid = _styled(FlexItem).withConfig({
8
+ displayName: "Gridstyle__Grid",
9
+ componentId: "RedisUI__sc-g580qm-0"
10
+ })([
11
+ "display:",
12
+ ";",
13
+ " ",
14
+ " ",
15
+ " ",
16
+ " ",
17
+ " ",
18
+ " ",
19
+ " ",
20
+ " ",
21
+ " ",
22
+ " ",
23
+ " ",
24
+ ""
25
+ ], ({ $inline }) => $inline ? "inline-grid" : "grid", ({ $columns }) => decl("grid-template-columns", $columns), ({ $rows }) => decl("grid-template-rows", $rows), ({ $areas }) => decl("grid-template-areas", $areas), ({ $autoFlow }) => decl("grid-auto-flow", $autoFlow), ({ $autoRows }) => decl("grid-auto-rows", $autoRows), ({ $autoColumns }) => decl("grid-auto-columns", $autoColumns), ({ $align }) => decl("align-items", $align), ({ $justify }) => decl("justify-items", $justify), ({ $gridColumn }) => decl("grid-column", $gridColumn), ({ $gridRow }) => decl("grid-row", $gridRow), ({ $gridArea }) => decl("grid-area", $gridArea), (props) => {
26
+ const gap = useTheme().components.layouts.gap;
27
+ return [
28
+ decl("gap", resolveSpacing(gap, props.$gap)),
29
+ decl("column-gap", resolveSpacing(gap, props.$columnGap)),
30
+ decl("row-gap", resolveSpacing(gap, props.$rowGap))
31
+ ].join("");
32
+ });
33
+ //#endregion
34
+ export { Grid };
@@ -0,0 +1,38 @@
1
+ import { AnyOtherString, ComposeElementProps } from '../../Helpers';
2
+ import { BoxProps, FlexAlign, SpacingSize } from '../layout.types';
3
+ export type GridJustifyItems = 'start' | 'end' | 'center' | 'stretch';
4
+ export type GridAutoFlow = 'row' | 'column' | 'row dense' | 'column dense' | AnyOtherString;
5
+ export type OwnGridProps = BoxProps & {
6
+ /** grid-template-columns, e.g. `'1fr 1fr'`, `'2fr 1fr'`, `'repeat(3, minmax(0, 1fr))'` */
7
+ columns?: string;
8
+ /** grid-template-rows */
9
+ rows?: string;
10
+ /** grid-template-areas */
11
+ areas?: string;
12
+ /** Gap between cells. Predefined T-Shirt sizes map to the theme scale, or free CSS value. */
13
+ gap?: SpacingSize;
14
+ /** Column gap. Overrides `gap` on the inline axis. */
15
+ columnGap?: SpacingSize;
16
+ /** Row gap. Overrides `gap` on the block axis. */
17
+ rowGap?: SpacingSize;
18
+ /** align-items — aligns cell content along the block (column) axis */
19
+ align?: FlexAlign;
20
+ /** justify-items — aligns cell content along the inline (row) axis */
21
+ justify?: GridJustifyItems;
22
+ /** grid-auto-flow */
23
+ autoFlow?: GridAutoFlow;
24
+ /** grid-auto-rows */
25
+ autoRows?: string;
26
+ /** grid-auto-columns */
27
+ autoColumns?: string;
28
+ /** Use `inline-grid` instead of `grid` */
29
+ inline?: boolean;
30
+ /** grid-column placement, for when this Grid is itself a child of another Grid (e.g. `'1 / 3'`, `'span 2'`). */
31
+ gridColumn?: AnyOtherString;
32
+ /** grid-row placement, for when this Grid is itself a child of another Grid. */
33
+ gridRow?: AnyOtherString;
34
+ /** grid-area placement, for when this Grid is itself a child of another Grid. */
35
+ gridArea?: AnyOtherString;
36
+ };
37
+ export type RestGridProps = ComposeElementProps;
38
+ export type GridProps = OwnGridProps & RestGridProps;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,7 +1,10 @@
1
+ export * from './layout.types';
1
2
  export * from './FlexItem/FlexItem';
2
3
  export * from './FlexItem/FlexItem.types';
3
4
  export * from './FlexGroup/FlexGroup';
4
5
  export * from './FlexGroup/FlexGroup.types';
6
+ export * from './Grid/Grid';
7
+ export * from './Grid/Grid.types';
5
8
  export * from './FlexSplit/FlexSplit';
6
9
  export * from './FlexSplit/FlexSplit.types';
7
10
  export * from './FlexDivider/FlexDivider';
@@ -1,7 +1,10 @@
1
+ export * from './layout.types';
1
2
  export * from './FlexItem/FlexItem';
2
3
  export * from './FlexItem/FlexItem.types';
3
4
  export * from './FlexGroup/FlexGroup';
4
5
  export * from './FlexGroup/FlexGroup.types';
6
+ export * from './Grid/Grid';
7
+ export * from './Grid/Grid.types';
5
8
  export * from './FlexSplit/FlexSplit';
6
9
  export * from './FlexSplit/FlexSplit.types';
7
10
  export * from './FlexDivider/FlexDivider';
@@ -0,0 +1,43 @@
1
+ import { ComponentType } from 'react';
2
+ import { AnyOtherString } from '../Helpers';
3
+ export type FlexAlign = 'start' | 'end' | 'center' | 'stretch' | 'baseline';
4
+ export type FlexFlex = 'auto' | 'none' | AnyOtherString;
5
+ /**
6
+ * Spacing value. Predefined T-Shirt sizes map to the theme spacing scale; any other string is
7
+ * applied verbatim as CSS, so `'auto'`, `'0'`, `'1.6rem'` or `'1.6rem 2.4rem'` are all valid.
8
+ */
9
+ export type SpacingSize = 'XXS' | 'XS' | 'S' | 'M' | 'L' | 'XL' | 'XXL' | AnyOtherString;
10
+ /** Sizing value, applied verbatim as a CSS dimension, e.g. `'100%'`, `'22rem'`, `'0'`. */
11
+ export type SizingValue = AnyOtherString;
12
+ /**
13
+ * Box-model props relevant to any layout box. Intentionally holds ONLY universal box concerns
14
+ * (element/spacing/sizing) — no flex- or grid-specific props — so no layout mode leaks into another.
15
+ */
16
+ export type BoxProps = {
17
+ /** Use a different element/component with layout styling, default is `div`. */
18
+ component?: string | ComponentType;
19
+ /** Padding on all sides. */
20
+ padding?: SpacingSize;
21
+ /** Inline (left/right) padding. */
22
+ paddingInline?: SpacingSize;
23
+ /** Block (top/bottom) padding. */
24
+ paddingBlock?: SpacingSize;
25
+ /** Margin on all sides. */
26
+ margin?: SpacingSize;
27
+ /** Inline (left/right) margin. */
28
+ marginInline?: SpacingSize;
29
+ /** Block (top/bottom) margin. */
30
+ marginBlock?: SpacingSize;
31
+ /** Width, e.g. `'100%'`, `'22rem'`. */
32
+ width?: SizingValue;
33
+ /** Min width, e.g. `'0'`. */
34
+ minWidth?: SizingValue;
35
+ /** Max width. */
36
+ maxWidth?: SizingValue;
37
+ /** Height, e.g. `'100%'`. */
38
+ height?: SizingValue;
39
+ /** Min height. */
40
+ minHeight?: SizingValue;
41
+ /** Max height. */
42
+ maxHeight?: SizingValue;
43
+ };
@@ -0,0 +1 @@
1
+ export {};
package/dist/index.cjs CHANGED
@@ -79,6 +79,7 @@ const require_KeyValueList = require("./KeyValueList/KeyValueList.cjs");
79
79
  const require_useKeyValueList = require("./KeyValueList/hooks/useKeyValueList.cjs");
80
80
  const require_FlexItem = require("./Layouts/FlexItem/FlexItem.cjs");
81
81
  const require_FlexGroup = require("./Layouts/FlexGroup/FlexGroup.cjs");
82
+ const require_Grid = require("./Layouts/Grid/Grid.cjs");
82
83
  const require_FlexSplit = require("./Layouts/FlexSplit/FlexSplit.cjs");
83
84
  const require_FlexDivider = require("./Layouts/FlexDivider/FlexDivider.cjs");
84
85
  const require_Tabs = require("./Tabs/Tabs.cjs");
@@ -179,6 +180,7 @@ exports.FlexGroup = require_FlexGroup.FlexGroup;
179
180
  exports.FlexItem = require_FlexItem.FlexItem;
180
181
  exports.FlexSplit = require_FlexSplit.FlexSplit;
181
182
  exports.FormField = require_FormField.default;
183
+ exports.Grid = require_Grid.Grid;
182
184
  exports.HighlightedIcon = require_HighlightedIcon.default;
183
185
  Object.defineProperty(exports, "HighlightedIconStyles", {
184
186
  enumerable: true,
package/dist/index.js CHANGED
@@ -79,6 +79,7 @@ import { KeyValueList } from "./KeyValueList/KeyValueList.js";
79
79
  import { useKeyValueList } from "./KeyValueList/hooks/useKeyValueList.js";
80
80
  import { FlexItem } from "./Layouts/FlexItem/FlexItem.js";
81
81
  import { FlexGroup } from "./Layouts/FlexGroup/FlexGroup.js";
82
+ import { Grid } from "./Layouts/Grid/Grid.js";
82
83
  import { FlexSplit } from "./Layouts/FlexSplit/FlexSplit.js";
83
84
  import { FlexDivider } from "./Layouts/FlexDivider/FlexDivider.js";
84
85
  import Tabs from "./Tabs/Tabs.js";
@@ -111,4 +112,4 @@ import { ProgressBar } from "./ProgressBar/ProgressBar.js";
111
112
  import { ProfileIcon_style_exports } from "./ProfileIcon/ProfileIcon.style.js";
112
113
  import ProfileIcon from "./ProfileIcon/ProfileIcon.js";
113
114
  import Slider from "./Slider/Slider.js";
114
- export { ActionIconButton_style_exports as ActionButtonWithIconStyles, ActionIconButton, AppBar, AppBar_style_exports as AppBarStyles, AppSelectionMenu, AutoCompleteSelect, Badge, Badge_style_exports as BadgeStyles, Banner, BoxSelectionGroup, Breadcrumbs, Button, ButtonGroup, Button_style_exports as ButtonStyles, IconButton_style_exports as ButtonWithIconStyles, Card, CategoryValueList, Checkbox, Chip, ChipContainer, ChipList, ContextProvider, CopyToClipboardButton, CountryFlag, Drawer, ErrorContentProvider, FieldAdditionTextIdProvider, FieldAdditionTextIdTransProvider, FieldDisabledProvider, FieldDisabledTransProvider, FieldReadonlyProvider, FieldReadonlyTransProvider, FieldRequiredProvider, FieldRequiredTransProvider, FieldStatusProvider, FieldStatusTransProvider, Filters, FlexDivider, FlexGroup, FlexItem, FlexSplit, FormField, HighlightedIcon, HighlightedIcon_style_exports as HighlightedIconStyles, IconButton, Input, KeyValueList, Label, Link, LinkStyler, Loader, Menu, MidBar, Modal, MoreInfoIcon, MultiBoxSelectionGroup, MultiSelect, NumericInput, Overflow, Pagination, PasswordInput, Popover, PopperProvider, ProfileIcon, ProfileIcon_style_exports as ProfileIconStyles, ProgressBar, QuantityCounter, RadioGroup, RestylableElement, ScreenReaderAnnounce, SearchBar, SearchInput, Section, Select, SelfContained, SharedIdProvider, SharedIdTransProvider, SideBar, Skeleton, Slider, Stepper, StepperStepState, Switch, TableHeading, Tabs, TextArea, TextButton, TextButton_style_exports as TextButtonStyles, ThemeModeSwitch, Toast, Toaster, ToggleButton, ToggleButton_style_exports as ToggleButtonStyles, Tooltip, TooltipCard, Provider as TooltipProvider, TreeView, Typography, actionIconButtonSizes, badgeVariants, bannerVariants, buttonSizes, buttonVariants, buttonWithIconVariants, cardVariants, childrenToString, combineHandlers, createNullableContext, createPrimitiveContextState, debounce, forwardRefWithGenerics, generateId, getClosestDivisibleNumber, handlePreventDefault, handleStopPropagation, iconButtonSizes, isFragmentElement, isTextualNode, memoWithGenerics, textButtonSizes, textButtonVariants, throttle, toast, typographyColors, useEllipsisTooltip, useErrorContent, useFieldAdditionTextId, useFieldDisabled, useFieldReadonly, useFieldRequired, useFieldStatus, useGeneratedId, useInputValueApi, useInputValueProps, useKeyValueList, useMultiSelectContext, usePaginationContext, usePopperContext, useScrollable, useSelectContext, useSharedId, useThemeModeSwitch, useToastParams };
115
+ export { ActionIconButton_style_exports as ActionButtonWithIconStyles, ActionIconButton, AppBar, AppBar_style_exports as AppBarStyles, AppSelectionMenu, AutoCompleteSelect, Badge, Badge_style_exports as BadgeStyles, Banner, BoxSelectionGroup, Breadcrumbs, Button, ButtonGroup, Button_style_exports as ButtonStyles, IconButton_style_exports as ButtonWithIconStyles, Card, CategoryValueList, Checkbox, Chip, ChipContainer, ChipList, ContextProvider, CopyToClipboardButton, CountryFlag, Drawer, ErrorContentProvider, FieldAdditionTextIdProvider, FieldAdditionTextIdTransProvider, FieldDisabledProvider, FieldDisabledTransProvider, FieldReadonlyProvider, FieldReadonlyTransProvider, FieldRequiredProvider, FieldRequiredTransProvider, FieldStatusProvider, FieldStatusTransProvider, Filters, FlexDivider, FlexGroup, FlexItem, FlexSplit, FormField, Grid, HighlightedIcon, HighlightedIcon_style_exports as HighlightedIconStyles, IconButton, Input, KeyValueList, Label, Link, LinkStyler, Loader, Menu, MidBar, Modal, MoreInfoIcon, MultiBoxSelectionGroup, MultiSelect, NumericInput, Overflow, Pagination, PasswordInput, Popover, PopperProvider, ProfileIcon, ProfileIcon_style_exports as ProfileIconStyles, ProgressBar, QuantityCounter, RadioGroup, RestylableElement, ScreenReaderAnnounce, SearchBar, SearchInput, Section, Select, SelfContained, SharedIdProvider, SharedIdTransProvider, SideBar, Skeleton, Slider, Stepper, StepperStepState, Switch, TableHeading, Tabs, TextArea, TextButton, TextButton_style_exports as TextButtonStyles, ThemeModeSwitch, Toast, Toaster, ToggleButton, ToggleButton_style_exports as ToggleButtonStyles, Tooltip, TooltipCard, Provider as TooltipProvider, TreeView, Typography, actionIconButtonSizes, badgeVariants, bannerVariants, buttonSizes, buttonVariants, buttonWithIconVariants, cardVariants, childrenToString, combineHandlers, createNullableContext, createPrimitiveContextState, debounce, forwardRefWithGenerics, generateId, getClosestDivisibleNumber, handlePreventDefault, handleStopPropagation, iconButtonSizes, isFragmentElement, isTextualNode, memoWithGenerics, textButtonSizes, textButtonVariants, throttle, toast, typographyColors, useEllipsisTooltip, useErrorContent, useFieldAdditionTextId, useFieldDisabled, useFieldReadonly, useFieldRequired, useFieldStatus, useGeneratedId, useInputValueApi, useInputValueProps, useKeyValueList, useMultiSelectContext, usePaginationContext, usePopperContext, useScrollable, useSelectContext, useSharedId, useThemeModeSwitch, useToastParams };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@redis-ui/components",
3
3
  "license": "UNLICENSED",
4
- "version": "50.0.2",
4
+ "version": "51.0.0",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
7
  "repository": "git@github.com:redislabsdev/redis-ui.git",
@@ -30,7 +30,7 @@
30
30
  },
31
31
  "peerDependencies": {
32
32
  "@redis-ui/icons": "^8.0.0 || ^9.0.0 || ^10.0.0",
33
- "@redis-ui/styles": "^20.0.0",
33
+ "@redis-ui/styles": "^21.0.0",
34
34
  "react": "^18.0.0 || ^19.0.0",
35
35
  "react-dom": "^18.0.0 || ^19.0.0",
36
36
  "styled-components": "^5.0.0"
@@ -31,7 +31,7 @@ import { RedisLogoDarkMinIcon } from '@redis-ui/icons/multicolor';
31
31
 
32
32
  - **Composition**: Many components support a `Compose` pattern for advanced customization (e.g., `Select.Compose`, `Section.Compose`). Check the component reference for compose examples.
33
33
  - **Compound Components**: Some components use `Object.assign` to attach sub-components (e.g., `Button.Icon`, `Modal.Content`, `Tabs.TabBar`). These sub-components share internal React context with their parent, so they must be rendered inside it.
34
- - **Layouts**: Use `FlexGroup` and `FlexItem` for flex layouts instead of raw `div` with inline styles. `FlexGroup` supports `gap`, `direction`, `align`, `justify`, and `wrap` props. See the Layout references.
34
+ - **Layouts**: Use `FlexGroup` and `FlexItem` for flex layouts instead of raw `div` with inline styles. `FlexGroup` supports `gap`, `direction`, `align`, `justify`, and `wrap` props. For 2-D layouts (tracks that line up across both axes) use `Grid`. All layout boxes share `padding`/`margin`/sizing props via `BoxProps`. See the Layout references.
35
35
  - **Typography**: Use `Typography.Heading`, `Typography.Body`, and `Typography.Code` for all text rendering instead of raw `<span>`, `<p>`, or `<h1>`–`<h6>` elements. See the [Typography](./references/Typography.md) reference.
36
36
  - **Theming**: Components use `styled-components` and access theme via `useTheme()` from `@redis-ui/styles`.
37
37
  - **ForwardRef**: Most components support `ref` forwarding.
@@ -77,6 +77,7 @@ Always check the relevant component reference before using a component. The refe
77
77
 
78
78
  - [FlexGroup](./references/FlexGroup.md)
79
79
  - [FlexItem](./references/FlexItem.md)
80
+ - [Grid](./references/Grid.md)
80
81
  - [FlexDivider](./references/FlexDivider.md)
81
82
  - [FlexSplit](./references/FlexSplit.md)
82
83
  - [Card](./references/Card.md)
@@ -12,13 +12,16 @@ import { FlexGroup } from '@redis-ui/components';
12
12
  |------|------|---------|-------------|
13
13
  | gap | `'XXS' \| 'XS' \| 'S' \| 'M' \| 'L' \| 'XL' \| 'XXL' \| string` | `'S'` | Gap size between items. Supports predefined T-Shirt sizes and free text for applying values from theme |
14
14
  | direction | `'column' \| 'row' \| 'column-reverse' \| 'row-reverse'` | `'row'` | Flex direction |
15
- | align | `'start' \| 'end' \| 'center' \| 'stretch'` | `'center'` (row) / `'stretch'` (column) | Align items along the cross axis |
15
+ | align | `'start' \| 'end' \| 'center' \| 'stretch' \| 'baseline'` | `'center'` (row) / `'stretch'` (column) | Align items along the cross axis |
16
16
  | justify | `'start' \| 'end' \| 'center' \| 'space-between' \| 'space-around' \| 'space-evenly'` | - | Justify content along the main axis |
17
17
  | wrap | `boolean` | - | Whether items should wrap to new lines |
18
18
  | flex | `'auto' \| 'none' \| string` | - | Flex grow/shrink/basis value (inherited from FlexItem) |
19
- | selfAlign | `'start' \| 'end' \| 'center' \| 'stretch'` | - | Align self in parent flex container along the cross axis (inherited from FlexItem) |
19
+ | selfAlign | `'start' \| 'end' \| 'center' \| 'stretch' \| 'baseline'` | - | Align self in parent flex/grid container along the cross axis (inherited from FlexItem) |
20
20
  | component | `string \| ComponentType` | `'div'` | Use a different component with Flex styling (inherited from FlexItem) |
21
21
 
22
+ ### Box props (shared `BoxProps`, inherited from FlexItem)
23
+ Spacing props (`padding`, `paddingInline`, `paddingBlock`, `margin`, `marginInline`, `marginBlock`) accept T-Shirt sizes (`'XXS'`–`'XXL'`) that map to the theme spacing scale, or any raw CSS string (e.g. `'0'`, `'1.6rem'`, `'1.6rem 2.4rem'`). Sizing props (`width`, `minWidth`, `maxWidth`, `height`, `minHeight`, `maxHeight`) accept any CSS dimension string (e.g. `'100%'`, `'22rem'`). See the [FlexItem](./FlexItem.md) reference for the full box-prop table.
24
+
22
25
  The component also extends all native HTML element props via `ComposeElementProps`.
23
26
 
24
27
  ## Examples
@@ -145,5 +148,7 @@ import { CopyIcon, MenuIcon, MarketplaceIcon } from '@redis-ui/icons';
145
148
  - `FlexGroup` extends `FlexItem` internally, so it can be used both as a flex container and as a flex child within a parent `FlexGroup`.
146
149
  - The default `align` value is context-aware: it defaults to `'center'` for row directions and `'stretch'` for column directions.
147
150
  - The `gap` prop accepts T-Shirt sizes (`XXS` through `XXL`) which map to theme-defined spacing values. You can also pass arbitrary CSS values or theme token strings.
151
+ - `FlexGroup` inherits the shared box props (`padding*`, `margin*`, `width`/`height` sizing) from `FlexItem`, so prefer `padding="M"` over inline `style` for theme-consistent spacing.
152
+ - `align` and `selfAlign` accept `'baseline'` (maps to CSS `baseline`) in addition to `start`/`end`/`center`/`stretch`.
148
153
  - Use `FlexGroup` together with `FlexItem`, `FlexSplit`, and `FlexDivider` to compose complex layouts. `FlexSplit` pushes subsequent items to the end, and `FlexDivider` adds visual separators.
149
154
  - The `flex` prop (inherited from `FlexItem`) is useful for controlling how a `FlexGroup` sizes within a parent flex container (e.g., `flex="1"` for equal distribution, `flex="none"` for intrinsic sizing).
@@ -1,6 +1,6 @@
1
1
  # FlexItem
2
2
 
3
- A flex item wrapper component that controls individual item behavior within a flex container. It supports custom flex grow/shrink/basis values, self-alignment, and rendering as a different HTML element or component.
3
+ A flex item wrapper component that controls individual item behavior within a flex container. It supports custom flex grow/shrink/basis values, self-alignment, box-model props (padding/margin/sizing), and rendering as a different HTML element or component.
4
4
 
5
5
  ## Import
6
6
  ```tsx
@@ -11,10 +11,28 @@ import { FlexItem } from '@redis-ui/components';
11
11
  | Prop | Type | Default | Description |
12
12
  |------|------|---------|-------------|
13
13
  | flex | `'auto' \| 'none' \| string` | - | Flex grow/shrink/basis value |
14
- | selfAlign | `'start' \| 'end' \| 'center' \| 'stretch'` | - | Align self in parent flex container along the cross axis of the parent flex |
14
+ | selfAlign | `'start' \| 'end' \| 'center' \| 'stretch' \| 'baseline'` | - | Align self in parent flex/grid container along the cross axis (maps to CSS `align-self`) |
15
15
  | component | `string \| ComponentType` | `'div'` | Use different component with Flex styling |
16
16
  | children | `ReactNode` | - | Content to render inside the flex item |
17
17
 
18
+ ### Box props (shared `BoxProps`)
19
+ Spacing props accept T-Shirt sizes (`'XXS' \| 'XS' \| 'S' \| 'M' \| 'L' \| 'XL' \| 'XXL'`) that map to the theme spacing scale, or any raw CSS string (e.g. `'auto'`, `'0'`, `'1.6rem'`, `'1.6rem 2.4rem'`). Sizing props accept any CSS dimension string (e.g. `'100%'`, `'22rem'`, `'0'`).
20
+
21
+ | Prop | Type | Default | Description |
22
+ |------|------|---------|-------------|
23
+ | padding | `SpacingSize` | - | Padding on all sides |
24
+ | paddingInline | `SpacingSize` | - | Inline (left/right) padding |
25
+ | paddingBlock | `SpacingSize` | - | Block (top/bottom) padding |
26
+ | margin | `SpacingSize` | - | Margin on all sides |
27
+ | marginInline | `SpacingSize` | - | Inline (left/right) margin |
28
+ | marginBlock | `SpacingSize` | - | Block (top/bottom) margin |
29
+ | width | `string` | - | Width, e.g. `'100%'`, `'22rem'` |
30
+ | minWidth | `string` | - | Min width, e.g. `'0'` |
31
+ | maxWidth | `string` | - | Max width |
32
+ | height | `string` | - | Height, e.g. `'100%'` |
33
+ | minHeight | `string` | - | Min height |
34
+ | maxHeight | `string` | - | Max height |
35
+
18
36
  The component also extends all native `HTMLAttributes<HTMLElement>` props (excluding `children` and `content`).
19
37
 
20
38
  ## Examples
@@ -22,7 +40,7 @@ The component also extends all native `HTMLAttributes<HTMLElement>` props (exclu
22
40
  ### Toolbar with FlexItem
23
41
  > From the FlexGroup "Complex Layout: Toolbar" story. Demonstrates using `FlexItem` to wrap a search input within a flex toolbar layout.
24
42
  ```tsx
25
- import { FlexGroup, FlexItem, FlexSplit, FlexDivider, SearchInput, Button, Badge, IconButton } from '@redis-ui/components';
43
+ import { FlexGroup, FlexItem, FlexSplit, FlexDivider, SearchInput, Button, Badge, IconButton, Typography } from '@redis-ui/components';
26
44
  import { MarketplaceIcon, CopyIcon, MenuIcon } from '@redis-ui/icons';
27
45
 
28
46
  <FlexGroup gap="XL" style={{ paddingInline: '2.4rem', minHeight: '5.6rem' }}>
@@ -54,5 +72,6 @@ import { MarketplaceIcon, CopyIcon, MenuIcon } from '@redis-ui/icons';
54
72
  - `FlexItem` is typically used inside a `FlexGroup` to control individual item sizing and alignment.
55
73
  - The `flex` prop maps directly to the CSS `flex` shorthand property (e.g., `"auto"`, `"none"`, `"1"`, `"0 0 200px"`).
56
74
  - The `selfAlign` prop maps to the CSS `align-self` property, allowing an item to override the parent's `align` setting.
75
+ - The box props (`padding*`, `margin*`, and sizing) are the shared `BoxProps`, so `FlexItem`, `FlexGroup`, and `Grid` all accept them. Prefer T-Shirt spacing tokens over raw values so spacing stays theme-consistent.
57
76
  - Use the `component` prop to render as a different element (e.g., `component="span"`) or a custom React component while preserving flex item styling.
58
77
  - `FlexItem` renders as a `div` by default.
@@ -0,0 +1,105 @@
1
+ # Grid
2
+
3
+ A layout container that arranges its children using CSS grid — a 2-D layout with rows and columns, template areas, and cell spanning. Use it when flexbox (`FlexGroup`) is not enough, i.e. when tracks must line up across both axes. Like the other layouts it extends the shared box props (padding/margin/sizing) via `FlexItem`, and it can position itself inside a parent `Grid` via `gridColumn`/`gridRow`/`gridArea`.
4
+
5
+ ## Import
6
+ ```tsx
7
+ import { Grid } from '@redis-ui/components';
8
+ ```
9
+
10
+ ## Props
11
+ | Prop | Type | Default | Description |
12
+ |------|------|---------|-------------|
13
+ | columns | `string` | - | `grid-template-columns`, e.g. `'1fr 1fr'`, `'2fr 1fr'`, `'repeat(3, minmax(0, 1fr))'` |
14
+ | rows | `string` | - | `grid-template-rows` |
15
+ | areas | `string` | - | `grid-template-areas`, e.g. `'"header header" "sidebar main"'` |
16
+ | gap | `'XXS' \| 'XS' \| 'S' \| 'M' \| 'L' \| 'XL' \| 'XXL' \| string` | `'S'` | Gap between cells. T-Shirt sizes map to the theme scale, or any raw CSS value |
17
+ | columnGap | `SpacingSize` | - | Column gap. Overrides `gap` on the inline axis |
18
+ | rowGap | `SpacingSize` | - | Row gap. Overrides `gap` on the block axis |
19
+ | align | `'start' \| 'end' \| 'center' \| 'stretch' \| 'baseline'` | - | `align-items` — aligns cell content along the block (column) axis |
20
+ | justify | `'start' \| 'end' \| 'center' \| 'stretch'` | - | `justify-items` — aligns cell content along the inline (row) axis |
21
+ | autoFlow | `'row' \| 'column' \| 'row dense' \| 'column dense' \| string` | - | `grid-auto-flow` |
22
+ | autoRows | `string` | - | `grid-auto-rows` |
23
+ | autoColumns | `string` | - | `grid-auto-columns` |
24
+ | inline | `boolean` | - | Use `inline-grid` instead of `grid` |
25
+ | gridColumn | `string` | - | `grid-column` placement, for when this `Grid` is itself a child of another `Grid` (e.g. `'1 / 3'`, `'span 2'`) |
26
+ | gridRow | `string` | - | `grid-row` placement, for when this `Grid` is nested inside another `Grid` |
27
+ | gridArea | `string` | - | `grid-area` placement, for when this `Grid` is nested inside another `Grid` |
28
+
29
+ ### Box props (shared `BoxProps`, inherited from FlexItem)
30
+ `Grid` also accepts the shared box props — `padding`, `paddingInline`, `paddingBlock`, `margin`, `marginInline`, `marginBlock` (T-Shirt sizes or raw CSS), `width`/`minWidth`/`maxWidth`/`height`/`minHeight`/`maxHeight` (CSS dimension strings), and `component`. See the [FlexItem](./FlexItem.md) reference for the full box-prop table.
31
+
32
+ The component also extends all native HTML element props via `ComposeElementProps`.
33
+
34
+ ## Examples
35
+
36
+ ### Playground
37
+ ```tsx
38
+ import { Grid } from '@redis-ui/components';
39
+
40
+ <Grid columns="repeat(3, minmax(0, 1fr))" gap="L">
41
+ <div>a</div>
42
+ <div>b</div>
43
+ <div>c</div>
44
+ <div>d</div>
45
+ <div>e</div>
46
+ </Grid>
47
+ ```
48
+
49
+ ### Usage
50
+ ```tsx
51
+ import { Grid } from '@redis-ui/components';
52
+
53
+ <Grid columns="2fr 1fr" rows="auto 1fr" gap="M" align="stretch" justify="start" width="100%">
54
+ {children}
55
+ </Grid>
56
+ ```
57
+
58
+ ### Child placement
59
+ > A `Grid` owns the tracks (`columns` / `rows` / `areas`). When a `Grid` is nested inside another `Grid`, it positions itself with its own `gridColumn` / `gridRow` / `gridArea` props. Non-`Grid` children position themselves via the CSS `grid-*` properties in `style`.
60
+ ```tsx
61
+ import { Grid, Typography } from '@redis-ui/components';
62
+
63
+ // gridColumn — span across columns
64
+ <Grid columns="repeat(3, 1fr)" gap="M">
65
+ <Grid gridColumn="1 / 3" justify="center" align="center" padding="M">
66
+ <Typography.Body>gridColumn="1 / 3"</Typography.Body>
67
+ </Grid>
68
+ <Grid justify="center" align="center" padding="M">
69
+ <Typography.Body>(auto)</Typography.Body>
70
+ </Grid>
71
+ <Grid gridColumn="span 2" justify="center" align="center" padding="M">
72
+ <Typography.Body>gridColumn="span 2"</Typography.Body>
73
+ </Grid>
74
+ </Grid>
75
+
76
+ // gridRow — span across rows (first cell spans both rows)
77
+ <Grid columns="repeat(3, 1fr)" rows="repeat(2, 4rem)" gap="M">
78
+ <Grid gridRow="1 / 3" justify="center" align="center" padding="M">
79
+ <Typography.Body>gridRow="1 / 3"</Typography.Body>
80
+ </Grid>
81
+ <Grid justify="center" align="center" padding="M">
82
+ <Typography.Body>(auto)</Typography.Body>
83
+ </Grid>
84
+ </Grid>
85
+
86
+ // gridArea — named template areas
87
+ <Grid areas={'"header header" "sidebar main"'} columns="10rem 1fr" rows="auto 6rem" gap="M">
88
+ <Grid gridArea="header" justify="center" align="center" padding="M">
89
+ <Typography.Body>header</Typography.Body>
90
+ </Grid>
91
+ <Grid gridArea="sidebar" justify="center" align="center" padding="M">
92
+ <Typography.Body>sidebar</Typography.Body>
93
+ </Grid>
94
+ <Grid gridArea="main" justify="center" align="center" padding="M">
95
+ <Typography.Body>main</Typography.Body>
96
+ </Grid>
97
+ </Grid>
98
+ ```
99
+
100
+ ## Notes
101
+ - Reach for `Grid` only when a 2-D layout is needed (tracks aligned across both axes). For 1-D rows/columns, prefer `FlexGroup`.
102
+ - `gap` defaults to `'S'`. Use `columnGap` / `rowGap` to override the gap on a single axis.
103
+ - `align` maps to `align-items` (block axis) and `justify` maps to `justify-items` (inline axis) — these align content *within* each cell.
104
+ - `gridColumn` / `gridRow` / `gridArea` are for placing a nested `Grid` inside a parent `Grid`. A non-`Grid` child sets these via CSS in its own `style`.
105
+ - Like `FlexGroup`, `Grid` is built on `FlexItem`, so it inherits the shared box props (`padding*`, `margin*`, sizing) and the `component` prop.