useDensity

Allows to retrieve the DensityContext value (low or high).
Adding high-density support to your component is possible using this hook.

Import

import { useDensity } from '@contentful/f36-utils';

Examples

Component styling

Use the useDensity hook to add high-density support styling to your component.
The component will pick up the density defined in the DensityContainer component.

Help improve this page