Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@leafygreen-ui/radio-group

Package Overview
Dependencies
Maintainers
3
Versions
87
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@leafygreen-ui/radio-group

leafyGreen UI Kit RadioGroup

  • 7.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
101K
increased by143.62%
Maintainers
3
Weekly downloads
 
Created
Source

Radio Group

npm (scoped)

View on Storybook

Installation

Yarn

yarn add @leafygreen-ui/radio-group

NPM

npm install @leafygreen-ui/radio-group

Example

import { Radio, RadioGroup } from '@leafygreen-ui/radio-group';

<RadioGroup
  className="my-radio-group"
  variant="default"
  onChange={event => console.log('hi')}
  value="option-1"
  name="name-of-input-group"
>
  <Radio className="my-radio" value="option-1">
    Label Text Goes Here
  </Radio>
</RadioGroup>;

Output HTML

<div
  class="leafygreen-ui-16glayc my-radio-group"
  role="group"
  aria-label="radio-group-660118"
>
  <label
    for="radio-group-660118-button-0"
    class="leafygreen-ui-11wfvmq my-radio"
  >
    <input
      id="radio-group-660118-button-0"
      name="name-of-input-group"
      type="radio"
      class="leafygreen-ui-i6tne my-radio"
      aria-checked="true"
      aria-disabled="false"
      value="option-1"
    />
    <span class="leafygreen-ui-1l7rt9l">Label Text Goes Here</span>
  </label>
</div>

Properties

PropTypeDescriptionDefault
darkModebooleanDetermines whether or not the component appears in dark modefalse
namestringSets the name of the input group
valuestring | numberSets the radio that will appear checked on page load, also makes the component a controlled component
classNamestringAdds a className to the root element.''
onChangefunctionThe event handler function for the 'onchange' event. Receives the associated event object as the first argument.() => {}
childrennodeCan be any node; however, any <Radio /> components, will be treated as belonging to the <RadioGroup /> compound component, and will receive internal state from <RadioGroup />
size'xsmall' | 'small' | 'default'Sets the size for the Radios. Use of xsmall should be limited to only Chartsdefault

Any other properties will be spread on the root element.

Radio

Example

<Radio className="my-radio" value="option-1" disabled={true}>
  Label Text Goes Here
</Radio>

Output HTML

<label class="leafygreen-ui-11wfvmq my-radio">
  <input
    type="radio"
    class="leafygreen-ui-i6tne"
    aria-checked="false"
    disabled="true"
    aria-disabled="true"
    value="option-1"
  />
  <span class="leafygreen-ui-1l7rt9l">Label Text Goes Here</span>
</label>

Properties

PropTypeDescriptionDefault
value (Required)string | numberEvery <Radio /> needs a value prop.
classNamestringAdds a className to the label''
disabledbooleanIndicates whether or not the radio can be clicked by a userfalse
childrennodeText that appears adjacent to the radio input; label text.
defaultbooleanIf <RadioGroup /> is uncontrolled, the default property makes this Radio checked on the initial render.
checkedbooleanDetermines if <Radio /> will appear checkedfalse
...native input attributesAny other props will be spread on the root input element

FAQs

Package last updated on 04 Dec 2020

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc