πŸš€ DAY 5 OF LAUNCH WEEK: Introducing Socket Firewall Enterprise.Learn more β†’
Socket
Book a DemoInstallSign in
Socket

@buun_group/precast-icons

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@buun_group/precast-icons

A modern, minimal SVG icon library for React, Vue, Svelte and more

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

Precast Icons

A comprehensive SVG icon library optimized for modern web applications. Provides framework-agnostic icons with tree-shaking support, TypeScript definitions, and zero runtime dependencies.

Features

  • Framework Agnostic - Native support for React, Vue, Svelte, and vanilla JavaScript
  • Optimized Bundle Size - Tree-shakeable architecture ensures only imported icons are included
  • Full Customization - Complete control over size, color, stroke width, and styling
  • Zero Dependencies - No runtime dependencies for minimal overhead
  • TypeScript Ready - Comprehensive type definitions for all components and utilities
  • Extensive Icon Set - Over 4,000+ professionally designed icons available
  • Monochrome Support - Toggle between stroke and fill rendering modes

Architecture

flowchart TD
    A[SVG Source Files] -->|Build Script| B[Icon Parser]
    B --> C[TypeScript Definitions]
    C --> D[Framework Implementations]
    D --> E[React Components]
    D --> F[Vue Components]
    D --> G[Svelte Components]
    D --> H[Vanilla JS]

    E --> I[Tree-Shakeable Bundle]
    F --> I
    G --> I
    H --> I

    I --> J[Application Bundle]

    style A fill:#f9f,stroke:#333,stroke-width:2px
    style J fill:#9f9,stroke:#333,stroke-width:2px

Installation

npm install @precast/icons
# or
yarn add @precast/icons
# or
pnpm add @precast/icons

Usage

React

import { HomeIcon, SearchIcon, MenuIcon } from '@precast/icons/react';

function MyComponent() {
  return (
    <div>
      <HomeIcon size={24} color="blue" />
      <SearchIcon size={32} strokeWidth={1.5} />
      <MenuIcon className="custom-class" style={{ color: 'red' }} />
    </div>
  );
}

Using the Icon component with dynamic icons

import { Icon } from '@precast/icons/react';
import { icons } from '@precast/icons';

function DynamicIcon({ iconName }) {
  return <Icon icon={icons[iconName]} size={24} />;
}

Creating custom icons

import { createIcon } from '@precast/icons/react';

const CustomIcon = createIcon({
  name: 'custom',
  viewBox: '0 0 24 24',
  content: [
    {
      tag: 'path',
      attrs: {
        d: 'M12 2L2 7v10c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V7l-10-5z',
      },
    },
  ],
});

// Use it like any other icon
<CustomIcon size={24} color="green" />;

Vue

<template>
  <div>
    <HomeIcon :size="24" color="blue" />
    <SearchIcon :size="32" :stroke-width="1.5" />
    <MenuIcon class="custom-class" />
  </div>
</template>

<script setup>
import { HomeIcon, SearchIcon, MenuIcon } from '@precast/icons/vue';
</script>

Creating custom Vue icons

import { createIcon } from '@precast/icons/vue';

const CustomIcon = createIcon({
  name: 'custom',
  viewBox: '0 0 24 24',
  content: [
    {
      tag: 'path',
      attrs: {
        d: 'M12 2L2 7v10c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V7l-10-5z',
      },
    },
  ],
});

Svelte

<script>
  import { Icon, icons } from '@precast/icons/svelte';
</script>

<Icon icon={icons.home} size={24} color="blue" />
<Icon icon={icons.search} size={32} strokeWidth={1.5} />
<Icon icon={icons.menu} class="custom-class" />

Vanilla JavaScript

import { icons, renderIconDefinition } from '@precast/icons';

// Get SVG string
const svgString = renderIconDefinition(icons.home, {
  size: 24,
  color: 'blue',
  strokeWidth: 2,
});

// Insert into DOM
document.getElementById('icon-container').innerHTML = svgString;

Icon Generation Process

sequenceDiagram
    participant Dev as Developer
    participant Build as Build Script
    participant SVG as SVG Files
    participant Gen as Generator
    participant TS as TypeScript
    participant Bundle as Bundle

    Dev->>Build: npm run build
    Build->>SVG: Read SVG files
    SVG->>Gen: Parse SVG content
    Gen->>Gen: Extract paths & attributes
    Gen->>TS: Generate TypeScript definitions
    TS->>Bundle: Compile components
    Bundle->>Dev: Output dist/

Available Icons

The library includes over 3,000 professionally designed icons covering various categories:

Common Icons

  • home - Home/house icon
  • search - Magnifying glass
  • user - User profile
  • menu - Hamburger menu
  • heart - Heart/favorite
  • star - Star/rating
  • download - Download arrow
  • upload - Upload arrow
  • check - Checkmark

Navigation

  • chevronRight - Right chevron arrow
  • chevronLeft - Left chevron arrow
  • arrowUp - Up arrow
  • arrowDown - Down arrow

Actions

  • plus - Plus/add icon
  • minus - Minus/subtract icon
  • edit - Edit/pencil icon
  • trash - Delete/trash icon

