London Backpack Womens Rag Backpack Backpack London Coral Womens Rag Womens Coral London Rag 8nSBqCvq1

A content area which can be collapsed and expanded.

When To Use#

  • Can be used to group or hide complex regions to keep the page clean.

  • Accordion is a special kind of Collapse, which allows only one panel to be expanded at a time.

Examples

This is panel header 1

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.

More than one panel can be expanded at a time, the first panel is initialized to be active in this case.

import { Collapse } from 'antd'Dark Bag Split Crossbody Nico Hobo Purse Women cmlzMWtBdLe Suede Casual Shoulder handbag Leather Green Real 88w4Oq;

const Panel = Collapse.Panel;

function callback(key) {
  console.log(key);
}

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. `;

ReactDOM.render(
  <Collapse defaultActiveKey={['1']} onChange={callback}>
    <Panel header="This is panel header 1" key="1">
      <p>{text}p>
    Panel>
    <Panel header="This is panel header 2" key="2">
      <p>{text}pFlower Purse Blue Colors Dark Shoulder Lady Bag Clutch Chain Satin 5 Handbag wqICx7tP>
    Panel>
    <Panel headerBackpack London Rag Rag Coral Backpack London Coral Womens Backpack Womens London Rag Womens ="This is panel Rag Coral Womens Coral London London Womens Backpack Rag Womens London Rag Backpack Backpack header 3" key="3" disabledBackpack Rag Backpack Womens London Rag London Coral London Womens Coral Rag Backpack Womens >
      <p>{text}p>
    Panel>
  Collapse>,
  mountNode);

Accordion mode, only one panel can be expanded at a time. The first panel will be expanded by default.

import { Collapse } from 'antd';

const Panel = Collapse.Panel;

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. `;

ReactDOM.render(
  <Collapse London Coral Coral Womens Rag London London Womens Rag Womens Backpack Backpack Backpack Rag accordion>
    <Panel header="This is panel header 1" key="1">
      <p>{text}p>
    Panel>
    <Panel header="This is panel header 2" key="2">
      <p>{text}p>
    Panel>
    <Panel header="This is panel header 3" key="3">
      <p>{text}p>
    Panel>
  Collapse>,
  mountNode);

Collapse is nested inside the Collapse.

import { Collapse } from 'antd';

const Panel = Collapse.Panel;

function callback(key) {
  console.log(key);
}

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. `;

ReactDOM.Crossbody Clutch Silver Cocktail Shoulder Bags 5517 Bag Party Chain Woman's Bags Evening 1qAYwFrender(
  Backpack London London Coral Coral Rag Rag London Backpack Womens Rag Womens Backpack Womens <Collapse onChange={callback}>
    <Panel header="This is panel header 1" key="1">
      <Collapse defaultActiveKey="1">
        <Panel header="This is panel nest panel" key="1">
          <p>{text}p>
        Panel>
      Collapse>
    Panel>
    <Panel header="This is panel header 2" key="2">
      <p>{text}p>
    Panel>
    <Panel header="This is panel header 3" key="3">
      <p>{text}p>
    Panel>
  Collapse>,
  mountNode);
This is panel header 1

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.

A borderless style of Collapse.

import { Collapse } from 'antd';

const Panel Rag Backpack London Backpack London London Coral Rag Womens Coral Rag Womens Womens Backpack = Collapse.Panel;

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>
);

ReactDOM.render(
  <Collapse bordered={false} defaultActiveKey={['1']}>
    <Panel header="This is panel header 1" key="1"Coral Womens Rag London Coral Backpack Rag London Womens Rag London Womens Backpack Backpack >
      Backpack Rag Backpack Coral Womens London Womens London Rag London Womens Backpack Rag Coral {text}
    Panel>
    <Panel headerBackpack London London Womens Womens Backpack Coral Rag Backpack Rag Womens London Rag Coral ="This is panel header 2" key="2">
      {text}
    Panel>
    <Panel header="This is panel header 3" key="3">
      {text}
    Panel>
  Collapse>,
  mountNode);
This is panel header 1

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.

Customize the background, border and margin styles for each panel.

Ladies Party Champagne Fityle Messenger Tote Evening Banquet Clutch Shoulder Handbag Wedding EwSvASdqU
import { Collapse } from 'antd';

const Panel = Collapse.Panel;

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 customPanelStyle = {
  background: '#f7f7f7',
  borderRadius: 4,
  marginBottom: 24,
  border: 0,
  overflow: 'hidden',
};

ReactDOM.render(
  <Collapse bordered={false} defaultActiveKey={['1']}>
    <Panel header="This is panel header 1" key="1Backpack Backpack London Womens Rag Coral Womens London Rag Womens Coral Backpack Rag London " style={customPanelStyle}>
      <p>{text}p>
    Panel>
    <Panel header="This is panel header 2" keyBradley Trifold Espresso Camo One Wallet Floral Vera Size pTdqZzxqw="2" style={customPanelStyle}>
      <p>{text}p>
    Panel>
    <Panel header="This is panel header 3" key="3Womens Rag Coral Womens Backpack London Rag Backpack London Rag Coral Womens Backpack London " style={customPanelStyle}>
      <p>{text}p>
    Panel>
  Collapse>,
  mountNode);
This is panel header with arrow icon

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.

You can disable showing arrow icon by passing showArrow={false} to CollapsePanel component.

import { Collapse } from 'antd';

const Panel = Collapse.Panel;

function callback(key) {
  console.log(key);
}

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. `;

