<!--
  Copyright 2023 Comcast Cable Communications Management, LLC

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.

  SPDX-License-Identifier: Apache-2.0
-->

import { Canvas, Story } from '@storybook/addon-docs';
import Radio from '.';

# Radio

A radio has 2 states: "on" or "off". When used in a group, it should let a user select only one of the choices at a time. This can be managed with the withSelections mixin

## Source

https://github.com/rdkcentral/Lightning-UI-Components/blob/develop/packages/@lightningjs/ui-components/src/components/Radio/Radio.js

## Usage

Simple component that just needs a type.

```js
import { Radio } from '@lightningjs/ui-components';

class Example extends lng.Component {
  static _template() {
    return {
      Radio: {
        type: Radio
      }
    };
  }
}
```

<Canvas>
  <Story id="utilities-radio--radio" />
</Canvas>

## API

### Properties

| name    | type    | required | default | description  |
| ------- | ------- | -------- | ------- | ------------ |
| checked | boolean | false    | false   | toggle state |

### Style Properties

| name                   | type   | description                            |
| ---------------------- | ------ | -------------------------------------- |
| backgroundColor        | string | background color of the Radio          |
| backgroundColorChecked | string | color of Radio background when checked |
| knobColor              | string | color of the Radio knob                |
| knobHeight             | number | height of knob                         |
| knobWidth              | number | width of knob                          |
| radius                 | number | border radius                          |
| strokeColor            | string | color of the Radio border              |
| strokeWidth            | number | border width                           |

### Methods

#### toggle(): void

Toggles `checked` state and updates UI accordingly
