Search code examples
htmlangularprimeng

Is there a difference between using the label for a p-button or putting the name between the tags


Frontend-developement is pretty new to me and I have wondered if there is any difference between using:

<p-button label="OK"></p-button>

and

<p-button>OK</p-button>

Would be grateful for an explation!


Solution

  • They both do the same thing on the screen, but:

    • The first method is more explicit than the second and is generally considered good practice.
    • Screen readers and other assistive technology understand the first method for sure, but it is unlikely that all of them are able to understand the second one.