@bdt-component-library/radio

Radio component

Usage no npm install needed!

<script type="module">
  import bdtComponentLibraryRadio from 'https://cdn.skypack.dev/@bdt-component-library/radio';
</script>

README

Radio Component

About

This is a component published as its own package from our component library monorepo: https://github.com/BenefitsDataTrust/ui-components. Setup instructions, as well as higher-level goals and concerns can be found from the main project README.

Description

Handles display of radio buttons according to style guide conventions.

API

prop type required default explanation
className string no "" Adds an optional classname to the component
label string yes no Text for input label
id string yes no Input id attr
name string yes no Input name attr
value string yes no Input value
disabled boolean no false Determines input disabled state
checked boolean yes false Determines input disabled state
isRequired boolean no false Determines if the input is required
hasError boolean no false Determines if the radio is in an error state
inputRef any no no React ref for input
onChange function(e: event) no undefined Event handler for onchange events
onClick function(e: event) no () => {} Event handler for onclick event on the radio input
testId string no "" Allows an id to be added for testing purposes via the data-testid attr