question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature Request: Custom Attributes

See original GitHub issue

I don’t think that this exists even in React as of now. But I found this feature really helpful in making custom functions for my application.

  • The basic idea here is that we can pass in a custom attribute to the element that is linked to a global function or local function that defines functionality of the attribute

Example

  • <img src="Someting.jpg" />. In case this fails you need to add a onError handler to manage the error state. Moreover these functions needs to be defined throughout the application and adding more functionality in such cases is difficult.
  • So the custom attribute will do something like <img source="Someting.jpg" />. The source attribute is technically a function that takes the value and a reference to the element.
  • Just custom functionality can be added more easily

In case I was unable to explain it properly Aurelia.JS has it and its pretty useful. https://aurelia.io/docs/templating/custom-attributes#introduction

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
Marcisbeecommented, Jul 23, 2018

This feature is in the latest release.

The path I took was

Radi.customAttribute('relative-size', (element, value) => {
  element.style.fontSize = value + 'em';
  return `changed-${value * 100}`;
}, {
  allowedTags: ['li', 'ul'],  // Tags that can have this (default: null -> all tags)
  addToElement: true,         // Should add value/function to DOM node (default: true)
})

This example definition will work like this:

<li relative-size={1.5}></li>

and output this (because addToElement was set):

<li relative-size="changed-150"></li>
1reaction
rafaelklaessencommented, May 2, 2018

I think that HOCs are already working with Radi since they aren’t really React-specific.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Customizing Feature Request and Feedback Attributes - Savio
Savio helps organize your customer feedback and feature requests from the time you receive them until you build them. We let you filter...
Read more >
[Feature Request] Ability to set custom attributes for the user ...
We would love to be able to manage user resources via TF but the lack of support for custom attributes is a real...
Read more >
Custom attributes and feedback segmentation - Canny
You want to focus on your most loyal customers. You can segment to only show feedback from customers who signed up more than...
Read more >
Custom attributes / Custom fields - Paperpile Forum
Hello, I have a feature request for Paperpile: Custom attributes. I'd like to annotate papers with attributes. An attribute is just a named ......
Read more >
Feature request: allow custom attributes in csv import
Thank you for your request. For a custom attribute import you can use API. 0 ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found