Checkbox label with URL link in Semantic UI React

4.9k Views Asked by At

Semantic UI React Checkbox can be used like this:

import React from 'react'
import { Checkbox } from 'semantic-ui-react'

const TermsOfServiceCheckbox = () => (
  <Checkbox label='I accept the Terms of Service' />
)

export default TermsOfServiceCheckbox

How do I set the Checkbox label so that the text Terms of Service is a link to a URL?

1

There are 1 best solutions below

2
On BEST ANSWER

label prop implements the item shorthand, so you can also pass there:

<Checkbox label={<label><a href='/'>I accept the Terms of Service</a></label>} />
<Checkbox label={<label>I accept the <a href='/'>Terms of Service</a></label>} />
<Checkbox label={{ children: <a href='/'>I accept the Terms of Service</a> }} />