You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
389 lines
30 KiB
389 lines
30 KiB
"use strict";(self.webpackChunkantd=self.webpackChunkantd||[]).push([[5990],{230489:function(_,r,t){t.r(r);var h=t(502143),g=t(968521),v=t(720719),b=t(28840),c=t(759907),o=t(828089),f=t(825673),s=t(902068),Z=t(574399),x=t(863942),y=t(316073),k=t(24628),w=t(719260),E=t(956140),i=t(127179),d=t(905388),C=t(40428),P=t(606965),D=t(268696),A=t(587302),l=t(424128),T=t(249706),O=t(795127),M=t(116846),I=t(212039),K=t(73024),R=t(553913),a=t(606641),p=t(667294),e=t(370917);function u(){var m=(0,a.eL)(),n=m.texts;return(0,e.tZ)(a.dY,null,(0,e.tZ)(p.Fragment,null,(0,e.tZ)("div",{className:"markdown"},(0,e.tZ)("p",null,n[0].value),(0,e.tZ)("h2",{id:"when-to-use"},(0,e.tZ)(l.Z,{"aria-hidden":"true",tabIndex:"-1",href:"#when-to-use",sourceType:"a"},(0,e.tZ)("span",{className:"icon icon-link"})),"When To Use"),(0,e.tZ)("ul",null,(0,e.tZ)("li",null,n[1].value),(0,e.tZ)("li",null,(0,e.tZ)("code",null,n[2].value),n[3].value,(0,e.tZ)("code",null,n[4].value),n[5].value)),(0,e.tZ)(c.Z,{lang:"tsx"},n[6].value),(0,e.tZ)("h2",{id:"examples"},(0,e.tZ)(l.Z,{"aria-hidden":"true",tabIndex:"-1",href:"#examples",sourceType:"a"},(0,e.tZ)("span",{className:"icon icon-link"})),"Examples")),(0,e.tZ)(d.Z,{items:[{demo:{id:"components-collapse-demo-basic"},previewerProps:{title:"Collapse",filename:"components/collapse/demo/basic.tsx",pkgDependencyList:{"@ant-design/colors":"^7.0.0","@ant-design/cssinjs":"^1.10.1","@ant-design/icons":"^5.1.0","@ant-design/react-slick":"~1.0.0","@babel/runtime":"^7.18.3","@ctrl/tinycolor":"^3.6.0","@rc-component/color-picker":"~1.4.0","@rc-component/mutate-observer":"^1.0.0","@rc-component/tour":"~1.8.0","@rc-component/trigger":"^1.13.0",classnames:"^2.2.6","copy-to-clipboard":"^3.2.0",dayjs:"^1.11.1","qrcode.react":"^3.1.0","rc-cascader":"~3.12.0","rc-checkbox":"~3.1.0","rc-collapse":"~3.7.0","rc-dialog":"~9.1.0","rc-drawer":"~6.2.0","rc-dropdown":"~4.1.0","rc-field-form":"~1.34.0","rc-image":"~7.0.0","rc-input":"~1.1.0","rc-input-number":"~8.0.2","rc-mentions":"~2.5.0","rc-menu":"~9.10.0","rc-motion":"^2.7.3","rc-notification":"~5.0.4","rc-pagination":"~3.5.0","rc-picker":"~3.10.0","rc-progress":"~3.4.1","rc-rate":"~2.12.0","rc-resize-observer":"^1.2.0","rc-segmented":"~2.2.0","rc-select":"~14.5.0","rc-slider":"~10.1.0","rc-steps":"~6.0.0","rc-switch":"~4.1.0","rc-table":"~7.32.1","rc-tabs":"~12.9.0","rc-textarea":"~1.3.2","rc-tooltip":"~6.0.0","rc-tree":"~5.7.6","rc-tree-select":"~5.9.0","rc-upload":"~4.3.0","rc-util":"^5.32.0","scroll-into-view-if-needed":"^3.0.3","throttle-debounce":"^5.0.0"},jsx:`import { Collapse } from 'antd';
|
|
import React from 'react';
|
|
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 items = [
|
|
{
|
|
key: '1',
|
|
label: 'This is panel header 1',
|
|
children: <p>{text}</p>,
|
|
},
|
|
{
|
|
key: '2',
|
|
label: 'This is panel header 2',
|
|
children: <p>{text}</p>,
|
|
},
|
|
{
|
|
key: '3',
|
|
label: 'This is panel header 3',
|
|
children: <p>{text}</p>,
|
|
},
|
|
];
|
|
const App = () => {
|
|
const onChange = (key) => {
|
|
console.log(key);
|
|
};
|
|
return <Collapse items={items} defaultActiveKey={['1']} onChange={onChange} />;
|
|
};
|
|
export default App;
|
|
`,description:"<p>By default, any number of panels can be expanded at a time. The first panel is expanded in this example.</p>"}},{demo:{id:"components-collapse-demo-size"},previewerProps:{title:"Size",filename:"components/collapse/demo/size.tsx",pkgDependencyList:{"@ant-design/colors":"^7.0.0","@ant-design/cssinjs":"^1.10.1","@ant-design/icons":"^5.1.0","@ant-design/react-slick":"~1.0.0","@babel/runtime":"^7.18.3","@ctrl/tinycolor":"^3.6.0","@rc-component/color-picker":"~1.4.0","@rc-component/mutate-observer":"^1.0.0","@rc-component/tour":"~1.8.0","@rc-component/trigger":"^1.13.0",classnames:"^2.2.6","copy-to-clipboard":"^3.2.0",dayjs:"^1.11.1","qrcode.react":"^3.1.0","rc-cascader":"~3.12.0","rc-checkbox":"~3.1.0","rc-collapse":"~3.7.0","rc-dialog":"~9.1.0","rc-drawer":"~6.2.0","rc-dropdown":"~4.1.0","rc-field-form":"~1.34.0","rc-image":"~7.0.0","rc-input":"~1.1.0","rc-input-number":"~8.0.2","rc-mentions":"~2.5.0","rc-menu":"~9.10.0","rc-motion":"^2.7.3","rc-notification":"~5.0.4","rc-pagination":"~3.5.0","rc-picker":"~3.10.0","rc-progress":"~3.4.1","rc-rate":"~2.12.0","rc-resize-observer":"^1.2.0","rc-segmented":"~2.2.0","rc-select":"~14.5.0","rc-slider":"~10.1.0","rc-steps":"~6.0.0","rc-switch":"~4.1.0","rc-table":"~7.32.1","rc-tabs":"~12.9.0","rc-textarea":"~1.3.2","rc-tooltip":"~6.0.0","rc-tree":"~5.7.6","rc-tree-select":"~5.9.0","rc-upload":"~4.3.0","rc-util":"^5.32.0","scroll-into-view-if-needed":"^3.0.3","throttle-debounce":"^5.0.0"},jsx:`import { Collapse, Divider } from 'antd';
|
|
import React from 'react';
|
|
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 = () => (
|
|
<>
|
|
<Divider orientation="left">Default Size</Divider>
|
|
<Collapse
|
|
items={[
|
|
{
|
|
key: '1',
|
|
label: 'This is default size panel header',
|
|
children: <p>{text}</p>,
|
|
},
|
|
]}
|
|
/>
|
|
<Divider orientation="left">Small Size</Divider>
|
|
<Collapse
|
|
size="small"
|
|
items={[
|
|
{
|
|
key: '1',
|
|
label: 'This is small size panel header',
|
|
children: <p>{text}</p>,
|
|
},
|
|
]}
|
|
/>
|
|
<Divider orientation="left">Large Size</Divider>
|
|
<Collapse
|
|
size="large"
|
|
items={[
|
|
{
|
|
key: '1',
|
|
label: 'This is large size panel header',
|
|
children: <p>{text}</p>,
|
|
},
|
|
]}
|
|
/>
|
|
</>
|
|
);
|
|
export default App;
|
|
`,description:`<p>Ant Design supports a default collapse size as well as a large and small size.</p>
|
|
<p>If a large or small collapse is desired, set the <code>size</code> property to either <code>large</code> or <code>small</code> respectively. Omit the <code>size</code> property for a collapse with the default size.</p>`}},{demo:{id:"components-collapse-demo-accordion"},previewerProps:{title:"Accordion",filename:"components/collapse/demo/accordion.tsx",pkgDependencyList:{"@ant-design/colors":"^7.0.0","@ant-design/cssinjs":"^1.10.1","@ant-design/icons":"^5.1.0","@ant-design/react-slick":"~1.0.0","@babel/runtime":"^7.18.3","@ctrl/tinycolor":"^3.6.0","@rc-component/color-picker":"~1.4.0","@rc-component/mutate-observer":"^1.0.0","@rc-component/tour":"~1.8.0","@rc-component/trigger":"^1.13.0",classnames:"^2.2.6","copy-to-clipboard":"^3.2.0",dayjs:"^1.11.1","qrcode.react":"^3.1.0","rc-cascader":"~3.12.0","rc-checkbox":"~3.1.0","rc-collapse":"~3.7.0","rc-dialog":"~9.1.0","rc-drawer":"~6.2.0","rc-dropdown":"~4.1.0","rc-field-form":"~1.34.0","rc-image":"~7.0.0","rc-input":"~1.1.0","rc-input-number":"~8.0.2","rc-mentions":"~2.5.0","rc-menu":"~9.10.0","rc-motion":"^2.7.3","rc-notification":"~5.0.4","rc-pagination":"~3.5.0","rc-picker":"~3.10.0","rc-progress":"~3.4.1","rc-rate":"~2.12.0","rc-resize-observer":"^1.2.0","rc-segmented":"~2.2.0","rc-select":"~14.5.0","rc-slider":"~10.1.0","rc-steps":"~6.0.0","rc-switch":"~4.1.0","rc-table":"~7.32.1","rc-tabs":"~12.9.0","rc-textarea":"~1.3.2","rc-tooltip":"~6.0.0","rc-tree":"~5.7.6","rc-tree-select":"~5.9.0","rc-upload":"~4.3.0","rc-util":"^5.32.0","scroll-into-view-if-needed":"^3.0.3","throttle-debounce":"^5.0.0"},jsx:`import { Collapse } from 'antd';
|
|
import React from 'react';
|
|
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 items = [
|
|
{
|
|
key: '1',
|
|
label: 'This is panel header 1',
|
|
children: <p>{text}</p>,
|
|
},
|
|
{
|
|
key: '2',
|
|
label: 'This is panel header 2',
|
|
children: <p>{text}</p>,
|
|
},
|
|
{
|
|
key: '3',
|
|
label: 'This is panel header 3',
|
|
children: <p>{text}</p>,
|
|
},
|
|
];
|
|
const App = () => <Collapse accordion items={items} />;
|
|
export default App;
|
|
`,description:"<p>In accordion mode, only one panel can be expanded at a time.</p>"}},{demo:{id:"components-collapse-demo-mix"},previewerProps:{title:"Nested panel",filename:"components/collapse/demo/mix.tsx",pkgDependencyList:{"@ant-design/colors":"^7.0.0","@ant-design/cssinjs":"^1.10.1","@ant-design/icons":"^5.1.0","@ant-design/react-slick":"~1.0.0","@babel/runtime":"^7.18.3","@ctrl/tinycolor":"^3.6.0","@rc-component/color-picker":"~1.4.0","@rc-component/mutate-observer":"^1.0.0","@rc-component/tour":"~1.8.0","@rc-component/trigger":"^1.13.0",classnames:"^2.2.6","copy-to-clipboard":"^3.2.0",dayjs:"^1.11.1","qrcode.react":"^3.1.0","rc-cascader":"~3.12.0","rc-checkbox":"~3.1.0","rc-collapse":"~3.7.0","rc-dialog":"~9.1.0","rc-drawer":"~6.2.0","rc-dropdown":"~4.1.0","rc-field-form":"~1.34.0","rc-image":"~7.0.0","rc-input":"~1.1.0","rc-input-number":"~8.0.2","rc-mentions":"~2.5.0","rc-menu":"~9.10.0","rc-motion":"^2.7.3","rc-notification":"~5.0.4","rc-pagination":"~3.5.0","rc-picker":"~3.10.0","rc-progress":"~3.4.1","rc-rate":"~2.12.0","rc-resize-observer":"^1.2.0","rc-segmented":"~2.2.0","rc-select":"~14.5.0","rc-slider":"~10.1.0","rc-steps":"~6.0.0","rc-switch":"~4.1.0","rc-table":"~7.32.1","rc-tabs":"~12.9.0","rc-textarea":"~1.3.2","rc-tooltip":"~6.0.0","rc-tree":"~5.7.6","rc-tree-select":"~5.9.0","rc-upload":"~4.3.0","rc-util":"^5.32.0","scroll-into-view-if-needed":"^3.0.3","throttle-debounce":"^5.0.0"},jsx:`import { Collapse } from 'antd';
|
|
import React from 'react';
|
|
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 itemsNest = [
|
|
{
|
|
key: '1',
|
|
label: 'This is panel nest panel',
|
|
children: <p>{text}</p>,
|
|
},
|
|
];
|
|
const items = [
|
|
{
|
|
key: '1',
|
|
label: 'This is panel header 1',
|
|
children: <Collapse defaultActiveKey="1" items={itemsNest} />,
|
|
},
|
|
{
|
|
key: '2',
|
|
label: 'This is panel header 2',
|
|
children: <p>{text}</p>,
|
|
},
|
|
{
|
|
key: '3',
|
|
label: 'This is panel header 3',
|
|
children: <p>{text}</p>,
|
|
},
|
|
];
|
|
const App = () => {
|
|
const onChange = (key) => {
|
|
console.log(key);
|
|
};
|
|
return <Collapse onChange={onChange} items={items} />;
|
|
};
|
|
export default App;
|
|
`,description:"<p><code>Collapse</code> is nested inside the <code>Collapse</code>.</p>"}},{demo:{id:"components-collapse-demo-borderless"},previewerProps:{title:"Borderless",filename:"components/collapse/demo/borderless.tsx",pkgDependencyList:{"@ant-design/colors":"^7.0.0","@ant-design/cssinjs":"^1.10.1","@ant-design/icons":"^5.1.0","@ant-design/react-slick":"~1.0.0","@babel/runtime":"^7.18.3","@ctrl/tinycolor":"^3.6.0","@rc-component/color-picker":"~1.4.0","@rc-component/mutate-observer":"^1.0.0","@rc-component/tour":"~1.8.0","@rc-component/trigger":"^1.13.0",classnames:"^2.2.6","copy-to-clipboard":"^3.2.0",dayjs:"^1.11.1","qrcode.react":"^3.1.0","rc-cascader":"~3.12.0","rc-checkbox":"~3.1.0","rc-collapse":"~3.7.0","rc-dialog":"~9.1.0","rc-drawer":"~6.2.0","rc-dropdown":"~4.1.0","rc-field-form":"~1.34.0","rc-image":"~7.0.0","rc-input":"~1.1.0","rc-input-number":"~8.0.2","rc-mentions":"~2.5.0","rc-menu":"~9.10.0","rc-motion":"^2.7.3","rc-notification":"~5.0.4","rc-pagination":"~3.5.0","rc-picker":"~3.10.0","rc-progress":"~3.4.1","rc-rate":"~2.12.0","rc-resize-observer":"^1.2.0","rc-segmented":"~2.2.0","rc-select":"~14.5.0","rc-slider":"~10.1.0","rc-steps":"~6.0.0","rc-switch":"~4.1.0","rc-table":"~7.32.1","rc-tabs":"~12.9.0","rc-textarea":"~1.3.2","rc-tooltip":"~6.0.0","rc-tree":"~5.7.6","rc-tree-select":"~5.9.0","rc-upload":"~4.3.0","rc-util":"^5.32.0","scroll-into-view-if-needed":"^3.0.3","throttle-debounce":"^5.0.0"},jsx:`import { Collapse } from 'antd';
|
|
import React from 'react';
|
|
const text = (
|
|
<p
|
|
style={{
|
|
paddingLeft: 24,
|
|
}}
|
|
>
|
|
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.
|
|
</p>
|
|
);
|
|
const items = [
|
|
{
|
|
key: '1',
|
|
label: 'This is panel header 1',
|
|
children: text,
|
|
},
|
|
{
|
|
key: '2',
|
|
label: 'This is panel header 2',
|
|
children: text,
|
|
},
|
|
{
|
|
key: '3',
|
|
label: 'This is panel header 3',
|
|
children: text,
|
|
},
|
|
];
|
|
const App = () => <Collapse items={items} bordered={false} defaultActiveKey={['1']} />;
|
|
export default App;
|
|
`,description:"<p>A borderless style of Collapse.</p>"}},{demo:{id:"components-collapse-demo-custom"},previewerProps:{title:"Custom Panel",filename:"components/collapse/demo/custom.tsx",pkgDependencyList:{"@ant-design/colors":"^7.0.0","@ant-design/cssinjs":"^1.10.1","@ant-design/icons":"^5.1.0","@ant-design/react-slick":"~1.0.0","@babel/runtime":"^7.18.3","@ctrl/tinycolor":"^3.6.0","@rc-component/color-picker":"~1.4.0","@rc-component/mutate-observer":"^1.0.0","@rc-component/tour":"~1.8.0","@rc-component/trigger":"^1.13.0",classnames:"^2.2.6","copy-to-clipboard":"^3.2.0",dayjs:"^1.11.1","qrcode.react":"^3.1.0","rc-cascader":"~3.12.0","rc-checkbox":"~3.1.0","rc-collapse":"~3.7.0","rc-dialog":"~9.1.0","rc-drawer":"~6.2.0","rc-dropdown":"~4.1.0","rc-field-form":"~1.34.0","rc-image":"~7.0.0","rc-input":"~1.1.0","rc-input-number":"~8.0.2","rc-mentions":"~2.5.0","rc-menu":"~9.10.0","rc-motion":"^2.7.3","rc-notification":"~5.0.4","rc-pagination":"~3.5.0","rc-picker":"~3.10.0","rc-progress":"~3.4.1","rc-rate":"~2.12.0","rc-resize-observer":"^1.2.0","rc-segmented":"~2.2.0","rc-select":"~14.5.0","rc-slider":"~10.1.0","rc-steps":"~6.0.0","rc-switch":"~4.1.0","rc-table":"~7.32.1","rc-tabs":"~12.9.0","rc-textarea":"~1.3.2","rc-tooltip":"~6.0.0","rc-tree":"~5.7.6","rc-tree-select":"~5.9.0","rc-upload":"~4.3.0","rc-util":"^5.32.0","scroll-into-view-if-needed":"^3.0.3","throttle-debounce":"^5.0.0"},jsx:`import { CaretRightOutlined } from '@ant-design/icons';
|
|
import { Collapse, theme } from 'antd';
|
|
import React from 'react';
|
|
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 getItems = (panelStyle) => [
|
|
{
|
|
key: '1',
|
|
label: 'This is panel header 1',
|
|
children: <p>{text}</p>,
|
|
style: panelStyle,
|
|
},
|
|
{
|
|
key: '2',
|
|
label: 'This is panel header 2',
|
|
children: <p>{text}</p>,
|
|
style: panelStyle,
|
|
},
|
|
{
|
|
key: '3',
|
|
label: 'This is panel header 3',
|
|
children: <p>{text}</p>,
|
|
style: panelStyle,
|
|
},
|
|
];
|
|
const App = () => {
|
|
const { token } = theme.useToken();
|
|
const panelStyle = {
|
|
marginBottom: 24,
|
|
background: token.colorFillAlter,
|
|
borderRadius: token.borderRadiusLG,
|
|
border: 'none',
|
|
};
|
|
return (
|
|
<Collapse
|
|
bordered={false}
|
|
defaultActiveKey={['1']}
|
|
expandIcon={({ isActive }) => <CaretRightOutlined rotate={isActive ? 90 : 0} />}
|
|
style={{
|
|
background: token.colorBgContainer,
|
|
}}
|
|
items={getItems(panelStyle)}
|
|
/>
|
|
);
|
|
};
|
|
export default App;
|
|
`,description:"<p>Customize the background, border, margin styles and icon for each panel.</p>"}},{demo:{id:"components-collapse-demo-noarrow"},previewerProps:{title:"No arrow",filename:"components/collapse/demo/noarrow.tsx",pkgDependencyList:{"@ant-design/colors":"^7.0.0","@ant-design/cssinjs":"^1.10.1","@ant-design/icons":"^5.1.0","@ant-design/react-slick":"~1.0.0","@babel/runtime":"^7.18.3","@ctrl/tinycolor":"^3.6.0","@rc-component/color-picker":"~1.4.0","@rc-component/mutate-observer":"^1.0.0","@rc-component/tour":"~1.8.0","@rc-component/trigger":"^1.13.0",classnames:"^2.2.6","copy-to-clipboard":"^3.2.0",dayjs:"^1.11.1","qrcode.react":"^3.1.0","rc-cascader":"~3.12.0","rc-checkbox":"~3.1.0","rc-collapse":"~3.7.0","rc-dialog":"~9.1.0","rc-drawer":"~6.2.0","rc-dropdown":"~4.1.0","rc-field-form":"~1.34.0","rc-image":"~7.0.0","rc-input":"~1.1.0","rc-input-number":"~8.0.2","rc-mentions":"~2.5.0","rc-menu":"~9.10.0","rc-motion":"^2.7.3","rc-notification":"~5.0.4","rc-pagination":"~3.5.0","rc-picker":"~3.10.0","rc-progress":"~3.4.1","rc-rate":"~2.12.0","rc-resize-observer":"^1.2.0","rc-segmented":"~2.2.0","rc-select":"~14.5.0","rc-slider":"~10.1.0","rc-steps":"~6.0.0","rc-switch":"~4.1.0","rc-table":"~7.32.1","rc-tabs":"~12.9.0","rc-textarea":"~1.3.2","rc-tooltip":"~6.0.0","rc-tree":"~5.7.6","rc-tree-select":"~5.9.0","rc-upload":"~4.3.0","rc-util":"^5.32.0","scroll-into-view-if-needed":"^3.0.3","throttle-debounce":"^5.0.0"},jsx:`import { Collapse } from 'antd';
|
|
import React from 'react';
|
|
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 items = [
|
|
{
|
|
key: '1',
|
|
label: 'This is panel header with arrow icon',
|
|
children: <p>{text}</p>,
|
|
},
|
|
{
|
|
key: '2',
|
|
label: 'This is panel header with no arrow icon',
|
|
children: <p>{text}</p>,
|
|
showArrow: false,
|
|
},
|
|
];
|
|
const App = () => {
|
|
const onChange = (key) => {
|
|
console.log(key);
|
|
};
|
|
return <Collapse defaultActiveKey={['1']} onChange={onChange} items={items} />;
|
|
};
|
|
export default App;
|
|
`,description:"<p>You can hide the arrow icon by passing <code>showArrow={false}</code> to <code>CollapsePanel</code> component.</p>"}},{demo:{id:"components-collapse-demo-extra"},previewerProps:{title:"Extra node",filename:"components/collapse/demo/extra.tsx",pkgDependencyList:{"@ant-design/colors":"^7.0.0","@ant-design/cssinjs":"^1.10.1","@ant-design/icons":"^5.1.0","@ant-design/react-slick":"~1.0.0","@babel/runtime":"^7.18.3","@ctrl/tinycolor":"^3.6.0","@rc-component/color-picker":"~1.4.0","@rc-component/mutate-observer":"^1.0.0","@rc-component/tour":"~1.8.0","@rc-component/trigger":"^1.13.0",classnames:"^2.2.6","copy-to-clipboard":"^3.2.0",dayjs:"^1.11.1","qrcode.react":"^3.1.0","rc-cascader":"~3.12.0","rc-checkbox":"~3.1.0","rc-collapse":"~3.7.0","rc-dialog":"~9.1.0","rc-drawer":"~6.2.0","rc-dropdown":"~4.1.0","rc-field-form":"~1.34.0","rc-image":"~7.0.0","rc-input":"~1.1.0","rc-input-number":"~8.0.2","rc-mentions":"~2.5.0","rc-menu":"~9.10.0","rc-motion":"^2.7.3","rc-notification":"~5.0.4","rc-pagination":"~3.5.0","rc-picker":"~3.10.0","rc-progress":"~3.4.1","rc-rate":"~2.12.0","rc-resize-observer":"^1.2.0","rc-segmented":"~2.2.0","rc-select":"~14.5.0","rc-slider":"~10.1.0","rc-steps":"~6.0.0","rc-switch":"~4.1.0","rc-table":"~7.32.1","rc-tabs":"~12.9.0","rc-textarea":"~1.3.2","rc-tooltip":"~6.0.0","rc-tree":"~5.7.6","rc-tree-select":"~5.9.0","rc-upload":"~4.3.0","rc-util":"^5.32.0","scroll-into-view-if-needed":"^3.0.3","throttle-debounce":"^5.0.0"},jsx:`import { SettingOutlined } from '@ant-design/icons';
|
|
import { Collapse, Select } from 'antd';
|
|
import React, { useState } from 'react';
|
|
const { Option } = Select;
|
|
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 = () => {
|
|
const [expandIconPosition, setExpandIconPosition] = useState('start');
|
|
const onPositionChange = (newExpandIconPosition) => {
|
|
setExpandIconPosition(newExpandIconPosition);
|
|
};
|
|
const onChange = (key) => {
|
|
console.log(key);
|
|
};
|
|
const genExtra = () => (
|
|
<SettingOutlined
|
|
onClick={(event) => {
|
|
// If you don't want click extra trigger collapse, you can prevent this:
|
|
event.stopPropagation();
|
|
}}
|
|
/>
|
|
);
|
|
const items = [
|
|
{
|
|
key: '1',
|
|
label: 'This is panel header 1',
|
|
children: <div>{text}</div>,
|
|
extra: genExtra(),
|
|
},
|
|
{
|
|
key: '2',
|
|
label: 'This is panel header 2',
|
|
children: <div>{text}</div>,
|
|
extra: genExtra(),
|
|
},
|
|
{
|
|
key: '3',
|
|
label: 'This is panel header 3',
|
|
children: <div>{text}</div>,
|
|
extra: genExtra(),
|
|
},
|
|
];
|
|
return (
|
|
<>
|
|
<Collapse
|
|
defaultActiveKey={['1']}
|
|
onChange={onChange}
|
|
expandIconPosition={expandIconPosition}
|
|
items={items}
|
|
/>
|
|
<br />
|
|
<span>Expand Icon Position: </span>
|
|
<Select
|
|
value={expandIconPosition}
|
|
style={{
|
|
margin: '0 8px',
|
|
}}
|
|
onChange={onPositionChange}
|
|
>
|
|
<Option value="start">start</Option>
|
|
<Option value="end">end</Option>
|
|
</Select>
|
|
</>
|
|
);
|
|
};
|
|
export default App;
|
|
`,description:"<p>Render extra element in the top-right corner of each panel.</p>"}},{demo:{id:"components-collapse-demo-ghost"},previewerProps:{title:"Ghost Collapse",filename:"components/collapse/demo/ghost.tsx",pkgDependencyList:{"@ant-design/colors":"^7.0.0","@ant-design/cssinjs":"^1.10.1","@ant-design/icons":"^5.1.0","@ant-design/react-slick":"~1.0.0","@babel/runtime":"^7.18.3","@ctrl/tinycolor":"^3.6.0","@rc-component/color-picker":"~1.4.0","@rc-component/mutate-observer":"^1.0.0","@rc-component/tour":"~1.8.0","@rc-component/trigger":"^1.13.0",classnames:"^2.2.6","copy-to-clipboard":"^3.2.0",dayjs:"^1.11.1","qrcode.react":"^3.1.0","rc-cascader":"~3.12.0","rc-checkbox":"~3.1.0","rc-collapse":"~3.7.0","rc-dialog":"~9.1.0","rc-drawer":"~6.2.0","rc-dropdown":"~4.1.0","rc-field-form":"~1.34.0","rc-image":"~7.0.0","rc-input":"~1.1.0","rc-input-number":"~8.0.2","rc-mentions":"~2.5.0","rc-menu":"~9.10.0","rc-motion":"^2.7.3","rc-notification":"~5.0.4","rc-pagination":"~3.5.0","rc-picker":"~3.10.0","rc-progress":"~3.4.1","rc-rate":"~2.12.0","rc-resize-observer":"^1.2.0","rc-segmented":"~2.2.0","rc-select":"~14.5.0","rc-slider":"~10.1.0","rc-steps":"~6.0.0","rc-switch":"~4.1.0","rc-table":"~7.32.1","rc-tabs":"~12.9.0","rc-textarea":"~1.3.2","rc-tooltip":"~6.0.0","rc-tree":"~5.7.6","rc-tree-select":"~5.9.0","rc-upload":"~4.3.0","rc-util":"^5.32.0","scroll-into-view-if-needed":"^3.0.3","throttle-debounce":"^5.0.0"},jsx:`import { Collapse } from 'antd';
|
|
import React from 'react';
|
|
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 items = [
|
|
{
|
|
key: '1',
|
|
label: 'This is panel header 1',
|
|
children: <p>{text}</p>,
|
|
},
|
|
{
|
|
key: '2',
|
|
label: 'This is panel header 2',
|
|
children: <p>{text}</p>,
|
|
},
|
|
{
|
|
key: '3',
|
|
label: 'This is panel header 3',
|
|
children: <p>{text}</p>,
|
|
},
|
|
];
|
|
const App = () => <Collapse defaultActiveKey={['1']} ghost items={items} />;
|
|
export default App;
|
|
`,description:"<p>Making collapse's background to transparent.</p>"}},{demo:{id:"components-collapse-demo-collapsible"},previewerProps:{title:"Collapsible",filename:"components/collapse/demo/collapsible.tsx",pkgDependencyList:{"@ant-design/colors":"^7.0.0","@ant-design/cssinjs":"^1.10.1","@ant-design/icons":"^5.1.0","@ant-design/react-slick":"~1.0.0","@babel/runtime":"^7.18.3","@ctrl/tinycolor":"^3.6.0","@rc-component/color-picker":"~1.4.0","@rc-component/mutate-observer":"^1.0.0","@rc-component/tour":"~1.8.0","@rc-component/trigger":"^1.13.0",classnames:"^2.2.6","copy-to-clipboard":"^3.2.0",dayjs:"^1.11.1","qrcode.react":"^3.1.0","rc-cascader":"~3.12.0","rc-checkbox":"~3.1.0","rc-collapse":"~3.7.0","rc-dialog":"~9.1.0","rc-drawer":"~6.2.0","rc-dropdown":"~4.1.0","rc-field-form":"~1.34.0","rc-image":"~7.0.0","rc-input":"~1.1.0","rc-input-number":"~8.0.2","rc-mentions":"~2.5.0","rc-menu":"~9.10.0","rc-motion":"^2.7.3","rc-notification":"~5.0.4","rc-pagination":"~3.5.0","rc-picker":"~3.10.0","rc-progress":"~3.4.1","rc-rate":"~2.12.0","rc-resize-observer":"^1.2.0","rc-segmented":"~2.2.0","rc-select":"~14.5.0","rc-slider":"~10.1.0","rc-steps":"~6.0.0","rc-switch":"~4.1.0","rc-table":"~7.32.1","rc-tabs":"~12.9.0","rc-textarea":"~1.3.2","rc-tooltip":"~6.0.0","rc-tree":"~5.7.6","rc-tree-select":"~5.9.0","rc-upload":"~4.3.0","rc-util":"^5.32.0","scroll-into-view-if-needed":"^3.0.3","throttle-debounce":"^5.0.0"},jsx:`import { Collapse, Space } from 'antd';
|
|
import React from 'react';
|
|
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 = () => (
|
|
<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;
|
|
`,description:"<p>Specify the trigger area of collapsible by <code>collapsible</code>.</p>",style:`#components-collapse-demo-collapsible .ant-space {
|
|
width: 100%;
|
|
}`}}]}),(0,e.tZ)("div",{className:"markdown"},(0,e.tZ)("h2",{id:"api"},(0,e.tZ)(l.Z,{"aria-hidden":"true",tabIndex:"-1",href:"#api",sourceType:"a"},(0,e.tZ)("span",{className:"icon icon-link"})),"API"),(0,e.tZ)("h3",{id:"collapse"},(0,e.tZ)(l.Z,{"aria-hidden":"true",tabIndex:"-1",href:"#collapse",sourceType:"a"},(0,e.tZ)("span",{className:"icon icon-link"})),"Collapse"),(0,e.tZ)(o.Z,{className:"component-api-table"},(0,e.tZ)("thead",null,(0,e.tZ)("tr",null,(0,e.tZ)("th",null,n[7].value),(0,e.tZ)("th",null,n[8].value),(0,e.tZ)("th",null,n[9].value),(0,e.tZ)("th",null,n[10].value),(0,e.tZ)("th",null,n[11].value))),(0,e.tZ)("tbody",null,(0,e.tZ)("tr",null,(0,e.tZ)("td",null,n[12].value),(0,e.tZ)("td",null,n[13].value),(0,e.tZ)("td",null,n[14].value),(0,e.tZ)("td",null,n[15].value),(0,e.tZ)("td",null)),(0,e.tZ)("tr",null,(0,e.tZ)("td",null,n[16].value),(0,e.tZ)("td",null,n[17].value),(0,e.tZ)("td",null,n[18].value,(0,e.tZ)("br",null),n[19].value),(0,e.tZ)("td",null,n[20].value,(0,e.tZ)("code",null,n[21].value),n[22].value),(0,e.tZ)("td",null)),(0,e.tZ)("tr",null,(0,e.tZ)("td",null,n[23].value),(0,e.tZ)("td",null,n[24].value),(0,e.tZ)("td",null,n[25].value),(0,e.tZ)("td",null,n[26].value),(0,e.tZ)("td",null)),(0,e.tZ)("tr",null,(0,e.tZ)("td",null,n[27].value),(0,e.tZ)("td",null,n[28].value),(0,e.tZ)("td",null,(0,e.tZ)("code",null,n[29].value),n[30].value,(0,e.tZ)("code",null,n[31].value),n[32].value,(0,e.tZ)("code",null,n[33].value)),(0,e.tZ)("td",null,n[34].value),(0,e.tZ)("td",null,n[35].value)),(0,e.tZ)("tr",null,(0,e.tZ)("td",null,n[36].value),(0,e.tZ)("td",null,n[37].value),(0,e.tZ)("td",null,n[38].value,(0,e.tZ)("br",null),n[39].value),(0,e.tZ)("td",null,n[40].value),(0,e.tZ)("td",null)),(0,e.tZ)("tr",null,(0,e.tZ)("td",null,n[41].value),(0,e.tZ)("td",null,n[42].value),(0,e.tZ)("td",null,n[43].value),(0,e.tZ)("td",null,n[44].value),(0,e.tZ)("td",null)),(0,e.tZ)("tr",null,(0,e.tZ)("td",null,n[45].value),(0,e.tZ)("td",null,n[46].value),(0,e.tZ)("td",null,n[47].value),(0,e.tZ)("td",null,n[48].value),(0,e.tZ)("td",null)),(0,e.tZ)("tr",null,(0,e.tZ)("td",null,n[49].value),(0,e.tZ)("td",null,n[50].value),(0,e.tZ)("td",null,(0,e.tZ)("code",null,n[51].value),n[52].value,(0,e.tZ)("code",null,n[53].value)),(0,e.tZ)("td",null,n[54].value),(0,e.tZ)("td",null,n[55].value)),(0,e.tZ)("tr",null,(0,e.tZ)("td",null,n[56].value),(0,e.tZ)("td",null,n[57].value),(0,e.tZ)("td",null,n[58].value),(0,e.tZ)("td",null,n[59].value),(0,e.tZ)("td",null,n[60].value)),(0,e.tZ)("tr",null,(0,e.tZ)("td",null,n[61].value),(0,e.tZ)("td",null,n[62].value),(0,e.tZ)("td",null,(0,e.tZ)("code",null,n[63].value),n[64].value,(0,e.tZ)("code",null,n[65].value),n[66].value,(0,e.tZ)("code",null,n[67].value)),(0,e.tZ)("td",null,(0,e.tZ)("code",null,n[68].value)),(0,e.tZ)("td",null,n[69].value)),(0,e.tZ)("tr",null,(0,e.tZ)("td",null,n[70].value),(0,e.tZ)("td",null,n[71].value),(0,e.tZ)("td",null,n[72].value),(0,e.tZ)("td",null,n[73].value),(0,e.tZ)("td",null)),(0,e.tZ)("tr",null,(0,e.tZ)("td",null,n[74].value),(0,e.tZ)("td",null,n[75].value),(0,e.tZ)("td",null,(0,e.tZ)(l.Z,{href:"https://github.com/react-component/collapse/blob/27250ca5415faab16db412b9bff2c131bb4f32fc/src/interface.ts#L6",sourceType:"a"},n[76].value)),(0,e.tZ)("td",null,n[77].value),(0,e.tZ)("td",null,n[78].value)))),(0,e.tZ)("h3",{id:"collapsepanel"},(0,e.tZ)(l.Z,{"aria-hidden":"true",tabIndex:"-1",href:"#collapsepanel",sourceType:"a"},(0,e.tZ)("span",{className:"icon icon-link"})),"Collapse.Panel")),(0,e.tZ)(s.Z,{message:">= 5.6.0 configure the panel by `items`."}),(0,e.tZ)("div",{className:"markdown"},(0,e.tZ)(o.Z,{className:"component-api-table"},(0,e.tZ)("thead",null,(0,e.tZ)("tr",null,(0,e.tZ)("th",null,n[79].value),(0,e.tZ)("th",null,n[80].value),(0,e.tZ)("th",null,n[81].value),(0,e.tZ)("th",null,n[82].value),(0,e.tZ)("th",null,n[83].value))),(0,e.tZ)("tbody",null,(0,e.tZ)("tr",null,(0,e.tZ)("td",null,n[84].value),(0,e.tZ)("td",null,n[85].value),(0,e.tZ)("td",null,(0,e.tZ)("code",null,n[86].value),n[87].value,(0,e.tZ)("code",null,n[88].value),n[89].value,(0,e.tZ)("code",null,n[90].value)),(0,e.tZ)("td",null,n[91].value),(0,e.tZ)("td",null,n[92].value)),(0,e.tZ)("tr",null,(0,e.tZ)("td",null,n[93].value),(0,e.tZ)("td",null,n[94].value),(0,e.tZ)("td",null,n[95].value),(0,e.tZ)("td",null,n[96].value),(0,e.tZ)("td",null)),(0,e.tZ)("tr",null,(0,e.tZ)("td",null,n[97].value),(0,e.tZ)("td",null,n[98].value),(0,e.tZ)("td",null,n[99].value),(0,e.tZ)("td",null,n[100].value),(0,e.tZ)("td",null)),(0,e.tZ)("tr",null,(0,e.tZ)("td",null,n[101].value),(0,e.tZ)("td",null,n[102].value),(0,e.tZ)("td",null,n[103].value),(0,e.tZ)("td",null,n[104].value),(0,e.tZ)("td",null)),(0,e.tZ)("tr",null,(0,e.tZ)("td",null,n[105].value),(0,e.tZ)("td",null,n[106].value),(0,e.tZ)("td",null,n[107].value),(0,e.tZ)("td",null,n[108].value),(0,e.tZ)("td",null)),(0,e.tZ)("tr",null,(0,e.tZ)("td",null,n[109].value),(0,e.tZ)("td",null,n[110].value),(0,e.tZ)("td",null,n[111].value),(0,e.tZ)("td",null,n[112].value),(0,e.tZ)("td",null)))),(0,e.tZ)("h2",{id:"design-token"},(0,e.tZ)(l.Z,{"aria-hidden":"true",tabIndex:"-1",href:"#design-token",sourceType:"a"},(0,e.tZ)("span",{className:"icon icon-link"})),"Design Token")),(0,e.tZ)(i.Z,{component:"Collapse"})))}r.default=u}}]);
|
|
|