@tdm-ui-kit/icons
v0.0.4
Published
Icon components for Sigma UI Kit
Readme
@tdm-ui-kit/icons
Icon components for Sigma UI Kit with tree-shaking support.
Installation
pnpm add @tdm-ui-kit/iconsUsage
Import individual icons (Recommended)
import XMarkIcon from '@tdm-ui-kit/icons/XMarkIcon';
import CheckIcon from '@tdm-ui-kit/icons/CheckIcon';
function MyComponent() {
return (
<div>
<XMarkIcon size={20} color="red" />
<CheckIcon size={24} />
</div>
);
}Import from main package
import { XMarkIcon, CheckIcon } from '@tdm-ui-kit/icons';
function MyComponent() {
return (
<div>
<XMarkIcon size={20} color="red" />
<CheckIcon size={24} />
</div>
);
}Available Icons
XMarkIcon- Close/X mark iconCheckIcon- Check mark iconChevronDownIcon- Down chevron iconPlusIcon- Plus icon
Icon Props
All icons accept the following props:
interface IconProps {
/**
* The size of the icon
* @default 24
*/
size?: number;
/**
* The color of the icon
* @default currentColor
*/
color?: string;
/**
* Additional CSS class name
*/
className?: string;
/**
* Additional inline styles
*/
style?: React.CSSProperties;
/**
* Accessibility label for the icon
*/
'aria-label'?: string;
/**
* Whether the icon is decorative (hidden from screen readers)
* @default false
*/
decorative?: boolean;
}Development
Creating a new icon
# From project root
pnpm create:icon MyNewIcon
# This will:
# 1. Create src/icons/MyNewIcon.tsx
# 2. Create src/MyNewIcon/index.ts
# 3. Update src/index.ts
# 4. Update package.json exports
# Then update TypeScript paths
pnpm update:icon-pathsManual icon creation
- Create
src/icons/IconName.tsxwith your icon component - Create
src/IconName/index.tsthat exports from the icons folder - Add export to
src/index.ts - Add export to
package.jsonexports field - Run
pnpm update:icon-pathsto update TypeScript paths
Tree Shaking
This package is optimized for tree shaking. When you import individual icons:
import XMarkIcon from '@tdm-ui-kit/icons/XMarkIcon';Only the XMarkIcon component and its dependencies will be included in your bundle.
TypeScript Support
Full TypeScript support is included with proper type definitions for all icons and props.
