We've made significant enhancements to the icon library to improve usability and fix alignment issues:
size propcurrentColorCheck out our test page to see these improvements in action.
Install the core metadata and React components via npm or yarn:
npm install onebit-icon-reactyarn add onebit-icon-reactOnebit Icons are easy to use in React, HTML, or as inline SVGs. Import the icon you need and use it as a component, or copy the SVG/HTML as needed.
Import and render any icon as a React component:
import { OnebitHome } from 'onebit-icon-react';
function App() {
// Basic usage with default size (1em)
return <OnebitHome />;
}
Control icon size using the size prop or other methods:
// Using the size prop (sets both width and height)
<OnebitHome size={24} />
// Using width and height props
<OnebitHome width={24} height={24} />
// Using style
<OnebitHome style={{ width: '24px', height: '24px' }} />
// Using Tailwind classes
<OnebitHome className="w-6 h-6" />
Set icon colors using CSS classes or inline styles:
// Using className with Tailwind CSS
<OnebitHome className="text-blue-500" />
// Using inline style
<OnebitHome style={{ color: '#0088ff' }} />
// Color inheritance from parent
<div style={{ color: 'red' }}>
<OnebitHome /> {/* This icon will be red */}
</div>
Use the CSS classes to display icons via <i> tags:
<!-- include the CSS file -->
<link rel="stylesheet" href="https://unpkg.com/onebit-icon-font@1.2.1/build/onebit-icon.css" />
<!-- use the icon -->
<i class="onebit-Home" style="font-size: 24px; color: #4F46E5;"></i>
Copy SVG markup from the source and include directly:
<!-- SVGs now use viewBox and currentColor for better scaling and coloring -->
<svg viewBox="0 0 24 24" fill="currentColor" width="24" height="24">
<!-- ...paths... -->
</svg>Check out our examples gallery to see various icon sizes and coloring techniques in action.
size prop for consistent sizingaria-label for non-decorative iconsem or rem) for responsive designsWant to contribute new icons or improvements? We welcome contributions from the community!
Visit our GitHub repository to:
<!-- All icons follow this format for consistency -->
<svg viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
<path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"/>
</svg>Onebit Icons work well with UI component libraries. Here's an example with Tailwind CSS:
import { OnebitHome, OnebitMenuIcon } from 'onebit-icon-react';
const Header = () => (
<header className="flex items-center justify-between p-4 bg-white shadow">
<div className="flex items-center space-x-4">
<OnebitMenuIcon className="text-gray-700" size={24} />
<h1 className="text-xl font-semibold">Dashboard</h1>
</div>
<button className="flex items-center px-4 py-2 rounded bg-blue-600 text-white">
<OnebitHome size={16} className="mr-2" />
<span>Go Home</span>
</button>
</header>
);You can apply CSS animations to icons for interactive effects:
/* CSS animation example */
.spinning-icon {
animation: spin 2s linear infinite;
}
@keyframes spin {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}
/* Usage in React */
<OnebitHomeIcon size={24} className="spinning-icon text-blue-500" />
/* Hover effects */
.icon-hover {
transition: transform 0.2s ease;
}
.icon-hover:hover {
transform: scale(1.1);
}size prop for consistent sizingVisit our GitHub Issues page to report bugs or ask questions. We're here to help!