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 |
void
updates Focus styling
void
updates Blur styling
void
toggles checked attribute on
void
toggles checked attribute off
void
import { 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 |
void
writeValue function from the CVA interface
Parameter | value: any |
---|---|
Description |
void
registerOnChange implemented from the CVA interface
Parameter | fn: any |
---|---|
Description |
void
registerOnTouch implemented from the CVA interface
Parameter | fn: any |
---|---|
Description |
void
sets the disabled state.
Parameter | isDisabled: boolean |
---|---|
Description |
void
calls select function for the radio
void
calls deselect function for the radio
import { DaffRadioModule } from '@daffodil/design/radio'
@NgModule()
class DaffRadioModule {}