Skip to main content
Neighborhood Design System v5.1.0

Link

Ready

Basic link component with no additional styling.

Preview

Open in Storybook (opens in new tab)

Code

Install
npm install @fbin-web/neighborhood-core
Import
import { NbhdLink } from '@fbin-web/neighborhood-core';
Usage
<nbhd-link href="anchor-url-link"> Text Link </nbhd-link>

Properties

PropertyAttributeTypeDefaultDescription
hrefhrefstring#URL or anchor target for the link.
ariaLabelaria-labelstring—Accessible label used for screen readers when the visible text is not sufficiently descriptive.
ariaCurrentaria-current'page''step''location''date''time''true''false'—Forwarded to the inner link, e.g. `page` for the current page.
cssClasscss-classstring—Additional CSS classes to apply to the rendered anchor element.
externalexternalbooleanfalseOpens the link in a new tab using target="_blank" when true.
externalLabelexternal-labelstring(opens in a new tab)Added to the accessible name (visually hidden) when `external` opens the link in a new tab, so it isn’t a surprise. External links also get `rel="noopener noreferrer"`.
activeactivebooleanfalseMarks the link as the current page: styled as active and announced with aria-current="page" (unless aria-current is set).

Events

NameDescriptionEvent Detail
nbhd-link-clickEmitted when the link is clicked. The native click event is provided on detail.originalEvent.{ originalEvent: Event }

Slots

NameDescription
(default)Main link label/content rendered inside the anchor element.
prefixContent rendered before the default label, via the prefix slot.
suffixContent rendered after the default label, via the suffix slot.

CSS Parts

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

NameDescription
baseThe rendered <a> anchor element that wraps the link content.
prefixThe prefix slot container rendered before the default label slot.
labelThe default slot container used for the main link label/content.
suffixThe suffix slot container rendered after the default label slot.
nbhd-link::part(base) {
  /* your styles */
}

CSS Properties

Set these on nbhd-link 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-link-blockSize—auto
--nbhd-link-color--nbhd-context-color-link-foregroundAdapts to surface
--nbhd-link-cursor—pointer
--nbhd-link-display—inline
--nbhd-link-fontFamily--nbhd-typography-body-fontFamilysans-serif
--nbhd-link-fontSize--nbhd-typography-body-fontSize1rem
--nbhd-link-fontStyle—inherit
--nbhd-link-fontWeight--nbhd-typography-body-fontWeight400
--nbhd-link-host-display—inline-block
--nbhd-link-inlineSize—auto
--nbhd-link-letterSpacing—inherit
--nbhd-link-marginBlock--nbhd-space-00px
--nbhd-link-marginInline--nbhd-space-00px
--nbhd-link-paddingBlock--nbhd-space-00px
--nbhd-link-paddingInline--nbhd-space-00px
--nbhd-link-position—static
--nbhd-link-textAlign—start
--nbhd-link-textDecoration—underline
--nbhd-link-textDecorationColor--nbhd-context-color-link-decorationAdapts to surface
--nbhd-link-textTransform—inherit
--nbhd-link-transitionDuration—0s
--nbhd-link-transitionFunction--nbhd-motion-easing-standardease
--nbhd-link-transitionProperty—all
--nbhd-link-zIndex--nbhd-z-autoauto

Dependencies

Used by

Esc
↑ ↓ to move↵ to open