### File

`packages/components/eui-input-radio/eui-input-radio.component.ts`

### Description

A radio input component that implements form control functionality and custom styling. This component extends InputDirective and implements form control interfaces for seamless integration with Angular's form controls.

### Extends

`InputDirective`

### Implements

`OnInit` `DoCheck` `OnChanges` `ControlValueAccessor`

### Metadata

selector | `input[euiInputRadio]`
styleUrls | `./eui-input-radio.scss`

### Index

###### Methods

- registerOnChange
- registerOnTouched
- Optional setDisabledState
- writeValue
- getCssClasses

###### Inputs

- checked
- isInvalid
- value
- disabled
- euiDanger
- euiDisabled
- placeholder
- readonly

###### HostBindings

- attr.type
- class

###### HostListeners

- change
- keydown.space

###### Accessors

- isInvalid
- class
- defaultChecked
- selected
- value

### Constructor

`constructor()`

### Inputs

checked
Type : `any`
Gets or sets the default checked state of the radio input. This is different from the current checked state and represents the initial value.

isInvalid
Type : `boolean`
Gets or sets whether the radio input is in an invalid state. This can be set manually or will be automatically set when used with form validation.

value
Type : `any`
Gets or sets the value of the radio input. The value can be of any type and will be used when the radio is selected in a form group.

disabled
Type : `boolean`

euiDanger
Type : `boolean`
Default value : `false`

euiDisabled
Type : `boolean`
Default value : `false`

placeholder
Type : `string | null`

readonly
Type : `any`

### HostBindings

attr.type
Type : `string`
Default value : `'radio'`

class
Type : `string`
Gets the CSS classes for the radio input component. Combines base classes with invalid state modifier if applicable.

### HostListeners

change
Arguments : `'$event'`
`change(event: Event)`

Handles change events on the radio input. Updates the model value when the radio selection changes.

Parameters :

Name | Optional | Description

event

No

- The change event

keydown.space
Arguments : `'$event'`
`keydown.space(event: KeyboardEvent)`

Handles space key press events. Prevents selection changes when the input is readonly.

Parameters :

Name | Optional | Description

event

No

- The keyboard event

### Methods

registerOnChange
`registerOnChange(fn: any)`

Registers a callback function that is called when the control's value changes.

Parameters :

Name | Type | Optional | Description

fn

`any`

No

- The callback function

Returns : `void`

registerOnTouched
`registerOnTouched(fn: any)`

Registers a callback function that is called when the control is touched.

Parameters :

Name | Type | Optional | Description

fn

`any`

No

- The callback function

Returns : `void`

Optional setDisabledState
`setDisabledState(isDisabled: boolean)`

Sets the disabled state of the radio input.

Parameters :

Name | Type | Optional | Description

isDisabled

`boolean`

No

- Whether the radio input should be disabled

Returns : `void`

writeValue
`writeValue(obj: string)`

Implements ControlValueAccessor.writeValue. Updates the checked state based on the form control value.

Parameters :

Name | Type | Optional | Description

obj

`string`

No

- The value to write

Returns : `void`

getCssClasses
`getCssClasses(rootClass: string)`

Parameters :

Name | Type | Optional
rootClass | `string` | No

Returns : `string`

### Accessors

isInvalid
get `isInvalid()`
Gets or sets whether the radio input is in an invalid state. This can be set manually or will be automatically set when used with form validation. Returns : `boolean`
set `isInvalid(state: BooleanInput)`

Parameters :

Name | Type | Optional
state | `BooleanInput` | No

Returns : `void`

class
get `class()`
Gets the CSS classes for the radio input component. Combines base classes with invalid state modifier if applicable. Returns : `string`

defaultChecked
get `defaultChecked()`
Gets or sets the default checked state of the radio input. This is different from the current checked state and represents the initial value. Returns : `any`
set `defaultChecked(value: BooleanInput)`

Parameters :

Name | Type | Optional
value | `BooleanInput` | No

Returns : `void`

selected
get `selected()`
Gets whether the radio input is currently selected. Returns : `boolean`

value
get `value()`
Gets or sets the value of the radio input. The value can be of any type and will be used when the radio is selected in a form group. Returns : `any`
set `value(value)`

Parameters :

Name | Optional
value | No

Returns : `void`

# results matching ""

# No results matching ""