@swiss-ui/icons
v1.0.0
Published
SVG icon set for Swiss UI design system
Downloads
73
Readme
@swiss-ui/icons
SVG icon set for the Swiss UI design system.
Installation
npm install @swiss-ui/iconsUsage
As a Library
You can import individual icon functions or a general getIcon helper.
import { ArrowRight, getIcon } from '@swiss-ui/icons';
// Using a specific icon function
const arrow = ArrowRight({ size: 32, color: 'blue' });
// Using the helper
const icon = getIcon('check-circle', { strokeWidth: 1.5 });As a Web Component
Register the web component (auto-registers on import from the subpath) and use it in your HTML:
// Import to register <swiss-icon>
import '@swiss-ui/icons/web-components';<swiss-icon name="search" size="20" color="#333" stroke-width="2"></swiss-icon>Customization
All icons support the following properties:
| Property | Type | Default | Description |
| :--- | :--- | :--- | :--- |
| size | number | 24 | Width and height in pixels |
| color | string | currentColor | Stroke color (supports any CSS color value) |
| strokeWidth | number | 2 | Thickness of the icon lines |
| class | string | undefined | Additional CSS class for the <svg> element |
Development
Adding New Icons
- Place your new SVG file in
src/icons/. - Ensure it uses a
24x24viewbox andstroke="currentColor". - Run the build script to generate the TypeScript source:
npm run build:iconsBuilding the Project
To build the library for distribution:
npm run buildLicense
AGPL-3.0-only. See LICENSE for details.
