React Shared Components

Interactive testing environment for react-shared components

Theme Playground

Current: Default

ContentLayout

A flexible layout component for organizing content items with masonry or stacked display modes.

Interactive Playground

Customize the ContentLayout properties and see the changes in real-time.

Layout Modes

Different display modes for organizing content.

Masonry Layout

Uses MasonryWall component for Pinterest-style layout with automatic column distribution.

Stacked Layout

Vertical stack with ContentDivider between items (except for button-only layouts).

Item 1

First content item

Item 2

Second content item

Item 3

Third content item

Item 4

Fourth content item

Button-Only Layout

Special handling when all items are buttons - uses grid layout with configurable columns.

Single Column (Theme Config)

When theme config specifies single column for buttons.

Double Column (Default)

Default grid layout with 2 columns, last item spans full width if odd number.

With Header

ContentLayout supports an optional header prop.

Section Header

Optional header content for the layout section.

Item 1

First content item

Item 2

Second content item

Item 3

Third content item

Item 4

Fourth content item

API Reference

Complete list of props and their descriptions.

PropTypeDefaultDescription
itemsContentLayoutItem[]requiredArray of items to render. Each item must have an id and optional data.button.layout property
layout'masonary' | 'stacked''masonary'Display mode: masonry for Pinterest-style layout, stacked for vertical list with dividers
children(item) => ReactNoderequiredRender function that receives each item and returns the content to display
headerReactNodeundefinedOptional header content displayed above items
classNamestringundefinedAdditional CSS classes for the root element

Usage Notes

Button Detection

The component automatically detects when all items have data.button.layout === 'button' and applies special grid layout with configurable columns (single/double).

Masonry Mode

In masonry mode, items are distributed across columns using the MasonryWall component for optimal space utilization.

Stacked Mode

In stacked mode, ContentDivider is automatically inserted between items (except for button-only layouts and after the last item). A final Divider is added at the end.

Theme Integration

The component respects theme configuration for layout mode and column settings through useThemeLayout and useTheme hooks.

Responsive Behavior

The component includes responsive spacing and layout adjustments. Button grids use gap-sitebutton-gap for consistent spacing.