Material-ui: [Checkbox] How to add a custom attribute?

Created on 8 May 2016  路  2Comments  路  Source: mui-org/material-ui

How can I add a custom attribute and get its value within onCheck handler?

Example:

<Checkbox
    label={this.props.label}
    onCheck={this.onCheck}
    checked={this.props.checked}
    labelStyle={{width: 'initial'}}
    data-my-custom-attribute="FOO" // the attribute
/>

onCheck(e, checked) {

    //  How to get the attribute here?
    let foo = e.target.getAttribute('data-my-custom-attribute'); // foo === "FOO"
}
question

All 2 comments

This has to be the worst handling of an issue ever. Gotta remember this guy cause I don't want him on my team.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

activatedgeek picture activatedgeek  路  3Comments

anthony-dandrea picture anthony-dandrea  路  3Comments

rbozan picture rbozan  路  3Comments

sys13 picture sys13  路  3Comments

FranBran picture FranBran  路  3Comments