Skip to content

Feature: Add row height setting to layout options #22

@smartlabsAT

Description

@smartlabsAT

Feature Request

Description

Add a configurable row spacing (row height) setting to the layout options so users can control table density — from compact (maximum data density) to comfortable (more room for content and image previews). This mirrors the native Directus Tabular layout, which offers the same control.

Current Situation

  • Row height is effectively hard-coded: tableRowHeight returns a fixed 48px for non-image tables (src/super-table.vue), while image tables fall back to auto height.
  • Several fixed min-height rules in the table CSS (e.g. tbody tr, .edit-cell, tbody td .cell) pin the height regardless of content, so even if the row-height prop changed, the CSS would override it.
  • The LayoutOptions interface already declares a spacing?: 'compact' | 'cozy' | 'comfortable' field (src/options.vue), but it is currently an unused stub — there is no UI control and nothing reads it.

Proposed Solution

Wire up the existing spacing option end-to-end, aligned with the native Directus Tabular layout terminology:

spacing: 'compact' | 'cozy' | 'comfortable' // default: 'cozy'
Option Approx. row height Use case
compact ~36px Maximum data density, many rows on screen
cozy ~48px Balanced default (current behavior)
comfortable ~64px More breathing room, better for image previews

Optional / out of scope for a first pass: a custom mode with a user-defined pixel value.

Implementation Notes

  1. Options UI — add a v-select ("Row Spacing") to src/options.vue, bound to the existing spacing field in LayoutOptions via a computed get/set, defaulting to cozy.
  2. Row height — update the tableRowHeight computed in src/super-table.vue to map the selected spacing value to a pixel height instead of returning a fixed 48. Preserve the existing auto-height behavior for tables that contain image fields.
  3. CSS — relax the fixed min-height rules in the table styles (tbody tr, .edit-cell, tbody td .cell) so the chosen row height actually takes effect rather than being overridden. Keep cell content vertically centered at every density.
  4. Persistence — the value already lives in layoutOptions, so it is stored per collection / per bookmark automatically once wired up.

Benefits

  1. Better image previews — taller rows show images more clearly.
  2. Flexibility — users pick density based on their content type.
  3. Familiar UX — matches the native Directus Tabular layout spacing control.
  4. Accessibility — larger rows are easier to scan and interact with.

Acceptance Criteria

  • A "Row Spacing" control appears in the layout options offering compact / cozy / comfortable.
  • Selecting a value visibly changes the row height in the table.
  • The default (no explicit selection) matches the current appearance (~48px).
  • Cell content stays vertically centered at every density.
  • Tables with image fields keep their content-driven (auto) height.
  • The selected spacing persists across reloads and is saved with bookmarks.

Related Issues

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions