Socket
Socket
Sign inDemoInstall

@launchpad-ui/icons

Package Overview
Dependencies
Maintainers
0
Versions
137
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@launchpad-ui/icons

An element that supplements content and represents an action or feature within LaunchDarkly.


Version published
Weekly downloads
2.4K
decreased by-7.22%
Maintainers
0
Weekly downloads
 
Created
Source

@launchpad-ui/icons

An element that supplements content and represents an action or feature within LaunchDarkly.

See it on NPM! How big is this package in your project?

Installation

$ yarn add @launchpad-ui/icons
# or
$ npm install @launchpad-ui/icons

Usage

Basic

The name prop specifies which icon to render.

import { Icon } from '@launchpad-ui/icons';

const MyIcon = () => <Icon name="info" />;

CORS limitation

Unfortunately SVG sprites cannot be accessed cross-domain. The workaround is to fetch the file and inject it into the document to access the icons directly.

Fetch and inject the sprite for Icon to render icons correctly:

import sprite from '@launchpad-ui/icons/sprite.svg';

fetch(sprite)
  .then(async (response) => response.text())
  .then((data) => {
    const parser = new DOMParser();
    const content = parser.parseFromString(data, 'image/svg+xml').documentElement;
    content.id = 'lp-icons-sprite';
    content.style.display = 'none';
    document.body.appendChild(content);
  })
  .catch((err) => {
    console.log('Failed to fetch sprite', err);
  });

To minimize latency, you can preload the sprite file accordingly:

<link
  rel="preload"
  href="{assets_location}/sprite.svg"
  as="fetch"
  type="image/svg+xml"
  crossorigin
/>

FAQs

Package last updated on 01 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc