npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@molecule/app-social-share-buttons-angular

v1.2.1

Published

Twitter/LinkedIn/Facebook/copy share button group

Readme

@molecule/app-social-share-buttons-angular

Angular social share buttons row.

Exports <SocialShareButtons> — the Angular counterpart of @molecule/app-social-share-buttons-react, with the same props (React names) and the same DOM, plus the SocialPlatform union. Twitter(X)/LinkedIn/ Facebook/Reddit/email/copy button group: each network button opens that platform's share URL in a new tab and 'copy' writes the URL to the clipboard with "Copied!" feedback. 'x' is an alias of 'twitter' (same intent URL). Default platforms: twitter, linkedin, facebook, copy.

Auto-generated, AI-first package reference for the molecule.dev ecosystem. It is written to be read by coding agents as much as by people, and is generated from this package's source — edit src/index.ts JSDoc, not this file.

Quick Start

import { Component } from '@angular/core'
import { SocialShareButtons } from '@molecule/app-social-share-buttons-angular'

@Component({
  selector: 'article-share',
  standalone: true,
  imports: [SocialShareButtons],
  template: `
    <div
      mol-social-share-buttons
      [url]="'https://example.com/blog/my-post'"
      [title]="'Check out this article'"
      [platforms]="['twitter', 'linkedin', 'reddit', 'email', 'copy']"
      size="sm"
    ></div>
  `,
})
export class ArticleShare {}

Type

feature

Installation

npm install @molecule/app-social-share-buttons-angular @angular/common @angular/core @angular/platform-browser @molecule/app-angular @molecule/app-clipboard @molecule/app-ui @molecule/app-ui-angular

API

Interfaces

SocialShareButtonsProps

Props for {@link SocialShareButtons} — the same props the React package takes.

interface SocialShareButtonsProps {
  /** URL to share. */
  url: string
  /** Optional share text / title. */
  title?: string
  /** Platforms to include (order = display order). */
  platforms?: SocialPlatform[]
  /** Visual size. */
  size?: 'sm' | 'md'
  /** Extra classes. */
  className?: string
}

Types

SocialPlatform

Supported social/sharing platforms for the share-buttons widget.

type SocialPlatform = 'twitter' | 'x' | 'linkedin' | 'facebook' | 'reddit' | 'email' | 'copy'

Classes

SocialShareButtons

SocialShareButtons component.

Row of share buttons — opens each platform's share sheet in a new tab. 'copy' copies the URL to the clipboard with "Copied!" feedback. The host IS the outer <div> (div[mol-social-share-buttons]), matching React's root exactly. Styling routes through the ClassMap token cm.flex({ align: 'center', gap: 'xs' }).

