Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
@devseed-ui/collecticons-chakra
Advanced tools
This modules allows you to use collecticons svg icons with the Chakra UI Library.
yarn add @devseed-ui/collecticons-chakra
Chakra style prop are supported, as well as the following:
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. |
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 />
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-chakra';
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 by Chakra, 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' />
));
3.0.3
collection-layers.svg
(not a real collecticon)FAQs
devseed UI Kit Collecticons for Chakra
We found that @devseed-ui/collecticons-chakra demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
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.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.