Skip to main content
Neighborhood Design System v5.1.0

Image

Ready

Image component that utilizes Widen APIs for formatting and optimization.

Preview

Open in Storybook (opens in new tab)

Code

Install
npm install @fbin-web/neighborhood-core
Import
import { NbhdImage } from '@fbin-web/neighborhood-core';
Usage
<nbhd-image
  src="https://moen.widen.net/content/8luiiucngz/original/1800-workstation-sinks-jumbotron-L.png"
  alt="Kitchen sink with food prep">
</nbhd-image>

Properties

PropertyAttributeTypeDefaultDescription
srcsrcstring—Image source URL. Widen URLs that already include query params are used as-is unless a preset or responsivePreset applies, in which case the preset's sizing and crop setting replace any in the URL (crop=false removes crop and k) and other params are preserved.
altaltstring—Text alternative for the image. Defaults to empty, which marks the image as decorative: set alt="" explicitly for decorative images. Leaving alt out entirely logs a warning during development.
cssClasscss-classstring—Optional CSS class applied to the rendered image element.
loadingloadinglazyeagereagerControls whether the image loads immediately or lazily.
widthwidthstringnumber—Primary width used for the image unless a preset is supplied.
heightheightstringnumberautoPrimary height used for the image unless a preset is supplied.
preset—ImageSize—Provider-agnostic target size that takes precedence over width and height. Overrides cdn.preset and cdn.sizes (cdn.quality still applies). Set by parent components such as Card and the Jumbotron logo, which also clear responsivePreset; when assigning preset directly, clear responsivePreset yourself or it will still take precedence.
responsivePreset—ResponsiveImagePreset—Breakpoint sizes (sm, md, lg) for Widen-rendered images. Set by parent components such as Humongotron, Jumbotron, Minitron, and Hero Split, and takes precedence over cdn.sizes and cdn.preset.
providerprovidernonewidennoneCDN provider used to optimize or transform the source image.
imageFocusimage-focuscentertoptop-rightrightbottom-rightbottombottom-leftlefttop-leftcenterFocal point used when Widen crops or resizes the image.
cropcropbooleanfalseEnables crop behavior for Widen-rendered images when used with imageFocus. Also aligns object-position with imageFocus when the image is scaled past its rendered size.
cdn—CdnConfig{}Configuration object for Widen CDN behavior, including preset, sizes, and quality. When quality is not set, an authored q or quality URL param is kept; otherwise Widen images default to 90.
responsiveresponsivebooleanfalseDeprecated: Widen rendering is now selected by provider.
picClasspic-classstring—Deprecated: Widen images now render through the scoped Widen renderer.
imgClassimg-classstring—Deprecated: no longer applied. Use `css-class` instead.
breakpointsbreakpointsbooleanfalseDeprecated: use cdn.preset or cdn.sizes for Widen responsive sources.
smWidthsm-widthstring—Deprecated: use cdn.preset or cdn.sizes for Widen responsive sources.
smHeightsm-heightstring—Deprecated: use cdn.preset or cdn.sizes for Widen responsive sources.
mdWidthmd-widthstring—Deprecated: use cdn.preset or cdn.sizes for Widen responsive sources.
mdHeightmd-heightstring—Deprecated: use cdn.preset or cdn.sizes for Widen responsive sources.
lgWidthlg-widthstring—Deprecated: use cdn.preset or cdn.sizes for Widen responsive sources.
lgHeightlg-heightstring—Deprecated: use cdn.preset or cdn.sizes for Widen responsive sources.

CSS Parts

CSS parts that can be styled using the ::part() selector.

NameDescription
pictureThe rendered <picture> element when Widen image rendering is enabled.
imageThe rendered <img> element for either standard or Widen-processed images.
nbhd-image::part(picture) {
  /* your styles */
}

CSS Properties

Set these on nbhd-image or an ancestor to override the defaults. Token is the design token a default comes from and Value is what it resolves to in core Neighborhood; brands may override them. Properties that adapt to surface follow the light or inverse surface they sit on until you set them.

Image

PropertyTokenValue Copy
--nbhd-image-blockSize--nbhd-media-blockSize100%
--nbhd-image-display--nbhd-media-displayblock
--nbhd-image-inlineSize--nbhd-media-inlineSize100%
--nbhd-image-insetBlockEnd--nbhd-media-insetBlockEndauto
--nbhd-image-insetBlockStart--nbhd-media-insetBlockStartauto
--nbhd-image-insetInlineEnd--nbhd-media-insetInlineEndauto
--nbhd-image-insetInlineStart--nbhd-media-insetInlineStartauto
--nbhd-image-maxBlockSize--nbhd-media-maxBlockSizenone
--nbhd-image-maxInlineSize--nbhd-media-maxInlineSize100%
--nbhd-image-objectFit--nbhd-media-objectFitfill
--nbhd-image-position--nbhd-media-positionstatic
--nbhd-image-transform--nbhd-media-transformnone
--nbhd-image-transitionDelay--nbhd-media-transitionDelay0s
--nbhd-image-transitionDuration--nbhd-media-transitionDuration0s
--nbhd-image-transitionProperty--nbhd-media-transitionPropertyall
--nbhd-image-transitionTimingFunction--nbhd-media-transitionTimingFunctionease

Media

PropertyTokenValue Copy
--nbhd-media-blockSize—100%
--nbhd-media-display—block
--nbhd-media-host-blockSize—100%
--nbhd-media-host-display—block
--nbhd-media-host-inlineSize—100%
--nbhd-media-inlineSize—100%
--nbhd-media-insetBlockEnd—auto
--nbhd-media-insetBlockStart—auto
--nbhd-media-insetInlineEnd—auto
--nbhd-media-insetInlineStart—auto
--nbhd-media-maxBlockSize—none
--nbhd-media-maxInlineSize—100%
--nbhd-media-objectFit—fill
--nbhd-media-position—static
--nbhd-media-transform—none
--nbhd-media-transitionDelay—0s
--nbhd-media-transitionDuration—0s
--nbhd-media-transitionProperty—all
--nbhd-media-transitionTimingFunction--nbhd-motion-easing-standardease

Dependencies

Used by

Esc
↑ ↓ to move↵ to open