@accelint/icons
v2.2.0
Published
An open-source icon library to serve as part of the entire ecosystem of UX for Accelint.
Readme
@accelint/icons
An open-source icon library serving as part of the Accelint UX ecosystem. This package contains 230+ optimized SVG icons converted to React components for seamless integration into React applications.
Features
- Tree-Shakeable: Import only the icons you need
- TypeScript Support: Full type definitions included
- Accessible: Built-in title prop support for screen readers
- Customizable: Icons inherit color and can be sized via CSS
- Optimized: SVGs are processed with SVGO for minimal file size
- Consistent: All icons use a 24x24 viewBox for uniform sizing
Installation
pnpm add @accelint/iconsUsage
Basic Import
Import icons using named imports for optimal tree-shaking:
import { Add } from '@accelint/icons/add';
import { Search } from '@accelint/icons/search';
import { Settings } from '@accelint/icons/settings';
export function MyComponent() {
return (
<div>
<Add />
<Search />
<Settings />
</div>
);
}With Accessibility
Use the title and titleId props for screen reader support:
import { Alert } from '@accelint/icons/alert';
export function AlertMessage() {
return (
<Alert
title="Warning notification"
titleId="alert-icon"
aria-labelledby="alert-icon"
/>
);
}Styling Icons
Icons inherit the current text color and can be styled using CSS classes. For consistent sizing and styling, consider using the <Icon> component from @accelint/design-toolkit.
Using CSS Classes:
import { Check } from '@accelint/icons/check';
export function SuccessIcon() {
return <Check className="fg-normal-bold" />;
}Inheriting Parent Color:
export function SearchButton() {
return (
<button className="fg-accent-primary-bold">
<Search />
Search
</button>
);
}Using the Icon Component (Recommended):
The @accelint/design-toolkit provides an <Icon> component with built-in size variants:
import { Icon } from '@accelint/design-toolkit';
import { Alert } from '@accelint/icons/alert';
export function WarningIcon() {
return (
<Icon size="medium" className="fg-serious-bold">
<Alert />
</Icon>
);
}Key Styling Properties:
- Color: Icons use
currentColorfor fill, so they inherit the text color from their parent or can be styled directly - Size: Control size using
widthandheightvia CSS classes or inline styles - Stroke: Icons are designed with
fill="none"by default; paths define the icon shape
TypeScript Support
All icons are fully typed and accept standard SVG element props:
import type { SVGProps } from 'react';
import { Dashboard } from '@accelint/icons/dashboard';
interface IconButtonProps {
icon: React.ComponentType<SVGProps<SVGSVGElement>>;
label: string;
}
export function IconButton({ icon: IconSvg, label }: IconButtonProps) {
return (
<button>
<IconSvg />
<span>{label}</span>
</button>
);
}
// Usage
<IconButton icon={Dashboard} label="Dashboard" />Available Icons
This package includes 230+ icons across various categories:
- UI Controls: Add, Remove, Edit, Delete, Settings, Search, Filter
- Navigation: Arrow (all directions), Chevron (all directions), Expand, Collapse
- Media: Play, Pause, Record, Stop
- Communication: Message, Phone, Bell, Share
- Status: Alert, Warning, Success, Information, Error
- Files: Import, Export, Attach, Copy, Paste
- Domain-Specific: Radar, Aircraft, Ships, Military symbols, Weather
For a complete list of available icons, see the package exports or explore the src/svg directory.
Icon Naming Convention
Icons use kebab-case naming:
- File:
arrow-left.svg→ Import:@accelint/icons/arrow-left→ Component:ArrowLeft - File:
add-fill.svg→ Import:@accelint/icons/add-fill→ Component:AddFill
Design Guidelines
Icon Specifications
- ViewBox: All icons use a
24x24viewBox - Grid: Icons are designed on a 24x24 pixel grid
- Stroke Width: Consistent stroke widths across icon set
- Color: Monochrome design using
currentColor(inherits text color)
Best Practices
- Sizing: Use the
<Icon>component from@accelint/design-toolkitfor consistent sizing with predefined variants (xsmall,small,medium,large) - Spacing: Maintain adequate padding around icons for touch targets
- Accessibility: Always provide
titleprop for standalone icons - Color Contrast: Ensure sufficient contrast between icon color and background
- Loading: Icons are lightweight, but consider lazy loading for pages with many icons
For more information about the Icon component and its size variants, see the Icon component documentation.
Contributing
Adding New Icons
Add SVG File: Place your SVG file in
src/svg/directorySVG Requirements:
- ViewBox must be
0 0 24 24 - Primary color should be
#898989(will be converted tocurrentColor) - Remove unnecessary attributes (SVGR will optimize)
- Ensure paths are properly closed
- ViewBox must be
Generate React Components:
pnpm generate:iconsThis runs SVGR to convert SVGs to React components in src/icons/.
- Build and Test:
pnpm build
pnpm test # If tests existSVGR Configuration
Icon generation is configured in svgr.config.mjs:
- Optimization: SVGO preset with custom overrides
- Color Replacement:
#898989→currentColor - Props: Expands props, includes title prop
- Output: TypeScript React components with JSX runtime
Build Process
The build process follows these steps:
pnpm generate:icons- Converts SVG files to React components using SVGRpnpm tsdown- Bundles TypeScript to JavaScript with type definitionspnpm run license- Adds license headers to generated filespnpm run format- Formats output files with Biome
License
Apache-2.0
