UNPKG

@progress/kendo-themes-html

Version:

A collection of HTML helpers used for developing Kendo UI themes

38 lines (37 loc) 1.3 kB
import { KendoComponent } from '../_types/component'; export declare const RATING_CLASSNAME = "k-rating"; declare const states: ("disabled" | "readonly")[]; export type RatingState = { [K in (typeof states)[number]]?: boolean; }; export type RatingProps = { max?: number; min?: number; value: number; label?: string; dir?: "rtl" | "ltr"; }; /** * Rating component - star rating input using slider pattern. * * @accessibility * - Uses `role="slider"` to announce the rating as a slider * - Uses `aria-valuenow` for current value, `aria-valuemin` and `aria-valuemax` for range * - Uses `tabindex="0"` to make the element focusable (removed when disabled) * - Must have accessible name via `aria-label`, `aria-labelledby`, or `title` * - Uses `aria-disabled="true"` when disabled * - Uses `aria-readonly="true"` when readonly (can focus but not change) * * @example * ```tsx * // Basic rating * <Rating value={3} aria-label="Product rating" /> * * // Readonly rating display * <Rating value={4.5} readonly aria-label="Average rating" /> * ``` * * @wcag 4.1.2 Name, Role, Value - slider must have accessible name and value */ export declare const Rating: KendoComponent<RatingState & RatingProps & React.HTMLAttributes<HTMLSpanElement>>; export default Rating;