Custom Icons
How to customize checkbox icons in React Checkbox Pro
Custom Icons
Learn how to customize the checkbox icons to match your design system.
Example
Checkbox with custom icons
Usage
Basic Icon Customization
Different Icons for States
With Animation
Icon Props
Prop | Type | Description |
---|---|---|
icon | ReactNode | Default icon shown when checked |
checkedIcon | ReactNode | Alternative icon for checked state |
indeterminateIcon | ReactNode | Icon shown in indeterminate state |
Best Practices
-
Icon Sizing:
- Match icon size with checkbox size
- Use consistent sizing across your app
- Consider touch targets on mobile
-
Accessibility:
- Ensure icons have good contrast
- Add appropriate ARIA labels
- Test with screen readers
-
Performance:
- Optimize SVG icons
- Consider using icon libraries
- Lazy load complex icons
-
Design:
- Maintain visual hierarchy
- Use consistent style
- Consider animation for better UX