npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@thumbtack/tp-ui-element-label

v1.3.5

Published

When using a `<label>`, it’s important to ensure that the `<label>` is linked to a form element. You can do this by:

Downloads

6

Readme


package: '@thumbtack/tp-ui-element-label' kit: label/index.mdx platform: scss url: /components/label/scss/ mdxType: componentApi

import '@thumbtack/tp-ui-element-label'; import '@thumbtack/tp-ui-element-input'; import '@thumbtack/tp-ui-component-form-note';

Examples

When using a <label>, it’s important to ensure that the <label> is linked to a form element. You can do this by:

  1. Adding a for attribute to the <label> that matches the id of an associated form element.
  2. Wrapping the form element within the label. (You’ll have to add the tp-label class to an element within the <label> and not on the <label> itself.)

If done correctly, clicking on the label text should switch the browser’s focus to the form element.

Label with an input

<label class="tp-label" for="input-2781013281341440">Email address</label>
<input
    type="text"
    class="tp-text-input"
    id="input-2781013281341440"
    placeholder="[email protected]"
/>

Disabled label

Labels can appear visually disabled. It’s important to also disable the associated form element.

<label class="tp-label tp-label--disabled" for="input-22291815954776064">Email address</label>
<input
    type="text"
    class="tp-text-input"
    disabled
    id="input-22291815954776064"
    placeholder="[email protected]"
/>

Label with a validation error

You can change the label color to red when the associated form element has invalid data.

Validation errors must be also include text that explains the error. This helps guide the user and is crucial for users with visual impairments.

<label class="tp-label tp-label--bad-news" for="input-1301239354621952">Email address</label>
<input
    type="text"
    class="tp-text-input tp-text-input--bad-news"
    id="input-1301239354621952"
    value="example@exampl"
/>
<div class="tp-form-note tp-form-note--bad-news">The email address you entered is incorrect.</div>