View as Markdown

API reference: @salmonui/layout/dashboard-layout

DashboardLayoutPropsinterface

import type { DashboardLayoutProps } from '@salmonui/layout/dashboard-layout';
interface DashboardLayoutProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'onChange'> {
    readonly children?: ReactNode;
    readonly columns?: number | undefined;
    readonly gap?: number | readonly [
        number,
        number
    ] | undefined;
    readonly rowHeight?: number | undefined;
    readonly cellAspectRatio?: number | undefined;
    readonly showGridLines?: boolean | undefined;
    readonly layout?: readonly DashboardLayoutItem[] | undefined;
    readonly defaultLayout?: readonly DashboardLayoutItem[] | undefined;
    readonly onLayoutChange?: ((layout: DashboardLayoutItem[]) => void) | undefined;
    readonly draggable?: boolean | undefined;
    readonly dragHandle?: string | undefined;
    readonly resizable?: boolean | readonly DashboardResizeEdge[] | undefined;
    readonly compact?: GridCompact | undefined;
    readonly responsive?: {
        readonly stackBelow?: number | undefined;
    } | undefined;
    readonly localeText?: DashboardLayoutLocaleText | undefined;
    readonly ref?: Ref<HTMLDivElement> | undefined;
}
DashboardLayoutProps members (16)
NameSignatureDescription
childrenoptionalreadonly children?: ReactNode;

DashboardLayout.Panel children.

columnsoptionalreadonly columns?: number | undefined;

Column count. Default 12.

gapoptionalreadonly gap?: number | readonly [ number, number ] | undefined;

Space between cells in px: one value, or [inline, block]. Default 8.

rowHeightoptionalreadonly rowHeight?: number | undefined;

Row height in px. Without it rows follow cellAspectRatio.

cellAspectRatiooptionalreadonly cellAspectRatio?: number | undefined;

Cell width / height when rowHeight is not set. Default 1 (square cells).

showGridLinesoptionalreadonly showGridLines?: boolean | undefined;
layoutoptionalreadonly layout?: readonly DashboardLayoutItem[] | undefined;

Controlled layout (the serialized form).

defaultLayoutoptionalreadonly defaultLayout?: readonly DashboardLayoutItem[] | undefined;
onLayoutChangeoptionalreadonly onLayoutChange?: ((layout: DashboardLayoutItem[]) => void) | undefined;

Once per committed drag, resize or keyboard drop, with every panel's item.

draggableoptionalreadonly draggable?: boolean | undefined;

Panels move with the pointer and the keyboard. Default true.

dragHandleoptionalreadonly dragHandle?: string | undefined;

CSS selector of the drag handle inside a panel; default the whole panel.

resizableoptionalreadonly resizable?: boolean | readonly DashboardResizeEdge[] | undefined;

Resize handles: true is ['bottom-end']. Default false.

compactoptionalreadonly compact?: GridCompact | undefined;

'vertical' floats panels up into free space. Default 'vertical'.

responsiveoptionalreadonly responsive?: { readonly stackBelow?: number | undefined; } | undefined;

stackBelow: below this container width (px, at least 100) panels stack in one column in layout order.

localeTextoptionalreadonly localeText?: DashboardLayoutLocaleText | undefined;
refoptionalreadonly ref?: Ref<HTMLDivElement> | undefined;

The root element.