Skip to content
Cynco UI

Productivity

DensityToggle

Compact / Default / Comfortable row density as a small segmented radio group with line-spacing icons; its value drives DensityProvider.

import { DensityToggle } from "@cynco-labs/ui";

Example

Use

In a list toolbar. Wrap the lists it controls in <DensityProvider density={value}>; every DataList inside picks it up. Pass storageKey to remember the choice per user.

Props

value / defaultValue ("compact" | "default" | "comfortable", default "default") / onValueChange, labels (auto — hide words when the nearest @container is under 22rem; always; never), storageKey (localStorage, uncontrolled use), label (group name, default "Row density"), className and any div props.

Notes

The demo DataList uses stickyHeader + maxHeight="16rem" so the header and the totals row stay in view while lines scroll; hidden in print.

Source Demo source Markdown