ant-design/components/rate/demo/character-function.tsx
lijianan bd505a690c
demo: update Rate demo (#46891)
* feat: CP support Tag closeIcon

* fix: fix

* fix: fix
2024-01-13 17:07:42 +08:00

21 lines
569 B
TypeScript

import React from 'react';
import { FrownOutlined, MehOutlined, SmileOutlined } from '@ant-design/icons';
import { Flex, Rate } from 'antd';
const customIcons: Record<number, React.ReactNode> = {
1: <FrownOutlined />,
2: <FrownOutlined />,
3: <MehOutlined />,
4: <SmileOutlined />,
5: <SmileOutlined />,
};
const App: React.FC = () => (
<Flex gap="middle" vertical>
<Rate defaultValue={2} character={({ index = 0 }) => index + 1} />
<Rate defaultValue={3} character={({ index = 0 }) => customIcons[index + 1]} />
</Flex>
);
export default App;