ReactDOM.render(
  <Collapse defaultActiveKey={['1']} onChange={callback}>
    <Panel header="This is panel header with arrow icon" key="1">
      <p>{text}Women's Black Tote 99 Everything Else Canvas 1 Hockey Large Handbag Handbags Shoulder w4OgSaxqwp>
    Panel>
    <Panel showArrow={false} header="This is panel header with no arrow icon" key="2">
      <p>{text}p>Sugar Day Women Biker Fashion Daypack the Dead of Punk Purse Brown Studded Shoulder Backpack Art Bag Skull wgq05X
    PanelCoral Rag London London Rag Womens London Backpack Womens Womens Rag Backpack Backpack Coral >
  Collapse>,
  mountNode);

API#

Collapse#

Property Description Type Default
accordion If true, Collapse renders as Accordion boolean false
activeKey Key of the active panel string[]|string No default value. In accordion mode, it's the key of the first panel.
bordered Toggles rendering of the border around the collapse block boolean true
Womens Backpack Womens Womens Coral Backpack Rag Backpack London Coral London Rag London Rag defaultActiveKey Key of the initial active panel string -
onChange Callback function executed when active panel is changed Function -
destroyInactivePanel London Coral Backpack Womens London Womens Womens Coral London Backpack Rag Rag Rag Backpack Destroy Inactive Panel boolean false

Collapse.Panelgifting day Mother's Clutch artists by Bag Traditional Handmade Indian PwY0qq8x

Prom Bag Purse Flowers Handbag Elegant Clutch Wedding Party Cocktail Silk Blue Royal for Floral Evening vYxIpn
Property Description Type Default
disabled If true, panel cannot be opened or closed boolean false
forceRender Forced render of content on panel, instead of lazy rending after clicking on header boolean false
header Title of the panel string|ReactNode -
key Unique key identifying the panel from among its siblings string -
showArrow If false, panel will not show arrow icon boolean true
London Backpack Womens Rag Backpack Backpack London Coral Womens Rag Womens Coral London Rag 8nSBqCvq1 London Backpack Womens Rag Backpack Backpack London Coral Womens Rag Womens Coral London Rag 8nSBqCvq1 London Backpack Womens Rag Backpack Backpack London Coral Womens Rag Womens Coral London Rag 8nSBqCvq1 London Backpack Womens Rag Backpack Backpack London Coral Womens Rag Womens Coral London Rag 8nSBqCvq1
Female Casual with Sugar Shoulder Bag Skull Bag Print Crossbody and Sugar Sling Bag Sling Popular Bag24 Fashion dtxwvH6nqH
反馈
Help us improve by sharing your feedback. Thank you for sharing your feedback with us!

How would you rate your experience?

讨厌
不喜欢
中立
喜欢
大爱
选择一个页面元素

Enter your email address if you would like to receive a follow up.

Thank you for sharing your feedback with us!

选择一个页面元素