# radio-selection

> This Angular Materail component that allows you to have radio button as a single or multiple selection

Latest version **0.1.2** (published 2022-05-16) · ISC license · 0 weekly downloads

## Install

```sh
npm install radio-selection
pnpm add radio-selection
yarn add radio-selection
bun add radio-selection
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2022-05-16 |
| First published | 2022-05-16 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 68.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Mike Boni |
| Maintainers | wavecoders |
| Keywords | angular, radio, selection, checkbox, multi-selection, material |

## Links

- npm: https://www.npmjs.com/package/radio-selection
- Homepage: https://wavecoders.ca
- npm.io page: https://npm.io/package/radio-selection

## Dependencies (1)

- [tslib](https://npm.io/package/tslib.md) ^2.3.0

## Recent versions

- 0.1.2 (latest) — 2022-05-16
- 0.0.1 — 2022-05-16

## README

# Radio Selection

Angular component using Radio buttons to allow for Single and Multiple selections. The radio button is in a Button to give a toggle type selections. Text and Radio are align to the left.

You can use a formControl to pass the defaults and to get the selected


## Installation
```
npm install radio-selection
```

## Scaffolding

Import the module into your project under imports

```
imports: [
    BrowserModule,
    AppRoutingModule,
    RadioSelectionModule
  ],
```

## Selector Usage

This is the basic selector with data

```
<wav-radio-selection [data]="sections"></wav-radio-selection>
```

Data strcuture for radio selection

```
sections = [
  { name: "step 01", title: 'Choose Model', disabled: false, id:1 },
  { name: "step 02", title: 'Basic Details', disabled: false, id: 2 },
  { name: "step 03", title: 'Topics', disabled: true, id: 3 },
]
```

The `disabled` property if present in the data will disable the radio selection

## Inputs

The following Inputs are available

| Input | Type | Defaut | Description |
| ----- | ---- | ------ | ----------- |
| data      | ARRAY (string[] any[])  | []  | data for radio buttons |
| key       | STRING  | ''  | value to emit on changes |
| value     | STRING  | ''  | label for display for radio |
| multi     | BOOLEAN  | false  | multiselection |
| layout    | STRING  | 'row'  | ROW or COLUMN layout |

## Outputs

| Event      | Type   | Description |
| ---------- | ------ | ----------- |
| change   | STRING | all radio selections as string - comma delimited based on key input |

## FormControl

`formControlName="radioSelection"`

```
<wav-radio-selection formControlName="radioSelection"></wav-radio-selection>

radioSelection = this.fb.control('1,2,3')
```

Example of input properties for an Object array of items

```
sections = [
  { name: "step 01", title: 'Choose Model', disabled: false, id:1 },
  { name: "step 02", title: 'Basic Details', disabled: false, id: 2 },
  { name: "step 03", title: 'Topics', disabled: true, id: 3 },
]
```

```
<wav-radio-selection
  [data]="sections"
  key="name"
  value="title"
  [multi]="true"
  [formControl]="radioGroup"
  layout="row"
></wav-radio-selection>
```

Example of the input properties for an Array of items

```
sections = ['Choose Model', 'Basic Details', 'Topics']
```

```
<wav-radio-selection
  [data]="sections"
  [multi]="true"
  [formControl]="radioGroup"
  layout="row"
></wav-radio-selection>
```

---
_Source: https://npm.io/package/radio-selection · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
