mardi 12 décembre 2017

How to add a link within a checkbox attribute

I am trying to implement a Microsoft Fabric UI checkbox with a link in the checkbox. Here is the render function from the documentation:

public render() {
    let { isChecked } = this.state;

    return (
      <div>
        <Checkbox
          label='Standard checkbox'
          onChange={ this._onCheckboxChange }
          ariaDescribedBy={ 'descriptionID' }
        />
      </div>
    );
  }

In the label section I want to have a link to go to another page. When I try to add the anchor tag within label it displays on the page as the actual HTML snippet, not a link. I also tried replacing label with a variable:

var text = "I agree to the <a href='#'>terms</a>.";
...
label={text}

and had the same problem. Is there a way to work around this? Something to tell the browser to actually render the HTML as HTML? I know I could implement this with a regular checkbox but then it wouldn't have the same look and feel




Aucun commentaire:

Enregistrer un commentaire