@mmg-dev/webpipeline-icons-lwc
v1.1.0
Published
Webpipeline Icons — Lightning Web Components
Maintainers
Keywords
Readme
@mmg-dev/webpipeline-icons-lwc
Lightning Web Components aus der webpipeline-icons-Monorepo — für Salesforce-Projekte und Standalone-Nutzung. Jede Komponente besteht aus einem HTML-Template und einem JavaScript-Controller.
Installation
pnpm i -D @mmg-dev/webpipeline-icons-lwcLWC-Runtime-Dependencies (@lwc/engine-dom, @lwc/synthetic-shadow, @lwc/wire-service) werden automatisch mitinstalliert.
Hinweis: Die Beispiele verwenden
pnpm. Alternativ funktionierennpmoderyarnanalog (npm i -D,yarn add -D).
Standalone (außerhalb von Salesforce)
Das Bundle registriert automatisch alle Custom Elements beim Import:
import '@mmg-dev/webpipeline-icons-lwc';Danach sind alle Icons als Custom Elements verfügbar:
<!-- Standard (24×24) -->
<icon-navigation-arrow-down></icon-navigation-arrow-down>
<!-- Benutzerdefinierte Größe -->
<icon-navigation-arrow-down width="32" height="32"></icon-navigation-arrow-down>Salesforce DX (SFDX-Projekt)
Für Salesforce-Projekte die Source-Komponenten aus src/ in das eigene LWC-Verzeichnis kopieren:
cp -r node_modules/@mmg-dev/webpipeline-icons-lwc/src/components/* force-app/main/default/lwc/Dann in einer LWC-Komponente importieren:
// myComponent.js
import { LightningElement } from 'lwc';
export default class MyComponent extends LightningElement {}<!-- myComponent.html -->
<template>
<c-icon-navigation-arrow-down></c-icon-navigation-arrow-down>
<c-icon-navigation-arrow-down width="32" height="32"></c-icon-navigation-arrow-down>
</template>In SFDX wird der Namespace-Prefix
c-automatisch vorangestellt.
Farbe über CSS
icon-navigation-arrow-down {
color: var(--color-primary-500);
}Vollständiges Standalone-Beispiel
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8" />
<title>LWC Icons Demo</title>
<script type="module">
import '@mmg-dev/webpipeline-icons-lwc';
</script>
</head>
<body>
<icon-navigation-arrow-down></icon-navigation-arrow-down>
<icon-alert-cancel-circle-filled
width="32"
height="32"
aria-label="Fehler"
></icon-alert-cancel-circle-filled>
</body>
</html>Accessibility
<!-- Dekorativ (Default): aria-hidden="true" -->
<icon-navigation-arrow-down></icon-navigation-arrow-down>
<!-- Semantisch: mit sichtbarem Titel -->
<icon-navigation-arrow-down icon-title="Nach unten"></icon-navigation-arrow-down>
<!-- Semantisch: mit Screen-Reader-Label -->
<icon-navigation-arrow-down aria-label="Nach unten scrollen"></icon-navigation-arrow-down>- Dekorativ (Default):
aria-hidden="true"— Icon wird von Screen Readern ignoriert - Semantisch: Wenn
icon-titleoderaria-labelgesetzt ist →aria-hiddenwird entfernt,role="img"gesetzt
Empfehlung: Icons neben Text sind in der Regel dekorativ. Alleinstehende Icons (z.B. Icon-Buttons) brauchen ein aria-label.
Props
| Prop | Typ | Default | Beschreibung |
| ------------ | -------- | ------- | -------------------------------------------- |
| width | number | 24 | Breite in Pixel |
| height | number | 24 | Höhe in Pixel |
| icon-title | string | — | Rendert <title> im SVG, setzt role="img" |
| aria-label | string | — | Screen-Reader-Label, setzt role="img" |
Naming
| Kontext | Format | Beispiel |
| ------- | --------------- | ------------------------------ |
| LWC Tag | <icon-{name}> | <icon-navigation-arrow-down> |
