API reference: @salmonui/inputs/rating
RatingPropsinterface
import type { RatingProps } from '@salmonui/inputs/rating';interface RatingProps extends FieldCommonProps {
readonly value?: number | undefined;
readonly defaultValue?: number | undefined;
readonly onValueChange?: ((value: number, details: RatingChangeDetails) => void) | undefined;
readonly count?: number | undefined;
readonly min?: number | undefined;
readonly precision?: 'full' | 'half' | 'quarter' | 'exact' | undefined;
readonly clearable?: boolean | undefined;
readonly highlightSelectedOnly?: boolean | undefined;
readonly showLabel?: boolean | undefined;
readonly labelPlacement?: 'top' | 'bottom' | 'start' | 'end' | undefined;
readonly renderLabel?: ((ctx: {
readonly value: number;
readonly count: number;
}) => ReactNode) | undefined;
readonly icon?: ReactNode;
readonly emptyIcon?: ReactNode;
readonly renderItem?: ((ctx: {
readonly index: number;
readonly state: RatingItemState;
readonly fill: number;
}) => ReactNode) | undefined;
readonly showTooltip?: boolean | undefined;
readonly renderTooltip?: ((ctx: {
readonly value: number;
readonly count: number;
}) => ReactNode) | undefined;
readonly onHoverChange?: ((value: number | null) => void) | undefined;
readonly name?: string | undefined;
readonly form?: string | undefined;
readonly required?: boolean | undefined;
readonly disabled?: boolean | undefined;
readonly readOnly?: boolean | undefined;
readonly localeText?: RatingLocaleText | undefined;
readonly id?: string | undefined;
readonly dir?: 'ltr' | 'rtl' | 'auto' | undefined;
readonly className?: string | undefined;
readonly style?: CSSProperties | undefined;
readonly classNames?: {
readonly label?: string;
readonly items?: string;
readonly item?: string;
readonly value?: string;
readonly description?: string;
readonly error?: string;
} | undefined;
readonly ref?: Ref<HTMLElement> | undefined;
}
| Name | Signature | Description |
|---|---|---|
labeloptionalinherited | label?: ReactNode; | |
descriptionoptionalinherited | description?: ReactNode; | |
errorMessageoptionalinherited | errorMessage?: ((ctx: { readonly errors: readonly string[]; }) => ReactNode) | ReactNode; | Error text (or a function of the errors) shown while the field is invalid. |
invalidoptionalinherited | invalid?: boolean; | Forces the error state. |
validationoptionalinherited | validation?: FieldValidation; | Rules in the Data Grid vocabulary. |
validateOnoptionalinherited | validateOn?: ValidateOn; | When errors appear; default the |
sizeoptionalinherited | size?: FieldSize; | Metric set. Default |
valueoptional | readonly value?: number | undefined; | |
defaultValueoptional | readonly defaultValue?: number | undefined; | Default |
onValueChangeoptional | readonly onValueChange?: ((value: number, details: RatingChangeDetails) => void) | undefined; | |
countoptional | readonly count?: number | undefined; | Number of items. Default 5. |
minoptional | readonly min?: number | undefined; | Lowest value a selection can set; the cleared value. Default 0. |
precisionoptional | readonly precision?: 'full' | 'half' | 'quarter' | 'exact' | undefined; | Step: |
clearableoptional | readonly clearable?: boolean | undefined; | Shows a clear button while the value is above |
highlightSelectedOnlyoptional | readonly highlightSelectedOnly?: boolean | undefined; | Fills only the selected item. |
showLabeloptional | readonly showLabel?: boolean | undefined; | Shows the value next to the items. |
labelPlacementoptional | readonly labelPlacement?: 'top' | 'bottom' | 'start' | 'end' | undefined; | Where the value label sits. Default |
renderLabeloptional | readonly renderLabel?: ((ctx: {
readonly value: number;
readonly count: number;
}) => ReactNode) | undefined; | |
iconoptional | readonly icon?: ReactNode; | Filled icon. Default a star. |
emptyIconoptional | readonly emptyIcon?: ReactNode; | Empty icon. Default |
renderItemoptional | readonly renderItem?: ((ctx: {
readonly index: number;
readonly state: RatingItemState;
readonly fill: number;
}) => ReactNode) | undefined; | Replaces both icons of an item. |
showTooltipoptional | readonly showTooltip?: boolean | undefined; | Shows a value bubble over the hovered or focused step. |
renderTooltipoptional | readonly renderTooltip?: ((ctx: {
readonly value: number;
readonly count: number;
}) => ReactNode) | undefined; | |
onHoverChangeoptional | readonly onHoverChange?: ((value: number | null) => void) | undefined; | The step under the pointer, |
nameoptional | readonly name?: string | undefined; | Submitted name. Without it the radios share a generated name and are not submitted. |
formoptional | readonly form?: string | undefined; | |
requiredoptional | readonly required?: boolean | undefined; | |
disabledoptional | readonly disabled?: boolean | undefined; | |
readOnlyoptional | readonly readOnly?: boolean | undefined; | Display only: radios stay focusable but ignore changes; |
localeTextoptional | readonly localeText?: RatingLocaleText | undefined; | |
idoptional | readonly id?: string | undefined; | |
diroptional | readonly dir?: 'ltr' | 'rtl' | 'auto' | undefined; | |
classNameoptional | readonly className?: string | undefined; | |
styleoptional | readonly style?: CSSProperties | undefined; | |
classNamesoptional | readonly classNames?: {
readonly label?: string;
readonly items?: string;
readonly item?: string;
readonly value?: string;
readonly description?: string;
readonly error?: string;
} | undefined; | Part classes: |
refoptional | readonly ref?: Ref<HTMLElement> | undefined; | The root element ( |