fast icon indicating copy to clipboard operation
fast copied to clipboard

feat: add ability to return only one element from `SlottedBehavior`

Open KingOfTac opened this issue 4 years ago • 0 comments

🙋 Feature Request

Sometimes you want a component to only support one element in a given slot.

🤔 Expected Behavior

The ability to tell slotted to return just one element. Like Ref currently does.

😯 Current Behavior

Currently Slotted will always return an array, even when using a filter function. After this change the return type of SlottedBehavior.getNodes would change to Node | NodeList

💁 Possible Solution

An additional configuration option to only return the first element that matches the filter.

KingOfTac avatar Dec 08 '21 19:12 KingOfTac