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-radio

v3.0.7

Published

Here are a few tips for using radio buttons:

Downloads

6

Readme


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

import '@thumbtack/tp-ui-element-radio'; import '@thumbtack/tp-ui-layout-form'; import '@thumbtack/tp-ui-layout-block-list'; import '@thumbtack/tp-ui-element-label';

Basic radio buttons

Here are a few tips for using radio buttons:

  • All of the radio buttons in a group share a name attribute. This enables keyboard navigation and ensures that only one radio button with a group is selected at once.
  • The checked attribute allows you to set a default value.
  • The label’s for attribute must match the id of the associated radio. This allows users to select the radio while clicking on the label text.
<div class="tp-input-wrap">
    <input
        class="tp-radio-input"
        name="input-basic-radio"
        type="radio"
        id="input-basic-radio-a"
        checked
    />
    <div class="tp-radio-image"></div>
    <label class="tp-label" for="input-basic-radio-a">Long Distance Moving</label>
</div>
<div class="tp-input-wrap">
    <input class="tp-radio-input" name="input-basic-radio" type="radio" id="input-basic-radio-b" />
    <div class="tp-radio-image"></div>
    <label class="tp-label" for="input-basic-radio-b">Furniture Moving and Heavy Lifting</label>
</div>
<div class="tp-input-wrap">
    <input class="tp-radio-input" name="input-basic-radio" type="radio" id="input-basic-radio-c" />
    <div class="tp-radio-image"></div>
    <label class="tp-label" for="input-basic-radio-c">Pool Table Moving</label>
</div>

Disabled radio buttons

Add the disabled attribute to the input element to make it visually and functionally disabled.

You should also use tp-label--disabled to visually disable the label.

<div class="tp-input-wrap">
    <input
        class="tp-radio-input"
        name="input-disabed"
        id="input-disabed-a"
        type="radio"
        checked
        disabled
    />
    <div class="tp-radio-image"></div>
    <label class="tp-label tp-label--disabled" for="input-disabed-a">Long Distance Moving</label>
</div>
<div class="tp-input-wrap">
    <input class="tp-radio-input" name="input-disabed" id="input-disabed-b" type="radio" disabled />
    <div class="tp-radio-image"></div>
    <label class="tp-label tp-label--disabled" for="input-disabed-b">
        Furniture Moving and Heavy Lifting
    </label>
</div>
<div class="tp-input-wrap">
    <input class="tp-radio-input" name="input-disabed" id="input-disabed-c" type="radio" disabled />
    <div class="tp-radio-image"></div>
    <label class="tp-label tp-label--disabled" for="input-disabed-c">Pool Table Moving</label>
</div>

Radio button with an error

The tp-radio-input--bad-news class can be used to visually represent an error.

This class only changes the radio button’s color. It should be used alongside an error message that helps users advance through the form.

<div class="tp-input-wrap">
    <input
        class="tp-radio-input tp-radio-input--bad-news"
        name="input-error"
        id="input-error-a"
        type="radio"
        checked
    />
    <div class="tp-radio-image"></div>
    <label class="tp-label tp-label--bad-news" for="input-error-a">Long Distance Moving</label>
</div>