Skip to content
Snippets Groups Projects
README.md 919 B
Newer Older
Bekerle, Patrizio's avatar
Bekerle, Patrizio committed
# Common Code
Reiter, Christoph's avatar
Reiter, Christoph committed

You can install these components via npm:

```bash
npm i @dbp-toolkit/common
```

Reiter, Christoph's avatar
Reiter, Christoph committed
## Icon Web Component

For valid icon names see: [LineIcons](https://lineicons.com/icons/)
Reiter, Christoph's avatar
Reiter, Christoph committed

```html
 <dbp-icon color="orange" name="menu-down"></dbp-icon>
Reiter, Christoph's avatar
Reiter, Christoph committed
```

### Exposed CSS variables

Variables like `--dbp-override-icon-<icon-name>` can be used to override the icons.

Example CSS: `html { --dbp-override-icon-cloud: url(/icons/cloud.svg); }`

## Translated Web Component

You can use this web component to show translated html.

```html
<dbp-translated subscribe="lang">
    <div slot="de">
Bekerle, Patrizio's avatar
Bekerle, Patrizio committed
        Dieser Text ist Deutsch und wird Englisch werden wenn man die Sprache auf Englisch stellt.
    </div>
    <div slot="en">
        This text is English and will be German if the language is changed to German.
    </div>
</dbp-translated>
```

The English or German text will be shown according to the `lang` attribute.