### File

`packages/ecl/components/ecl-rating-field/ecl-rating-field.component.ts`

### Description

Component representing rating field, displayed with stars. Typically used when the user needs to evaluate something.

### Extends

`ECLBaseDirective`

### Implements

`ControlValueAccessor`

### Metadata

providers | `ECL_RATINGFIELD_VALUE_ACCESSOR`
selector | `ecl-rating-field`
imports | `EUI_ECL_ICON`
templateUrl | `./ecl-rating-field.component.html`

### Index

###### Methods
onRadioClick registerOnChange registerOnTouched setDisabledState writeValue getCssClasses
###### Inputs
disabled name numberOfStars rating class e2eAttr tabindex
###### Outputs
ratingChange
###### HostBindings
class
###### Accessors
numbers cssClasses

### Inputs

disabled
Type : `boolean`
Can be used to set disabled status.

name
Type : `string`
Default value : `'rating'`
Name of the radio group. Also used for creating id for each radio button.

numberOfStars
Type : `number`
Default value : `5`
How many stars should the rating have.

rating
Type : `number`
The initial value, if any.

class
Type : `string`

e2eAttr
Type : `any`

tabindex
Type : `number`

### Outputs

ratingChange
Type : `EventEmitter`
The event to be emitted when rating is changed.

### HostBindings

class
Type : `string`
Applies the base class `ecl-rating-field` to the host element. Applies 'ecl-rating-field--disabled' class on condition.

### Methods

onRadioClick
`onRadioClick(rating: number)`
Method that sets the new rating and emit 'ratingChange' event, that includes the new rating number. Parameters :
Name | Type | Optional | Description
rating | `number` | No | the new rating
Returns : `void`

registerOnChange
`registerOnChange(fn: any)`
Parameters :
Name | Type | Optional
fn | `any` | No
Returns : `void`

registerOnTouched
`registerOnTouched(fn: any)`
Parameters :
Name | Type | Optional
fn | `any` | No
Returns : `void`

setDisabledState
`setDisabledState(isDisabled: boolean)`
Disable/enable component. Parameters :
Name | Type | Optional
isDisabled | `boolean` | No
Returns : `void`

writeValue
`writeValue(value: number)`
Informs the component of any changes in the parent (ControlValueAccessor). Sets the new value for the 'rating' property. Parameters :
Name | Type | Optional
value | `number` | No
Returns : `void`

getCssClasses
`getCssClasses(rootClass: string)`
Parameters :
Name | Type | Optional
rootClass | `string` | No
Returns : `string`

### Accessors

numbers
get `numbers()`
Array of numbers, from 1 to 'numberOfStars' Returns : `Array<number>`

cssClasses
get `cssClasses()`
Applies the base class `ecl-rating-field` to the host element. Applies 'ecl-rating-field--disabled' class on condition. Returns : `string`

# results matching ""

# No results matching ""