Copying goes through @molecule/app-clipboard's copyTextWithFallback() (the Clipboard API where available, the legacy copy command otherwise; false where no copy happened and the button then stays unchanged), as in React. Platform labels each use their literal share.<platform> i18n key and the copy feedback uses share.copied, read through the binding's reactive useTranslation(), so a locale switch refreshes the text (React's components re-render through useTranslation()).

@Component({
  selector: 'div[mol-social-share-buttons]',
  standalone: true,
  imports: [Button],
  inputs: ['url', 'title', 'platforms', 'size', 'className'],
  host: {
    '[class]': 'classes()',
  },
  template: `@for (platform of platformsList(); track platform) {
    @if (platform === 'copy') {
      <button
        mol-button
        [variant]="'outline'"
        [size]="size ?? 'sm'"
        [attr.aria-label]="label(platform)"
        (click)="copy()"
      >
        {{ buttonLabel() }}
      </button>
    } @else {
      <a
        [href]="shareUrlFor(platform)"
        target="_blank"
        rel="noreferrer noopener"
        [attr.aria-label]="label(platform)"
      >
        <button mol-button [variant]="'outline'" [size]="size ?? 'sm'">
          {{ icon(platform) }}
        </button>
      </a>
    }
  }`,
})
export class SocialShareButtons implements OnDestroy {
  /** URL to share. */
  url?: string
  /** Optional share text / title. */
  title?: string
  /** Platforms to include (order = display order; defaults to twitter, linkedin, facebook, copy). */
  platforms?: SocialPlatform[]
  /** Visual size (defaults to `'sm'` at read time). */
  size?: 'sm' | 'md'
  /** Extra classes on the outer wrapper. */
  className?: string

  /**
   * Reactive translation, read in the injection context. Its `t` reads the
   * locale, so the view re-renders the text on a locale switch (the static `t`
   * does not).
   */
  private readonly i18n = useTranslation()

  /** Whether the last copy succeeded ("Copied!" is showing). */
  private readonly copied = signal(false)

  /** The pending feedback reset timer, cleared when the component dies. */
  private timer?: ReturnType<typeof setTimeout>

  /**
   * The current class map.
   * @returns The UIClassMap.
   */
  cm(): UIClassMap {
    return getClassMap()
  }

  /**
   * The wrapper class list (React's
   * `cm.cn(cm.flex({ align: 'center', gap: 'xs' }), className)`).
   * @returns The class string.
   */
  classes(): string {
    return this.cm().cn(this.cm().flex({ align: 'center', gap: 'xs' }), this.className)
  }

  /**
   * The platforms to render (React's `platforms` default parameter).
   * @returns The platform list.
   */
  platformsList(): SocialPlatform[] {
    return this.platforms ?? DEFAULT_PLATFORMS
  }

  /**
   * The platform's button glyph (React's `ICON[platform]`).
   * @param platform - The platform.
   * @returns The text glyph.
   */
  icon(platform: SocialPlatform): string {
    return ICON[platform]
  }

  /**
   * The platform's accessible label, through ONE literal `t()` key per
   * platform (a runtime-built `` `share.${platform}` `` cannot be checked
   * against the locale bond). The defaults are the platforms' English names — the
   * text the bond's `en.ts` holds for these keys.
   * @param platform - The platform.
   * @returns The label text.
   */
  label(platform: SocialPlatform): string {
    switch (platform) {
      case 'twitter':
        return this.i18n.t('share.twitter', undefined, { defaultValue: 'Twitter' })
      case 'x':
        return this.i18n.t('share.x', undefined, { defaultValue: 'X' })
      case 'linkedin':
        return this.i18n.t('share.linkedin', undefined, { defaultValue: 'LinkedIn' })
      case 'facebook':
        return this.i18n.t('share.facebook', undefined, { defaultValue: 'Facebook' })
      case 'reddit':
        return this.i18n.t('share.reddit', undefined, { defaultValue: 'Reddit' })
      case 'email':
        return this.i18n.t('share.email', undefined, { defaultValue: 'Email' })
      case 'copy':
        return this.i18n.t('share.copy', undefined, { defaultValue: 'Copy' })
    }
  }

  /**
   * The platform's share URL (React's `shareUrl(p, url, title)`).
   * @param platform - The platform.
   * @returns The share URL (the raw url for the copy platform).
   */
  shareUrlFor(platform: SocialPlatform): string {
    return shareUrl(platform, this.url ?? '', this.title)
  }

  /**
   * The copy button's text: "Copied!" while the feedback shows, the copy glyph
   * otherwise (React's `copied ? t('share.copied', …) : ICON.copy`).
   * @returns The button text.
   */
  buttonLabel(): string {
    return this.copied()
      ? this.i18n.t('share.copied', undefined, { defaultValue: 'Copied!' })
      : ICON.copy
  }

  /**
   * Copies the URL, then shows the "Copied!" feedback for 1.5 s.
   */
  copy(): void {
    void copyTextWithFallback(this.url ?? '').then((copiedOk) => {
      if (!copiedOk) return
      this.copied.set(true)
      this.timer = setTimeout(() => this.copied.set(false), 1500)
    })
  }

  /** Detaches the feedback timer with the component. */
  ngOnDestroy(): void {
    clearTimeout(this.timer)
  }
}

Injection Notes

Requirements

Peer dependencies:

  • @angular/common ^22.0.0
  • @angular/core ^22.0.0
  • @angular/platform-browser ^22.0.0
  • @molecule/app-angular ^3.5.0 || ^4.0.0
  • @molecule/app-clipboard ^1.0.1
  • @molecule/app-ui ^1.0.1
  • @molecule/app-ui-angular ^1.1.0

Runtime Dependencies

  • @angular/common

  • @angular/core

  • @angular/platform-browser

  • @molecule/app-angular

  • @molecule/app-clipboard

  • @molecule/app-ui

  • @molecule/app-ui-angular

  • Must render inside the app's i18n provider and with a ClassMap bond wired (useTranslation() / getClassMap() throw otherwise).

  • 'copy' copies through @molecule/app-clipboard's copyTextWithFallback() — the Clipboard API where available, then the legacy copy command — so it also works on plain HTTP and in iframes where navigator.clipboard is missing or refuses the write. When no copy happens the button stays unchanged.

  • Sharing uses fixed platform intent URLs opened in a new tab; there is no Web Share API integration and no per-platform SDKs.

  • Button icons are plain text glyphs (𝕏, "in", "f", ✉, ⧉), not brand SVG logos — restyle via className if brand marks are required.

  • Every key ships in the companion locale bond: share.copied plus one literal share.<platform> key per platform, whose English text is the platform's name (Twitter, LinkedIn, Email, Copy, …).

Translations

Translation strings are provided by @molecule/app-locales-social-share-buttons.