1.5.2 • Published 5 months ago

@volvo-cars/react-forms v1.5.2

Weekly downloads
-
License
UNLICENSED
Repository
github
Last release
5 months ago

@volvo-cars/react-forms

Questions? Ask in Slack #vcc-ui

Applies class names from @volvo-cars/css.

Checkbox

Checkboxes allow the user to toggle an option on or off.

The Checkbox component renders an <input type="checkbox"> with a <label> and an optional hint.

Unlike the VCC UI Checkbox, it can be used both as a controlled or uncontrolled component.

Examples

<Checkbox name="check" id="check-1" label="Checkbox" defaultChecked />
() => {
  const [checked, setChecked] = React.useState(true);
  return (
    <Checkbox
      name="check"
      id="check-2"
      label="Checkbox"
      checked={checked}
      onChange={(e) => setChecked(e.target.checked)}
    />
  );
};

Invalid state

<Checkbox
  name="check"
  id="check-2"
  label="Checkbox"
  hint="Please check"
  aria-invalid
  required
/>

Radio

Radios allow the user to select a single option from a group. Radios are designed to be used with the RadioGroup component.

The Radio component renders an <input type="radio"> with a <label> and an optional hint.

Unlike the VCC UI Radio, it can be used both as a controlled or uncontrolled component.

Examples

<Radio name="radio" id="radio-1" label="Radio" defaultChecked />

RadioGroup

Radio groups are used to group multiple radios in a single form control.

The Radio component renders a <fieldset> with a <legend>, an optional hint and the child radio inputs.

It can also set the disabled, required and name props for it's child radio inputs.

Example

<RadioGroup
  legend="Choose your terms"
  name="terms"
  onChange={(event) => console.log(event.target.value)}
  hint="Select your terms"
  required
>
  <Radio id="terms-6000" value="6000" label="6000 km/yr" />
  <Radio id="terms-8000" value="8000" label="8000 km/yr" />
</RadioGroup>
1.5.2

5 months ago

1.5.1

7 months ago

1.5.0

8 months ago

1.4.5

8 months ago

1.4.4

9 months ago

1.4.3

10 months ago

1.4.2

10 months ago

1.4.1

10 months ago

1.4.0

10 months ago

1.3.0

11 months ago

1.2.4

11 months ago

1.2.3

11 months ago

1.2.2

11 months ago

1.2.1

1 year ago

1.2.0

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.2

1 year ago

1.0.1

2 years ago

0.13.1

2 years ago

0.13.0

2 years ago

0.12.0

2 years ago

0.11.3

2 years ago

0.11.2

2 years ago

0.11.0

2 years ago

0.10.1

2 years ago

0.11.1

2 years ago

0.10.0

2 years ago

0.9.0

2 years ago

0.8.2

2 years ago

0.8.1

2 years ago

0.8.0

2 years ago

0.7.0

2 years ago

1.0.0

2 years ago

0.1.0

2 years ago

0.3.0

2 years ago

0.0.3

2 years ago

0.2.0

2 years ago

0.6.2

2 years ago

0.5.0

2 years ago

0.0.5

2 years ago

0.4.0

2 years ago

0.0.4

2 years ago

0.6.1

2 years ago

0.6.0

2 years ago

0.0.1

3 years ago