Rating API

API documentation for Rating component

Rating#

Props#

Defines valid properties in Rating component.

nametypedefaultdescription
refRef<unknown>
null
The reference to the component instance.
pIfboolean
true
Whether the component should be rendered.
styleCSSProperties | ((instance?: RatingInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: RatingInstance) => string)
null
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
null
The component type to render.
asChildboolean
false
Whether the component should be rendered as a child component.
ptSafeRecord<RatingPassThrough>
null
The pass-through props to pass to the component
ptOptionsPassThroughOptions
null
The pass-through options to pass to the component
unstyledboolean
null
Whether the component should be rendered without classes.
dtunknown
null
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
null
The styles to use for the component.
childrenReactNode | ((instance: RatingInstance) => ReactNode)
null
The children to render.
namestring
null
Name of the element.
invalidboolean
false
When present, it specifies that the component should have invalid state style.
onIconReactNode
null
Icon for the on state.
offIconReactNode
null
Icon for the off state.
modelValuenumber
null
Value of the rating.
defaultValuenumber
null
The default value for the input when not controlled by `modelValue` .
starsnumber
5
Number of stars.
disabledboolean
false
When present, it specifies that the element should be disabled.
readOnlyboolean
false
When present, it specifies that component is read-only.
onChange(event: useRatingChangeEvent) => void
null
Callback function that is called when the value changes.
[key: string]any
null
pt-{optionName}-*-
null
Pass through attributes for customizing component. For more info, see Pass Through tab.

State#

Defines valid state in Rating component.

nametypedefaultdescription
valuenumber
null
focusedOptionIndexnumber
null
isFocusVisibleItemboolean
null

Exposes#

Defines the methods and properties exposed by Rating component.

nametypedefaultdescription
stateuseRatingState
null
Current state of the rating.

Interfaces#

Defines passthrough(pt) options of Rating component.

nametypedefaultdescription
rootRatingPassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the root's DOM element.

Types#

Instance of Toolbar component.

values
ComponentInstance<RatingProps, RatingState, RatingExposes>