A smart icon component that works with both React web and React Native, featuring intelligent synonym matching, fuzzy prefix matching, and flexible prop spreading with fallback support.
Installation β’ Quick Start β’ Architecture β’ Features β’ Documentation β’ Contributing
- Installation
- Quick Start
- Architecture
- Features
- Comprehensive Icon Dataset
- API Reference
- Advanced Usage
- Performance
- Extensibility
- Contributing via Hacktoberfest 2025
- License
npm install smart-icons-kitnpm install smart-icons-kit react-native-svg lucide-react-native bufferNote: React Native projects require additional dependencies for SVG support and Node.js polyfills.
import { SmartIcon } from 'smart-icons-kit';
import { AlertCircle } from 'lucide-react';
function App() {
return (
<div>
{/* Basic usage */}
<SmartIcon name="home" size={24} color="blue" />
{/* Synonym matching */}
<SmartIcon name="house" size={24} color="red" /> {/* synonym for home */}
{/* Fuzzy matching with prefixMatch prop */}
<SmartIcon name="hom" prefixMatch size={24} color="green" /> {/* matches "home" */}
{/* Fallback icon when name not found */}
<SmartIcon
name="nonexistent-icon"
size={24}
color="orange"
fallbackIcon={AlertCircle}
aria-label="Unknown icon"
/>
</div>
);
}npm install smart-icons-kit react-native-svg lucide-react-native bufferimport { SmartIcon } from 'smart-icons-kit';
import { AlertCircle } from 'lucide-react-native';
import { View, TouchableOpacity } from 'react-native';
function App() {
return (
<View>
{/* Basic usage */}
<SmartIcon name="home" size={24} color="blue" />
{/* Synonym matching */}
<SmartIcon name="house" size={24} color="red" /> {/* synonym for home */}
{/* Fuzzy matching with prefixMatch prop */}
<SmartIcon name="hom" prefixMatch size={24} color="green" /> {/* matches "home" */}
{/* Fallback icon when name not found */}
<SmartIcon
name="nonexistent-icon"
size={24}
color="orange"
fallbackIcon={AlertCircle}
accessibilityLabel="Unknown icon"
/>
{/* Interactive usage */}
<TouchableOpacity onPress={() => console.log('Icon pressed!')}>
<SmartIcon name="heart" size={24} color="red" />
</TouchableOpacity>
</View>
);
}βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β SMART ICONS KIT ARCHITECTURE β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β βββββββββββββββββββ βββββββββββββββββββββββββββββββββββββββ β
β β USER LAYER β β CORE COMPONENTS β β
β β β β β β
β β βββββββββββββββ β β ββββββββββββββββββββββββββββββββββββ β
β β β React Web βββΌβββββΌβββ€ SmartIcon Component ββ β
β β βββββββββββββββ β β ββββββββββββββββββββββββββββββββββββ β
β β β β β β β
β β βββββββββββββββ β β ββββββββββββββββΌββββββββββββββββββββ β
β β β React βββΌβββββΌβββ€ Matching Engine ββ β
β β β Native β β β β β’ Exact Match (O1) ββ β
β β βββββββββββββββ β β β β’ Synonym Match ββ β
β β β β β β’ Prefix Match (Ok) ββ β
β β βββββββββββββββ β β β β’ Sentence Match (O nΓk) ββ β
β β β Expo βββΌβββββΌββββββββββββββββββΌββββββββββββββββββββ β
β β βββββββββββββββ β β β β β
β βββββββββββββββββββ β ββββββββββββββββΌββββββββββββββββββββ β
β β β Icon Registry ββ β
β βββββββββββββββββββ β β β’ 200+ Lucide Icons ββ β
β β DATA LAYER β β β β’ Custom Icon Families ββ β
β β β β β β’ Fallback Handler ββ β
β β βββββββββββββββ β β ββββββββββββββββΌββββββββββββββββββββ β
β β β Icon DB βββΌβββββΌββββββββββββββββββ€ β β
β β β 200+ Icons β β β ββββββββββββββββΌββββββββββββββββββββ β
β β βββββββββββββββ β β β Cross-Platform Adapter ββ β
β β β β β β’ React Web Renderer ββ β
β β βββββββββββββββ β β β β’ React Native Renderer ββ β
β β β Synonym βββΌβββββΌββββββββββββββββββββββββββββββββββββββ β
β β β Dictionary β β β β β
β β β 1000+ Terms β β βββββββββββββββββββββββββββββββββββββββ β
β β βββββββββββββββ β β
β β β β
β β βββββββββββββββ β βββββββββββββββββββββββββββββββββββββββ β
β β β Category βββΌβββββ€ EXTERNAL DEPENDENCIES β β
β β β Index β β β β β
β β β 19 Cats β β β βββββββββββ βββββββββββ ββββββββββββ β
β β βββββββββββββββ β β β lucide- β β lucide- β β react- ββ β
β βββββββββββββββββββ β β react β β native β β native- ββ β
β β β β β β β svg ββ β
β β βββββββββββ βββββββββββ ββββββββββββ β
β βββββββββββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
- SmartIcon Component: Main entry point with intelligent prop spreading
- Matching Engine: Multi-layered icon discovery with O(1) to O(nΓk) performance
- Icon Registry: Centralized management with fallback support
- Cross-Platform Adapter: Unified API for React Web and React Native
- Icon Database: 200+ curated Lucide icons
- Synonym Dictionary: 1000+ intelligent synonyms
- Category Index: 19 organized icon categories
- lucide-react: Web icon components
- lucide-react-native: Mobile icon components
- react-native-svg: SVG rendering for React Native
- Input β User provides icon name and props
- Matching β Engine processes through 4 matching strategies
- Resolution β Registry finds appropriate icon component
- Rendering β Adapter renders using platform-specific components
- Spreading β All additional props are passed to rendered icon
- Exact Matches: O(1) - Direct hash map lookup
- Fuzzy Matches: O(k) - Linear scan through synonyms
- Sentence Matches: O(nΓk) - Word-by-word synonym matching
- Memory: Optimized icon loading with tree shaking support
- π― Smart Synonym Matching: Icons can be found by multiple names (e.g., "home", "house", "building")
- π Fuzzy Prefix Matching: Find icons by typing 3+ characters with
prefixMatchprop - π Sentence Matching: Extract icon names from sentences with
sentenceMatchprop - π¨ Flexible Prop Spreading: All SVG/icon props are automatically supported
- π‘οΈ Fallback Icons: Graceful fallback when icons aren't found
- π± Cross-Platform: Works with both React web and React Native
- π· TypeScript Support: Full type definitions included
- β‘ High Performance: O(1) lookups for exact matches, O(k) for fuzzy matches
- Total Icons: 225+
- React Web: 225+ icons with 4-6 synonyms each
- React Native: 225+ icons with 4-6 synonyms each
- Total Synonyms: 1150+ unique synonyms
- Categories: 22 organized categories
home, search, menu, settings, user, users, bell, bellOff, eye, eyeOff
chevronDown, chevronUp, chevronLeft, chevronRight, chevronsDown, chevronsUp, chevronsLeft, chevronsRight, arrowDown, arrowUp, arrowLeft, arrowRight, arrowDownLeft, arrowDownRight, arrowUpLeft, arrowUpRight
plus, minus, x, check, circle, square, triangle, star, heart, bookmark
edit, edit2, edit3, save, copy, scissors, trash, trash2, delete, download, upload, share, share2, link, link2, externalLink, refreshCw, refreshCcw
play, pause, skipBack, skipForward, fastForward, rewind, volume, volume1, volume2, volumeX
maximize, minimize, maximize2, minimize2, rotateCw, rotateCcw, zoomIn, zoomOut
mail, messageCircle, messageSquare, phone, phoneCall, phoneIncoming, phoneOutgoing, phoneMissed, phoneOff, send, mic, micOff, headphones, speaker, video, videoOff, camera, cameraOff
file, fileText, filePlus, fileMinus, folder, folderPlus, folderMinus, folderOpen, image, film, music, package, archive, inbox, clipboard, paperclip
smartphone, tablet, monitor, laptop, tv, watch, hardDrive, server, database, cpu, wifi, wifiOff, bluetooth, battery, batteryCharging, power, zap, zapOff
facebook, twitter, instagram, linkedin, github, gitlab, youtube, slack
dollarSign, creditCard, shoppingCart, shoppingBag, package2, truck, briefcase, building, trendingUp, trendingDown, barChart, barChart2, pieChart, activity, target
calendar, clock, timer, sunrise, sunset, moon, sun
cloud, cloudRain, cloudSnow, cloudLightning, cloudDrizzle, cloudOff, umbrella, droplet, wind, thermometer, compass, map, mapPin, globe, navigation, navigation2
lock, unlock, shield, shieldOff, key, fingerprint
wrench, hammer, cog, sliders, filter, hash, tag, layers, grid, layout, sidebar, moreHorizontal, moreVertical
type, bold, italic, underline, alignLeft, alignCenter, alignRight, alignJustify, list, listOrdered, quote, code, terminal, command
checkCircle, xCircle, alertCircle, alertTriangle, alertOctagon, info, helpCircle, thumbsUp, thumbsDown, award, trophy, medal, flag
hexagon, octagon, diamond, cross, bookmarkPlus, bookmarkMinus
car, plane, train, ship, bus
brain, brainCircuit, sparkles, bot, webhook, workflow, blocks, network, cloudCog, container, code2, braces, binary, scan
bookOpen, graduationCap, school
hospital, pill, syringe, stethoscope, dna, microscope, heartPulse, ambulance
coffee, gamepad2, palette, brush, pen, pencil, eraser, ruler, gift, cake, pizza, apple, carrot, leaf, trees, flower, bug, fish, bird, cat, dog
Each icon has 4-6 carefully curated synonyms:
home: {
synonyms: ["home", "house", "building", "dwelling", "main", "dashboard"],
component: Home,
}- Navigation: All common UI navigation patterns
- Actions: Complete set of user actions
- Communication: Full communication suite
- Technology: Modern device and tech icons
- Business: Professional business icons
- Nature: Weather and natural elements
- Tools: Development and utility tools
- Each icon name is unique
- No conflicting synonyms
- Clean, organized structure
- All icons exist in Lucide React/React Native
- Tested and verified imports
- Consistent naming conventions
name: string- Icon name or synonym (required)family?: string- Icon family (default: "lucide")prefixMatch?: boolean- Enable fuzzy matching for 3+ character inputs (default: false)sentenceMatch?: boolean- Enable sentence-based icon extraction (default: false)fallbackIcon?: React.ComponentType<any>- Fallback icon when name not found
All standard SVG props are supported through prop spreading:
size?: number- Icon sizecolor?: string- Icon colorstroke?: string- Stroke colorfill?: string- Fill colorstrokeWidth?: number- Stroke widthclassName?: string- CSS classstyle?: CSSProperties- Inline stylesonClick?: (event) => void- Click handleronMouseEnter?: (event) => void- Mouse enter handleronMouseLeave?: (event) => void- Mouse leave handler- And many more...
When prefixMatch={true} is enabled, the component will attempt to find icons using:
- Exact Match: Direct lookup (O(1))
- Prefix Match: Find synonyms that start with the input
- Contains Match: Find synonyms that contain the input
- Reverse Prefix Match: Find synonyms where input is a prefix
Examples:
<SmartIcon name="hom" prefixMatch /> // matches "home"
<SmartIcon name="sea" prefixMatch /> // matches "search"
<SmartIcon name="set" prefixMatch /> // matches "settings"
<SmartIcon name="mai" prefixMatch /> // matches "mail"When sentenceMatch={true} is enabled, the component will:
- Split Input: Break the input into individual words
- Reverse Search: Start from the last word (most specific) and work backwards
- Word Matching: Find the first word that matches an icon name or synonym
- Combined with Prefix: If
prefixMatchis also enabled, apply fuzzy matching to each word
Examples:
<SmartIcon name="manali hotel" sentenceMatch /> // finds "hotel"
<SmartIcon name="luxury restaurant" sentenceMatch /> // finds "restaurant"
<SmartIcon name="red car" sentenceMatch /> // finds "car"
<SmartIcon name="coffee shop" sentenceMatch /> // finds "coffee"
<SmartIcon name="shopping mall" sentenceMatch /> // finds "shopping"
<SmartIcon name="general hospital" sentenceMatch /> // finds "hospital"
<SmartIcon name="elementary school" sentenceMatch /> // finds "school"
<SmartIcon name="office building" sentenceMatch /> // finds "building"
<SmartIcon name="private plane" sentenceMatch /> // finds "plane"When an icon name isn't found, you can provide a fallback:
import { AlertCircle, HelpCircle } from 'lucide-react';
// Fallback for unknown icons
<SmartIcon
name="unknown-icon"
fallbackIcon={AlertCircle}
size={24}
color="red"
/>
// Fallback with prefix matching
<SmartIcon
name="unk"
prefixMatch
fallbackIcon={HelpCircle}
size={24}
color="blue"
/>- Future-Proof: No need to update component when new SVG props are added
- Developer Experience: Full TypeScript intellisense for all props
- Flexibility: Event handlers, accessibility props, custom SVG attributes
- Fallback Support: Graceful degradation when icons aren't found
- Cross-Platform: Same API for React web and React Native
Interactive Icons:
<SmartIcon
name="heart"
size={20}
color={liked ? "red" : "gray"}
onClick={toggleLike}
onMouseEnter={() => setHovered(true)}
style={{ cursor: 'pointer', transform: hovered ? 'scale(1.1)' : 'scale(1)' }}
/>Custom Styled Icons:
<SmartIcon
name="star"
size={30}
fill="gold"
stroke="none"
className="star-icon"
data-testid="rating-star"
/>Accessible Icons:
<SmartIcon
name="search"
size={24}
aria-label="Search"
role="img"
focusable="true"
/>- Exact Matches: O(1) - Direct hash map lookup
- Fuzzy Matches: O(k) - where k is the number of synonyms
- Sentence Matches: O(n Γ k) - where n is words and k is synonyms
- Memory: O(n Γ m) - where n is icons and m is average synonyms per icon
- React Web: ~200 icons with synonyms
- React Native: ~200 icons with synonyms
- Tree Shaking: Only used icons are included
- Zero overhead - just standard React prop spreading
- Same O(1) lookup performance for exact matches
- Same O(k) performance for fuzzy matches
- No additional bundle size
import { registerIconFamily } from 'smart-icons-kit';
import { CustomIcon } from './CustomIcon';
registerIconFamily('custom', {
myIcon: {
synonyms: ['my-icon', 'custom-icon'],
component: CustomIcon,
},
});
// Now you can use it with all the same features
<SmartIcon name="my-icon" family="custom" />
<SmartIcon name="my-" prefixMatch family="custom" /> {/* fuzzy match */}
<SmartIcon
name="unknown-custom"
family="custom"
fallbackIcon={AlertCircle}
size={24}
/>import { registerIconFamily } from 'smart-icons-kit';
import * as FeatherIcons from 'feather-icons-react';
registerIconFamily('feather', {
heart: {
synonyms: ['heart', 'love', 'like'],
component: FeatherIcons.Heart,
},
// Add more Feather icons...
});- Comprehensive: 200+ most common icons
- Smart: 1000+ synonyms for easy discovery
- Fast: O(1) lookup performance
- Flexible: Spread props and fallback support
- Cross-Platform: Works on React web and React Native
- Type-Safe: Full TypeScript support
- Future-Proof: Easy to extend with more icons
Contributions are welcome! This project is participating in Hacktoberfest 2025 π
You can contribute by:
- π¨ Adding new icons or synonyms
- π Improving documentation
- β‘ Enhancing performance or tests
- π Fixing bugs or issues
- π Adding internationalization support
- π‘ Proposing new features
- Fork this repository
- Create a new branch (
git checkout -b feature/amazing-feature) - Make your changes
- Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Please check CONTRIBUTING.md for detailed guidelines.
Check out issues labeled with good-first-issue or hacktoberfest to get started!
This project is licensed under the MIT License - see the LICENSE file for details.
Smart Icons Kit provides a comprehensive, high-performance icon solution for React applications with:
- β 200+ icons with 1000+ synonyms across 19 categories
- β Smart matching with exact, fuzzy prefix, and sentence matching
- β Flexible props supporting all SVG attributes and event handlers
- β Cross-platform support for React web and React Native
- β Type-safe with full TypeScript support
- β Extensible architecture for custom icon families
- β High performance with O(1) exact matches and O(k) fuzzy matches
- β Modular architecture with clear separation of concerns
Perfect for modern web and mobile applications that need a comprehensive, intelligent icon system! π
Made with β€οΈ by Mohammed Abdullah Khan
β Star this repo if you find it useful!