🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

@material/radio

Package Overview
Dependencies
Maintainers
15
Versions
1698
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@material/radio

The Material Components for the web radio component

14.0.0
latest
Source
npm
Version published
Weekly downloads
587K
-0.59%
Maintainers
15
Weekly downloads
 
Created

What is @material/radio?

@material/radio is a Material Design radio button component for the web. It provides a set of customizable radio buttons that adhere to the Material Design guidelines, ensuring a consistent and visually appealing user interface.

What are @material/radio's main functionalities?

Basic Radio Button

This code sample demonstrates a basic radio button using the @material/radio package. It includes the necessary HTML structure and CSS classes to create a Material Design radio button.

<div class="mdc-form-field">
  <div class="mdc-radio">
    <input class="mdc-radio__native-control" type="radio" id="radio-1" name="radios" checked>
    <div class="mdc-radio__background">
      <div class="mdc-radio__outer-circle"></div>
      <div class="mdc-radio__inner-circle"></div>
    </div>
  </div>
  <label for="radio-1">Radio 1</label>
</div>

Disabled Radio Button

This code sample shows how to create a disabled radio button using the @material/radio package. The 'disabled' attribute is added to the input element to make the radio button non-interactive.

<div class="mdc-form-field">
  <div class="mdc-radio">
    <input class="mdc-radio__native-control" type="radio" id="radio-2" name="radios" disabled>
    <div class="mdc-radio__background">
      <div class="mdc-radio__outer-circle"></div>
      <div class="mdc-radio__inner-circle"></div>
    </div>
  </div>
  <label for="radio-2">Radio 2 (Disabled)</label>
</div>

Custom Styling

This code sample demonstrates how to apply custom styling to a radio button using the @material/radio package. Custom CSS is used to change the color of the radio button's outer circle and inner circle.

<style>
  .custom-radio .mdc-radio__background {
    border-color: #ff5722;
  }
  .custom-radio .mdc-radio__inner-circle {
    background-color: #ff5722;
  }
</style>
<div class="mdc-form-field custom-radio">
  <div class="mdc-radio">
    <input class="mdc-radio__native-control" type="radio" id="radio-3" name="radios">
    <div class="mdc-radio__background">
      <div class="mdc-radio__outer-circle"></div>
      <div class="mdc-radio__inner-circle"></div>
    </div>
  </div>
  <label for="radio-3">Custom Styled Radio</label>
</div>

Other packages similar to @material/radio

Keywords

material components

FAQs

Package last updated on 28 Apr 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts