mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-24 15:46:10 +08:00
2cdf586291
* chore: fix lint * chore: fix lint * test: fix 16 * fix: lint
48 lines
1.0 KiB
TypeScript
48 lines
1.0 KiB
TypeScript
import React from 'react';
|
|
import { Collapse, Space } from 'antd';
|
|
|
|
const text = `
|
|
A dog is a type of domesticated animal.
|
|
Known for its loyalty and faithfulness,
|
|
it can be found as a welcome guest in many households across the world.
|
|
`;
|
|
|
|
const App: React.FC = () => (
|
|
<Space direction="vertical">
|
|
<Collapse
|
|
collapsible="header"
|
|
defaultActiveKey={['1']}
|
|
items={[
|
|
{
|
|
key: '1',
|
|
label: 'This panel can only be collapsed by clicking text',
|
|
children: <p>{text}</p>,
|
|
},
|
|
]}
|
|
/>
|
|
<Collapse
|
|
collapsible="icon"
|
|
defaultActiveKey={['1']}
|
|
items={[
|
|
{
|
|
key: '1',
|
|
label: 'This panel can only be collapsed by clicking icon',
|
|
children: <p>{text}</p>,
|
|
},
|
|
]}
|
|
/>
|
|
<Collapse
|
|
collapsible="disabled"
|
|
items={[
|
|
{
|
|
key: '1',
|
|
label: "This panel can't be collapsed",
|
|
children: <p>{text}</p>,
|
|
},
|
|
]}
|
|
/>
|
|
</Space>
|
|
);
|
|
|
|
export default App;
|