PHPackages                             hananils/kirby-attrs-helper - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. hananils/kirby-attrs-helper

ActiveKirby-plugin[Utility &amp; Helpers](/categories/utility)

hananils/kirby-attrs-helper
===========================

Setting attributes on elements in snippets and templates quickly becomes convoluted. This gets worse if attributes require additional logic, like conditionally adding segmented values like classnames or datasets. Attributes helper mitigates this issue by offering a simple interface to set attributes.

2.0.0(10mo ago)67MITPHPPHP ^8.2

Since Oct 5Pushed 2mo ago3 watchersCompare

[ Source](https://github.com/hananils/kirby-attrs-helper)[ Packagist](https://packagist.org/packages/hananils/kirby-attrs-helper)[ Docs](https://kirby.hananils.de/plugins/attrs-helper)[ RSS](/packages/hananils-kirby-attrs-helper/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (2)Versions (3)Used By (0)

[![Kirby Attributes helper](.github/title.png)](.github/title.png)

Setting attributes on elements in snippets and templates quickly becomes convoluted. This gets worse if attributes require additional logic, like conditionally adding segmented values like classnames or datasets. Attributes helper mitigates this issue by offering a simple interface to set attributes.

Note

Please check out the online documentation at [kirby.hananils.de/plugins/attrs-helper](https://kirby.hananils.de/plugins/attrs-helper) for further information.

Usage
=====

[](#usage)

Attributes helper takes an associative array with the keys specifying the attribute names and the values specifying the corresponding attribute values. Values can either be static if passed as string or conditional if passed as array.

Static values
-------------

[](#static-values)

If values are passed as string, the plugin will create an attribute for each key using the given value.

```
