11.0.1 • Published 24 days ago

@leafygreen-ui/radio-group v11.0.1

Weekly downloads
278
License
Apache-2.0
Repository
github
Last release
24 days ago

Radio Group

npm (scoped)

View on MongoDB.design

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"
    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
11.0.1

24 days ago

11.0.0

1 month ago

10.2.5

2 months ago

10.2.4

3 months ago

10.2.3

7 months ago

10.1.11

9 months ago

10.2.0

9 months ago

10.1.10

9 months ago

10.2.1

8 months ago

10.2.2

8 months ago

10.1.6

10 months ago

10.1.7

10 months ago

10.1.8

9 months ago

10.1.9

9 months ago

11.0.0-alpha.1

10 months ago

11.0.0-alpha.0

10 months ago

10.1.4-next.5

12 months ago

10.1.4-next.4

12 months ago

10.1.4-next.3

12 months ago

10.1.4-next.2

12 months ago

10.1.4-next.1

12 months ago

10.1.4-next.0

12 months ago

10.1.4

11 months ago

10.1.5

11 months ago

10.1.2

12 months ago

10.1.3

12 months ago

10.1.4-next.7

12 months ago

10.1.4-next.6

12 months ago

10.1.0

1 year ago

10.1.1

1 year ago

10.0.5

1 year ago

10.0.0

1 year ago

10.0.1

1 year ago

10.0.2

1 year ago

10.0.3

1 year ago

10.0.4

1 year ago

8.1.0

2 years ago

8.1.2

2 years ago

8.1.1

2 years ago

8.1.0-test.1

2 years ago

9.0.0

2 years ago

8.1.0-next.2

2 years ago

8.1.0-next.1

2 years ago

8.1.0-next.0

2 years ago

8.0.4

2 years ago

8.1.0-test.0

2 years ago

8.0.3

2 years ago

8.0.2

2 years ago

8.0.1

2 years ago

8.0.0

2 years ago

7.0.6

3 years ago

7.0.5

3 years ago

7.0.4

3 years ago

7.0.3

3 years ago

7.0.2

3 years ago

7.0.1

3 years ago

7.0.0

3 years ago

6.0.3

3 years ago

6.0.2

3 years ago

6.0.1

4 years ago

6.0.0

4 years ago

5.1.0

4 years ago

5.0.0

4 years ago

4.0.3

4 years ago

4.0.2

4 years ago

4.0.1

4 years ago

4.0.0

4 years ago

3.0.1

4 years ago

3.0.0

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.3.4

5 years ago

1.3.3

5 years ago

1.3.2

5 years ago

1.3.1

5 years ago

1.3.0

5 years ago

1.2.2

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.7

5 years ago

1.1.6

5 years ago

1.1.5

5 years ago

1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago