import { Rate } from 'sud-ui';점수를 선택할 때
import React, { useState } from "react";
import { Rate } from "sud-ui";
export default function Example() {
const [value, setValue] = useState(0);
return <Rate value={value} onChange={setValue} />;
}import React from "react";
import { Rate } from "sud-ui";
export default function Example() {
return <Rate showValue />;
}import React from "react";
import { Rate } from "sud-ui";
export default function Example() {
return <Rate count={100} showValue />;
}import React from "react";
import { Rate } from "sud-ui";
export default function Example() {
return <Rate disabled defaultValue={3} />;
}import React from "react";
import { Rate } from "sud-ui";
export default function Example() {
return <Rate icon="heart" />;
}import React from "react";
import { Rate } from "sud-ui";
import { UserFill, MoodSmileOutline, MoodSadOutline } from "sud-icons";
export default function Example() {
return (
<div className="flex flex-col justify-center gap-[20px]">
<Rate icon={<UserFill />} size={32} />
<Rate
icon={<MoodSmileOutline />}
size={32}
activeColor={"lime-7"}
inactiveColor={"lime-3"}
/>
<Rate
icon={<MoodSadOutline />}
size={32}
activeColor={"plum-6"}
inactiveColor={"plum-1"}
/>
</div>
);
}속성 이름 | 설명 | 타입 | 기본값 |
|---|
| count | 별점의 개수 | number | 5 |
| allowHalf | 반 별점 선택 가능 여부 | boolean | true |
| defaultValue | 기본 별점 값 | number | 0 |
| value | 제어되는 별점 값 | number | - |
| onChange | 별점이 변경될 때 호출되는 함수 | (value: number) => void | - |
| disabled | 비활성화 여부 | boolean | false |
| showValue | 별점 값 표시 여부 | boolean | false |
| activeColor | 활성화된 별점의 색상(palette값 또는 HEX code) | string | - |
| inactiveColor | 비활성화된 별점의 색상(palette값 또는 HEX code) | string | - |
| size | 별점의 크기 | number | 24 |
| className | 추가 클래스명 | string | - |
| style | 추가 스타일 | CSSProperties | {} |
| ariaLabel | 접근성을 위한 레이블 | string | 별점 평가 |
| icon | 별점 아이콘 | star | heart or ReactElement | star |
| testId | 테스트 ID | string | "rate" |