Radio is used to select a single value from a selection of values.
import { DaffRadioComponent } from '@daffodil/design/radio'
@Component()
class DaffRadioComponent implements OnInit {
disabled: boolean = false
focused: boolean = false
@Input() checked: boolean
@Input() value: any
@Input() id: string = 'daff-radio-' + radioUniqueId
@Input() name: string = ''
@Input() label: string = this.name
@Input() labelledby: string
@Output() selectionChange: EventEmitter<boolean> = new EventEmitter()
onFocus(): void
onBlur(): void
select(): void
deselect(): void
onChange(): void
}
boolean| Default | – |
|---|---|
| Description | The checked property of the radio |
any| Default | – |
|---|---|
| Description | The value of the radio |
string| Default | 'daff-radio-' + radioUniqueId |
|---|---|
| Description | The id of the radio. It is uniquely generated but can be overwritten by the user. Must be unique. |
string| Default | '' |
|---|---|
| Description | Name of the Radio |
string| Default | this.name |
|---|---|
| Description | Used for aria-label. Default to name if user does not input a label. |
string| Default | – |
|---|---|
| Description | Used for aria-labelledby. |
EventEmitter| Default | – |
|---|---|
| Description | Output event of selection being changed |
voidupdates Focus styling
voidupdates Blur styling
voidtoggles checked attribute on
voidtoggles checked attribute off
voidimport { DaffRadioSetComponent } from '@daffodil/design/radio'
@Component()
class DaffRadioSetComponent {
@Input() name: string
}
string| Default | – |
|---|---|
| Description |
import { DaffRadioControlValueAccessorDirective } from '@daffodil/design/radio'
ControlValueAccessor functionality for the DaffRadio
@Directive()
class DaffRadioControlValueAccessorDirective implements OnInit, ControlValueAccessor {
_onChange: () => void
_onTouched: () => void
@Optional() @Self() _control: NgControl
@Input() value: any
@Input() name: string
writeValue(value: any): void
registerOnChange(fn: any): void
registerOnTouched(fn: any): void
setDisabledState(isDisabled: boolean): void
fireSelect(): void
fireDeselect(): void
}
any| Default | – |
|---|---|
| Description | The value of the ControlValueAccessor |
string| Default | – |
|---|---|
| Description | The name of the ControlValueAccessor |
voidwriteValue function from the CVA interface
| Parameter | value: any |
|---|---|
| Description |
voidregisterOnChange implemented from the CVA interface
| Parameter | fn: any |
|---|---|
| Description |
voidregisterOnTouch implemented from the CVA interface
| Parameter | fn: any |
|---|---|
| Description |
voidsets the disabled state.
| Parameter | isDisabled: boolean |
|---|---|
| Description |
voidcalls select function for the radio
voidcalls deselect function for the radio
import { DaffRadioModule } from '@daffodil/design/radio'
@NgModule()
class DaffRadioModule {}