Skip to main content
Neighborhood Design System v5.1.0

Content Block

Draft

Content Block is a layout container that wraps content within a constrained container and provides slots for an eyebrow, title, and subtitle alongside default content. It supports configurable background, margin, and padding settings, plus a compact option for adjusting spacing.

Draft. This component is in draft. Its API may change before it is marked Ready. What this means

Preview

Open in Storybook (opens in new tab)

Code

Install
npm install @fbin-web/neighborhood-core
Import
import { NbhdContentBlock } from '@fbin-web/neighborhood-core';
Usage
<nbhd-content-block>
  <nbhd-text
    tag="h2"
    variant="title"
    slot="title"
    >Content Block Title</nbhd-text
  >

  <nbhd-text tag="div">
    <p>
      Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec
      elit. Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus
      commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Duis mollis,
      est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Donec
      ullamcorper nulla non metus auctor fringilla.
    </p>
    <p>
      Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec ullamcorper nulla non metus
      auctor fringilla. Donec sed odio dui. Cras justo odio, dapibus ac facilisis in, egestas eget
      quam. Aenean lacinia bibendum nulla sed consectetur. Sed posuere consectetur est at lobortis.
    </p>
  </nbhd-text>
</nbhd-content-block>

Properties

PropertyAttributeTypeDefaultDescription
compactcompactbooleanfalseConstrain the component to the compact max inline size for a tighter content layout.
tagtag'div''section''article'divWrapper element. `article` and `section` add structure screen readers announce, so only use them when the content is a self-contained article or a named section.
surfacesurfacenoneprimarysecondaryinverseinverse-secondaryprimarySets the surface theme used by the content block.
marginTopmargin-topnonesmallmediumlargenoneAdjust margin above the component.
none = 0
small = 24px
medium = 48px
large = 96px
marginBottommargin-bottomnonesmallmediumlargenoneAdjust margin below the component.
none = 0
small = 24px
medium = 48px
large = 96px
paddingToppadding-topdefaultnonesmallmediumlargedefaultAdjust padding to the top of the component.
default = component's top padding
none = 0
small = 24px
medium = 48px
large = 96px
paddingBottompadding-bottomdefaultnonesmallmediumlargedefaultAdjust padding to the bottom of the component.
default = component's bottom padding
none = 0
small = 24px
medium = 48px
large = 96px

Slots

NameDescription
eyebrowOptional eyebrow content rendered above the title when provided.
titleOptional title content rendered above the subtitle and default body content.
subtitleOptional subtitle content rendered below the title and above the default content.
(default)Primary body content rendered inside the component after the optional header slots.

CSS Parts

NameDescription
baseThe main article wrapper for the content block.
containerThe inner nbhd-container element that constrains the block content.
slot-eyebrowThe slot element for eyebrow content when the eyebrow slot is provided.
slot-titleThe slot element for title content when the title slot is provided.
slot-subtitleThe slot element for subtitle content when the subtitle slot is provided.
nbhd-content-block::part(base) {
  /* your styles */
}

CSS Properties

Set these on nbhd-content-block 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.

PropertyTokenValue Copy
--nbhd-contentBlock-host-display—block
--nbhd-contentBlock-inlineSize—100%
--nbhd-contentBlock-marginInline—auto
--nbhd-contentBlock-maxInlineSize—100%
--nbhd-contentBlock-minInlineSize--nbhd-size-container-min320px
--nbhd-contentBlock-paddingBlock--nbhd-space-10 --nbhd-space-1240px 48px
--nbhd-contentBlock-paddingInline--nbhd-space-00px
--nbhd-contentBlock-textAlign—start

Dependencies

Child components <nbhd-content-block> renders internally. Import them too when you tree-shake.

Esc
↑ ↓ to move↵ to open