Icon Components
Icon components provide a comprehensive collection of SVG icons for the WorkPay application. All icons are built using Chakra UI's Icon component and support consistent styling, theming, and accessibility features.
Overview
The icon system is organized into several categories:
- GeneralIcons: Basic UI icons (arrows, actions, status)
- FeatureIcons: Application-specific icons (users, projects, home)
- SocialIcons: Social media platform icons
- Flags: Country flag icons
- Illustrations: Complex graphics and empty states
- Logo Components: Branding elements
Base Location: src/components/WPIcons/
General Icons
Navigation Icons
ChevronDown, ChevronUp, ChevronLeft, ChevronRight
Direction indicators for dropdowns, navigation, and expandable content.
Location: src/components/WPIcons/GeneralIcons/
Usage:
import { ChevronDownSolid, ChevronUpSolid, ChevronLeftOutline, ChevronRightOutline } from 'components/WPIcons';
// Dropdown indicator
<Button rightIcon={<ChevronDownSolid />}>
Options
</Button>
// Navigation
<IconButton icon={<ChevronLeftOutline />} aria-label="Previous" />
<IconButton icon={<ChevronRightOutline />} aria-label="Next" />
ArrowDown, ArrowUp, ArrowLeft, ArrowRight
Directional arrows for navigation and movement.
Usage:
import { ArrowDownSolid, ArrowUpSolid, ArrowLeftOutline, ArrowRightOutline } from 'components/WPIcons';
// Sort indicators
<Button rightIcon={<ArrowDownSolid />}>
Sort Descending
</Button>
// Navigation buttons
<Button leftIcon={<ArrowLeftOutline />}>
Back
</Button>
<Button rightIcon={<ArrowRightOutline />}>
Next
</Button>
Action Icons
EditSolid
Edit action for forms and content modification.
Usage:
import { EditSolid } from 'components/WPIcons';
<IconButton icon={<EditSolid />} aria-label='Edit' onClick={handleEdit} />;
TrashSolid
Delete action with confirmation patterns.
Usage:
import { TrashSolid } from 'components/WPIcons';
<IconButton
icon={<TrashSolid />}
aria-label='Delete'
colorScheme='red'
onClick={handleDelete}
/>;
SearchSolid
Search functionality for forms and navigation.
Usage:
import { SearchSolid } from 'components/WPIcons';
<InputGroup>
<InputLeftElement>
<SearchSolid color='gray.400' />
</InputLeftElement>
<Input placeholder='Search...' />
</InputGroup>;
FilterOutline
Filter controls for data tables and lists.
Usage:
import { FilterOutline } from 'components/WPIcons';
<Button leftIcon={<FilterOutline />} variant='outline' onClick={openFilters}>
Filter
</Button>;
Status Icons
CheckSolid
Success states and confirmations.
Usage:
import { CheckSolid } from 'components/WPIcons';
<Alert status='success'>
<CheckSolid color='green.500' />
<AlertTitle>Success!</AlertTitle>
</Alert>;
XCircleSolid
Error states and close actions.
Usage:
import { XCircleSolid } from 'components/WPIcons';
<Alert status='error'>
<XCircleSolid color='red.500' />
<AlertTitle>Error occurred</AlertTitle>
</Alert>;
BellSolid
Notifications and alerts.
Usage:
import { BellSolid } from 'components/WPIcons';
<IconButton icon={<BellSolid />} aria-label='Notifications' position='relative'>
{hasNotifications && (
<Badge colorScheme='red' position='absolute' top='-1' right='-1'>
{notificationCount}
</Badge>
)}
</IconButton>;
Communication Icons
EmailSolid
Email actions and contact information.
Usage:
import { EmailSolid } from 'components/WPIcons';
<Button leftIcon={<EmailSolid />} colorScheme='blue' onClick={sendEmail}>
Send Email
</Button>;
MessageSolid
Chat and messaging features.
Usage:
import { MessageSolid } from 'components/WPIcons';
<IconButton icon={<MessageSolid />} aria-label='Messages' onClick={openChat} />;
PhoneSolid
Phone contact actions.
Usage:
import { PhoneSolid } from 'components/WPIcons';
<Link href={`tel:${phoneNumber}`}>
<PhoneSolid />
Call Now
</Link>;
Media Icons
PlaySolid, PauseSolid, StopSolid
Media controls for audio/video content.
Usage:
import { PlaySolid, PauseSolid, StopSolid } from 'components/WPIcons';
<HStack>
<IconButton
icon={isPlaying ? <PauseSolid /> : <PlaySolid />}
onClick={togglePlayPause}
/>
<IconButton icon={<StopSolid />} onClick={stopPlayback} />
</HStack>;
ImageSolid
Image upload and gallery features.
Usage:
import { ImageSolid } from 'components/WPIcons';
<Button leftIcon={<ImageSolid />} onClick={openImageUpload}>
Upload Image
</Button>;
Feature Icons
User Management
UserSolid
User profiles and account management.
Location: src/components/WPIcons/FeatureIcons/User.tsx
Usage:
import { UserSolid } from 'components/WPIcons';
<Avatar icon={<UserSolid />} name={user.name} src={user.avatar} />;
PeopleIcon
Team and group management.
Usage:
import { PeopleIcon } from 'components/WPIcons';
<Button leftIcon={<PeopleIcon />} onClick={openTeamManagement}>
Manage Team
</Button>;
Navigation
HomeSolid
Dashboard and home navigation.
Location: src/components/WPIcons/FeatureIcons/Home.tsx
Usage:
import { HomeSolid } from 'components/WPIcons';
<NavLink to='/dashboard'>
<HomeSolid />
Dashboard
</NavLink>;
ProjectOutline
Project management features.
Location: src/components/WPIcons/FeatureIcons/Project.tsx
Usage:
import { ProjectOutline } from 'components/WPIcons';
<MenuItem icon={<ProjectOutline />}>Projects</MenuItem>;
Social Icons
Social media platform icons for sharing and integration.
Location: src/components/WPIcons/SocialIcons/
Common Social Icons
import {
FacebookIcon,
TwitterIcon,
LinkedInIcon,
InstagramIcon,
} from 'components/WPIcons';
<HStack>
<IconButton icon={<FacebookIcon />} aria-label='Facebook' />
<IconButton icon={<TwitterIcon />} aria-label='Twitter' />
<IconButton icon={<LinkedInIcon />} aria-label='LinkedIn' />
<IconButton icon={<InstagramIcon />} aria-label='Instagram' />
</HStack>;
Flag Icons
Country flag icons for international features.
Location: src/components/WPIcons/Flags/
Flag Usage
import { KenyanFlagIcon, NigerianFlagIcon } from 'components/WPIcons';
<Select>
<option value='KE'>
<KenyanFlagIcon /> Kenya
</option>
<option value='NG'>
<NigerianFlagIcon /> Nigeria
</option>
</Select>;
Illustrations
Complex graphics and empty state illustrations.
Location: src/components/WPIcons/Illustrations/
NoDataIcon
Empty state illustration for data tables and empty content.
Usage:
import NoDataIcon from 'components/WPIcons/Illustrations/NoDataIcon';
<VStack spacing={4}>
<NoDataIcon />
<Text>No data available</Text>
<Button onClick={handleRefresh}>Refresh</Button>
</VStack>;
WPAlertIcon
Alert illustrations for important notifications.
Usage:
import { WPAlertDangerIcon } from 'components/WPIcons/Illustrations/WPAlertIcon';
<Alert status='error'>
<WPAlertDangerIcon />
<AlertTitle>Important Alert</AlertTitle>
<AlertDescription>Please review the following information.</AlertDescription>
</Alert>;
PiggySaveIcon
Financial and savings-related illustrations.
Usage:
import PiggySaveIcon from 'components/WPIcons/Illustrations/PiggyBank';
<VStack>
<PiggySaveIcon />
<Text>Start Saving Today</Text>
<Button colorScheme='green'>Open Savings Account</Button>
</VStack>;
Logo Components
Brand identity elements and logos.
Location: src/components/WPIcons/
Logo (Main)
Primary WorkPay logo component.
Usage:
import Logo from 'components/WPIcons/Logo';
<Logo color='green' height='2rem' />;
LogoWhite
White version for dark backgrounds.
Usage:
import LogoWhite from 'components/WPIcons/LogoWhite';
<Box bg='dark'>
<LogoWhite height='2rem' />
</Box>;
LogoMobileWhite
Mobile-optimized white logo.
Usage:
import LogoMobileWhite from 'components/WPIcons/LogoMobileWhite';
<Box display={{ base: 'block', md: 'none' }}>
<LogoMobileWhite height='1.5rem' />
</Box>;
Icon Usage Patterns
Icon Props
All icons inherit from Chakra UI's Icon component and support:
| Prop | Type | Description |
|---|---|---|
| color | string | Icon color (theme color or CSS color) |
| size | string/number | Icon size (xs, sm, md, lg, xl, or pixel value) |
| boxSize | string/number | Width and height |
| ...rest | IconProps | All Chakra UI Icon props |
Common Usage Examples
Icon Buttons
<IconButton
icon={<SearchSolid />}
aria-label='Search'
size='sm'
colorScheme='blue'
variant='ghost'
/>
Menu Items
<MenuItem icon={<UserSolid />}>Profile Settings</MenuItem>
Input Elements
<InputGroup>
<InputLeftElement>
<SearchSolid color='gray.400' />
</InputLeftElement>
<Input placeholder='Search...' />
</InputGroup>
Status Indicators
<HStack>
<CheckSolid color='green.500' />
<Text>Completed</Text>
</HStack>
Responsive Icons
<Icon
as={HomeSolid}
boxSize={{ base: 4, md: 6 }}
color={{ base: 'gray.500', md: 'blue.500' }}
/>
Animated Icons
<Icon
as={RefreshSolid}
animation='spin 1s linear infinite'
onClick={handleRefresh}
/>
Icon with Badge
<Box position='relative'>
<BellSolid />
<Badge
colorScheme='red'
position='absolute'
top='-1'
right='-1'
borderRadius='full'
>
3
</Badge>
</Box>
Accessibility
ARIA Labels
<IconButton
icon={<EditSolid />}
aria-label='Edit user profile'
onClick={handleEdit}
/>
Screen Reader Support
<Icon as={CheckSolid} aria-hidden="true" />
<Text>Task completed</Text>
Focus Management
<IconButton
icon={<TrashSolid />}
aria-label='Delete item'
_focus={{ boxShadow: '0 0 0 2px red' }}
/>
Theming and Customization
Custom Colors
<Icon as={HomeSolid} color='brand.500' _hover={{ color: 'brand.600' }} />
Size Variations
<VStack>
<Icon as={UserSolid} boxSize={4} />
<Icon as={UserSolid} boxSize={6} />
<Icon as={UserSolid} boxSize={8} />
</VStack>
Theme Integration
// In theme
const theme = {
components: {
Icon: {
baseStyle: {
color: 'gray.600',
},
variants: {
primary: {
color: 'blue.500',
},
secondary: {
color: 'gray.400',
},
},
},
},
};
// Usage
<Icon as={SearchSolid} variant='primary' />;
Performance Considerations
Bundle Size
- Icons are tree-shakeable - only import what you need
- Use specific imports to reduce bundle size
- Consider icon fonts for very large icon sets
Lazy Loading
const LazyIcon = lazy(() => import('components/WPIcons/ComplexIllustration'));
<Suspense fallback={<Spinner />}>
<LazyIcon />
</Suspense>;
Caching
- SVG icons are cached by the browser
- Use consistent icon sizes to leverage caching
- Consider sprite sheets for repeated icons
Best Practices
Icon Selection
- Use consistent icon styles (all solid or all outline)
- Choose icons that match user mental models
- Test icons with different user groups
Icon Placement
- Place icons consistently (left of text, right of text)
- Use appropriate spacing between icons and text
- Consider icon hierarchy in complex layouts
Color and Contrast
- Ensure sufficient contrast ratios
- Use semantic colors for status icons
- Test with colorblind users
Icon Sizes
- Use consistent sizing scale
- Consider touch targets for mobile
- Ensure icons remain legible at small sizes
Related Components
- Button Components: Icon button implementations
- Form Components: Input icon integration
- Navigation Components: Menu and nav icons
- Status Components: Status indicator icons
Migration Notes
From Font Icons
// Old font icon approach
<i className="fa fa-user" />
// New component approach
<UserSolid />
Version Updates
- Check for breaking changes in icon names
- Update import paths when restructuring
- Test icon accessibility after updates