View the complete icon list in the icons directory

Props

All icon components accept these props:

PropTypeDefaultDescription
sizenumber | string24Icon size (width and height)
colorstring'currentColor'Icon color
strokeWidthnumber | string2Stroke width for the icon paths
fillstring'none'Fill color
strokestring'currentColor'Stroke color
classNamestring''CSS class name
styleobject{}Inline styles

Advanced Usage

Creating Icon Definitions

import { createIconDefinition } from '@precast/icons';

const myIcon = createIconDefinition(
  'myIcon',
  ['M12 2L2 7v10c0 5.55 3.84 10.74 9 12'], // Array of path data
  { viewBox: '0 0 24 24' } // Optional overrides
);

Custom Styling

Icons use currentColor by default, making them easy to style with CSS:

.my-icon {
  color: #3b82f6;
  transition: color 0.2s;
}

.my-icon:hover {
  color: #2563eb;
}

TypeScript Support

Full TypeScript support with exported types:

import type { IconDefinition, IconProps } from '@precast/icons';
import { HomeIcon } from '@precast/icons/react';

const MyIcon: React.FC<IconProps> = (props) => {
  return <HomeIcon {...props} />;
};

Performance Characteristics

graph LR
    A[Import Icon] -->|Tree Shaking| B[Bundle Analysis]
    B --> C{Used?}
    C -->|Yes| D[Include in Bundle]
    C -->|No| E[Exclude from Bundle]
    D --> F[~200-400 bytes gzipped]

    style A fill:#ffd,stroke:#333,stroke-width:2px
    style F fill:#dfd,stroke:#333,stroke-width:2px
    style E fill:#fdd,stroke:#333,stroke-width:2px

Bundle Size

The library leverages tree-shaking to ensure optimal bundle sizes:

Import TypeBundle Impact
Single Icon~200-400 bytes gzipped
10 Icons~2-4 KB gzipped
50 Icons~10-20 KB gzipped
All Icons (not recommended)~650 KB gzipped

Build Performance

  • Icon generation: ~0.4s for 3,000+ icons
  • TypeScript compilation: ~30s
  • Zero runtime overhead

Browser Support

BrowserVersion
Chrome88+
Firefox78+
Safari14+
Edge88+
Opera74+

Note: Legacy browser support (IE11) possible with appropriate polyfills.

Development Workflow

flowchart LR
    A[Add SVG to assets/] --> B[Run npm run generate-icons]
    B --> C[Icons generated in src/icons/generated/]
    C --> D[Run npm run build]
    D --> E[Test in examples/]
    E --> F[Submit PR]

    style A fill:#bbf,stroke:#333,stroke-width:2px
    style F fill:#bfb,stroke:#333,stroke-width:2px

Adding New Icons

  • Place SVG files in assets/ directory
  • Run npm run generate-icons
  • Build the library with npm run build
  • Test integration in example applications

Contributing

Contributions are welcome. Please ensure:

  • SVG files are optimized (SVGO recommended)
  • Icons follow consistent 24x24 viewBox
  • Stroke-based designs preferred over fill
  • Tests pass with npm test
  • Examples work correctly

License

MIT License - see LICENSE file for details

Project Structure

precast-icons/
β”œβ”€β”€ assets/              # Source SVG files
β”œβ”€β”€ dist/                # Built library output
β”‚   β”œβ”€β”€ react/          # React components
β”‚   β”œβ”€β”€ vue/            # Vue components
β”‚   β”œβ”€β”€ svelte/         # Svelte components
β”‚   └── icons/          # Core icon definitions
β”œβ”€β”€ examples/            # Framework examples
β”‚   β”œβ”€β”€ react-example.tsx
β”‚   β”œβ”€β”€ vue-example.vue
β”‚   β”œβ”€β”€ svelte-example.svelte
β”‚   └── html-example.html
β”œβ”€β”€ scripts/             # Build scripts
β”‚   └── build-icons.js  # Icon generation script
└── src/                 # Source code
    β”œβ”€β”€ icons/          # Icon definitions
    β”œβ”€β”€ react/          # React implementation
    β”œβ”€β”€ vue/            # Vue implementation
    └── svelte/         # Svelte implementation

Icon Manifest & AI Schema

For AI tools and documentation purposes, we provide a comprehensive manifest:

  • Manifest: /dist/manifest.json - Complete icon catalog with usage examples
  • JSON Schema: /dist/schema.json - Machine-readable schema for AI tools
# Access the manifest
curl https://unpkg.com/@precast/icons@latest/dist/manifest.json

# Use in AI tools or documentation generators
fetch('@precast/icons/dist/manifest.json')
  .then(res => res.json())
  .then(manifest => {
    console.log(`${manifest.totalIcons} icons available`);
    console.log('Categories:', manifest.categories);
  });

Disclaimer

⚠️ Icon Removal Policy: If any companies want their icons removed from this library, please reach out to support@buungroup.com. We respect intellectual property rights and will promptly address any concerns.

Acknowledgments

Inspired by modern icon libraries with focus on performance and developer experience.

Keywords

icons

FAQs

Package last updated on 03 Sep 2025

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