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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@devseed-ui/collecticons-react

v3.0.3

Published

devseed UI Kit Collecticons for React

Downloads

31

Readme

collecticons-banner

Collecticons for React

This modules allows you to use collecticons svg icons with a React base app.

yarn add @devseed-ui/collecticons-react

Props

| Name | Type | Default | Description | |:-----|:-----|:--------|:------------| |title |string|undefined|Descriptive title of the svg printed inside it. Required if meaningful is true. |meaningful|boolean|false|Defines whether the icon has semantic meaning by setting the property of aria-hidden. When an icon is meaningful, a title property should be provided.|

Decorative vs Meaningful icons

By default the collecticons are considered to be decorative elements (using aria-hidden="true"), but it is possible to give them semantic meaning by passing a descriptive title prop and defining them as meaningful.

<CollecticonBrandCollecticons title="The logo of the collecticons icon library" meaningful />

Creating custom icons (advanced)

Collecticons has an extensive selection of icons, but sometimes a project needs custom icons that are not (yet) available in the library.

These custom icons should be created the in same way collecticons are to ensure the correct interoperability between the different components where they're used. By design, Collections only have one color which is then controlled via props, so it is important that the constituents of the SVG have a fill set to currentColor.

A collecticon can be created using the function createCollecticon which should return a React Component and has the following signature:

import { createCollecticon } from '@devseed-ui/collecticons-react';

createCollecticon((props) => {}, iconSvgProps);

// props = {
//  title: string;
//  width: number;
//  height: number;
//  fill: string;
//  xmlns: string;
//  role: 'img';
//  viewBox: '0 0 16 16';
//  'aria-hidden': boolean;
//}

The SVG wrapper is added automatically, so only the icon path should be returned.

If there's the need to pass additional props to the SVG, they can be passed as the second argument to createCollecticon. As an example, if the icon was designed with a viewBox different from 0 0 16 16 this prop should be passed on creation.

Example The following SVG icon:

<?xml version="1.0" encoding="utf-8"?>
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16" viewBox="0 0 16 16">
  <rect x="2" y="2" width="12" height="12" />
</svg>

Would be converted to a Collecticon as:

const CollecticonSquare = createCollecticon((props) => (
  <rect x="2" y="2" width="12" height="12" fill='currentColor' />
));