OGE logoOGE

Tile Layout API

Full surface of oge-tile-layout and its declarative oge-tile-layout-item children: inputs, methods, the cancelable events, the serializable state and its validator, the template slots, the keyboard map and the config provider.

Properties Methods Events Types

OgeTileLayout

oge-tile-layout

Properties 10

Name Type DefaultDescription
itemsreadonly OgeTileLayoutItemData[][]The tiles as data, rendered after the declarative oge-tile-layout-item children. Fields: key, title?, colSpan?, rowSpan?, order?, minColSpan? / maxColSpan?, minRowSpan? / maxRowSpan?, resizable?, reorderable?.
columnsnumber | undefinedconfig ?? 4Number of grid columns. Column spans are clamped to it; below 480px of container width the layout collapses to one column.
rowHeightnumber | 'auto' | undefinedconfig ?? 160Height of one row track in px, or auto to size rows by their content.
gapnumber | undefinedconfig ?? 16Gap between tiles in px.
columnWidthnumber | string | undefined—Fixed column width (240 px or any CSS length); default equal 1fr columns.
resizableboolean | 'horizontal' | 'vertical'falseDefault resizability of every tile (the item’s own resizable overrides it): a corner handle for the pointer, Ctrl+Shift+arrows for the keyboard.
reorderablebooleantrueDefault reorderability: drag by the header, Ctrl+arrows on the keyboard.
stateOgeTileLayoutState | undefinedundefinedThe committed layout (two-way [(state)]). undefined lays the tiles out from their own order and spans; every move and resize writes a new state.
ariaLabelstring | undefinedmessages.layoutLabel ('Dashboard')Accessible name of the list.
localestring | undefinedconfig ?? LOCALE_IDBCP 47 locale of the announcements’ plural rules.

Methods 5

Name Type Description
focus(key?)(key?: OgeTileLayoutKey) => voidFocuses a tile (default: the current tab stop).
moveTile(key, toIndex)(key: OgeTileLayoutKey, toIndex: number) => booleanMoves a tile through the cancelable pipeline (source: 'api'); false when nothing moved.
resizeTile(key, colSpan, rowSpan)(key: OgeTileLayoutKey, colSpan: number, rowSpan: number) => booleanGives a tile new spans, clamped to its bounds, through the cancelable pipeline.
getState()() => OgeTileLayoutStateThe current layout as a serializable state.
applyState(state)(state: unknown) => booleanValidates (sanitizeOgeTileLayoutState) and applies a persisted state; false and no change when it is invalid. Emits layoutChanged.

Events 6

Name Type Description
reorderingOgeTileLayoutReorderingEventA tile is about to move — set cancel to keep it.
reorderedOgeTileLayoutReorderedEventA tile moved.
resizingOgeTileLayoutResizingEventA tile is about to change its spans — set cancel to keep them.
resizedOgeTileLayoutResizedEventA tile changed its spans.
layoutChangedOgeTileLayoutChangedEventThe layout changed (move, resize, applyState) — persist state.
stateChangeOgeTileLayoutState | undefinedThe [(state)] model’s change half.

Types 21

Template slots

Name Type Description
OgeTileLayoutHeaderTemplate[ogeTileLayoutHeaderTemplate]Replaces the title in the header of every items tile. The header stays the drag handle; buttons inside it are real controls that never start a drag.
OgeTileLayoutContentTemplate[ogeTileLayoutContentTemplate]The body of every items tile. Ordinary flow content in the normal Tab order.
OgeTileLayoutTemplateContext{ $implicit: OgeTileLayoutItemData; key; index; colSpan; rowSpan }Context of both slots; the spans are the live preview while a resize is in progress.

Events & state

Name Type Description
OgeTileLayoutReorderingEvent{ item; key; fromIndex; toIndex; source: 'pointer' | 'keyboard' | 'api'; event?; cancel }A tile is about to move — set cancel to keep it where it is. The pointer drop and the keyboard emit the same payload.
OgeTileLayoutReorderedEventOmit<OgeTileLayoutReorderingEvent, 'cancel'>A tile moved.
OgeTileLayoutResizingEvent{ item; key; previous: OgeTileLayoutSpan; next: OgeTileLayoutSpan; source; event?; cancel }A tile is about to change its spans (already clamped to its bounds) — set cancel to keep them.
OgeTileLayoutResizedEventOmit<OgeTileLayoutResizingEvent, 'cancel'>A tile changed its spans.
OgeTileLayoutChangedEvent{ state: OgeTileLayoutState; source }The layout changed through a move, a resize or applyState() — the state to persist.
OgeTileLayoutState{ version: 1; tiles: { key; order; colSpan; rowSpan }[] }The serializable layout. order is the 0-based display position. Tiles the state does not list are placed after the known ones; entries whose key no longer exists are ignored.
sanitizeOgeTileLayoutState(input, knownKeys?)(input: unknown, knownKeys?: Iterable<OgeTileLayoutKey>) => OgeTileLayoutState | nullValidates persisted / imported state (untrusted input): never throws, rejects prototype keys at any depth, drops unknown fields, duplicate and unknown keys, keeps integer spans ≥ 1 and renumbers the order. applyState() runs it for you.

Vocabulary

Name Type Description
OgeTileLayoutItemDatainterfaceOne tile as data: key, title?, colSpan?, rowSpan?, order?, minColSpan? / maxColSpan?, minRowSpan? / maxRowSpan?, resizable?, reorderable?.
OgeTileLayoutResizableboolean | 'horizontal' | 'vertical'Which spans the user may change.
OgeTileLayoutSpan{ colSpan: number; rowSpan: number }Column and row span of a tile.
OgeTileLayoutKeystring | numberIdentity of a tile.
OgeTileLayoutChangeSource'pointer' | 'keyboard' | 'api'What started a change; api is a method call.

Keyboard

Name Type Description
Arrow keys / Home / EndfocusMove focus between tiles (one roving tab stop; ↑/↓ go to the closest tile in the row above / below). Content inside a tile keeps its own Tab order, and the tile keys only act while the tile itself is focused.
Ctrl+← / Ctrl+→moveMove the focused tile one position earlier / later (mirrored in RTL). ⌘ works as Ctrl.
Ctrl+↑ / Ctrl+↓moveMove the focused tile to the position of the tile above / below.
Ctrl+Shift+← / Ctrl+Shift+→resizeShrink / grow the column span (mirrored in RTL), within the tile’s bounds.
Ctrl+Shift+↑ / Ctrl+Shift+↓resizeShrink / grow the row span.
EscapecancelCancels a pointer drag or resize in progress.

OgeTileLayoutItem

oge-tile-layout-item

Properties 8

Name Type DefaultDescription
keystring | number | undefinedauto idIdentity reported by every event and stored in the state. Set it when the layout is persisted — the auto id is per page load.
titlestring | undefined—Header text; also the tile’s accessible name.
colSpan / rowSpannumber | undefined1Columns and rows the tile spans.
ordernumber | undefined—Initial position; tiles without one keep document order.
minColSpan / maxColSpannumber | undefined1 / columnsBounds of a column-span resize.
minRowSpan / maxRowSpannumber | undefined1 / unboundedBounds of a row-span resize.
resizableboolean | 'horizontal' | 'vertical' | undefined—Overrides the layout’s resizable.
reorderableboolean | undefined—Overrides the layout’s reorderable.

Types 1

Slots

Name Type Description
OgeTileLayoutItemHeader[ogeTileLayoutItemHeader]Attribute slot: the projected element replaces the header title. Everything else projected is the tile body.

Configuration

Properties 2

Name Type Description
provideOgeTileLayoutConfig(config)(config: OgeTileLayoutConfigInput | (() => OgeTileLayoutConfigInput)) => ProviderApplication- or component-scoped defaults for columns, rowHeight, gap, locale and the messages (a function makes it live).
OGE_TILE_LAYOUT_CONFIGInjectionToken<OgeTileLayoutConfig>The token behind provideOgeTileLayoutConfig(), with OGE_DEFAULT_TILE_LAYOUT_CONFIG as its factory default.

Types 2

Messages

Name Type Description
OgeTileLayoutMessagesinterfacelayoutLabel, tileRoleDescription, untitledTile ({position}), keyboardHint, dragHint, moved ({title}, {position}, {count}), resized (ICU plurals over {colSpan} / {rowSpan}), unchanged, dragCancelled. Translated in every @oge-ui/locales pack (layout.tileLayout).
OgeTileLayoutConfig / OgeTileLayoutConfigInputinterfaceThe config shape (messages, columns?, rowHeight?, gap?, locale?) and its partial input; OGE_DEFAULT_TILE_LAYOUT_CONFIG / OGE_DEFAULT_TILE_LAYOUT_MESSAGES are the resolved defaults.