Using Default Icons (Lucide)
lucide-react is pre-installed in Sabo, so you can use it right away. Lucide offers over 800 clean, line-style icons.
1
Find an Icon
Visit the Lucide website and find the name of the icon you want to use. For example, let’s find the ‘check’ icon.
2
Import the Icon Component
Import the icon from
lucide-react using its PascalCase name.Button.tsx
3
Customize Styles
Icon components are SVGs, so you can freely customize their size, color, and more using Tailwind CSS utility classes.You can also pass props directly to the component to control specific SVG attributes, as shown in the official documentation.
Status.tsx
VerifiedBadge.tsx
Using More Icons (React Icons)
If you can’t find the icon you need in Lucide, you can usereact-icons, which includes a huge collection of popular icon sets.
1
Install the Library
First, install
react-icons in your project.2
Find and Import an Icon
Find an icon on the React Icons website (e.g., the GitHub icon from Font Awesome).To optimize your bundle size, import icons from their specific sub-packages, not from the main library.
SocialLinks.tsx
Icon Usage Recommendations
Maintain Consistency
For design consistency, prioritize using icons from the defaultlucide-react library whenever possible. This ensures your application maintains a clean and cohesive look.
Ensure Accessibility
When an icon’s meaning isn’t universally clear, use a text label alongside it. It’s also good practice to add anaria-label for screen reader users to make your application accessible to everyone.