{/* prettier-ignore */}
{/*
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 { Meta, Title } from '@storybook/blocks';
import * as CheckboxStories from './Checkbox.stories';

<Meta title="Components/Checkboxes" />

# Checkbox

A checkbox component that can be toggled between a checked an unchecked
state.

## Source

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

## Usage

Simple component that just needs a type, and, if checked, the `checked` flag.

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

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

## API

### Properties

| name    | type    | readonly | description  |
| ------- | ------- | -------- | ------------ |
| checked | boolean | true     | toggle state |

### Style Properties

| name                   | type   | description                                 |
| ---------------------- | ------ | ------------------------------------------- |
| alpha                  | number | opacity (transparency) of the checkbox      |
| backgroundColor        | string | color of Checkbox background when unchecked |
| backgroundColorChecked | string | color of Checkbox background when checked   |
| checkColor             | string | color of check icon                         |
| iconHeight             | number | height of check icon                        |
| icon                   | string | path the icon to use for the checkmark      |
| iconWidth              | number | width of check icon                         |
| radius                 | number | radius of Checkbox                          |
| strokeColor            | string | color of the Checkbox border                |
| strokeWidth            | number | width of Checkbox border                    |

### Methods

#### toggle(): void

Toggles `checked` state and updates UI accordingly. The "Enter" key is listened for and will also trigger `toggle()`.
