Skip to content

FoldingPanel Component

Use folding panels to collapse content areas.

📌Platform Compatibility Notes

APP(vue)H5WeChat Mini ProgramAlipay Mini Program

🏯Basic Usage Example

Note

index is required; it is the index.

html
<hy-folding-panel v-model="activeIndex">
    <hy-folding-panel-item title="Fruits" index="fruits"></hy-folding-panel-item>
    <hy-folding-panel-item title="Beverages" index="beverage"></hy-folding-panel-item>
</hy-folding-panel>

Disabling Panels

  • Disable all panels by setting disabled on hy-folding-panel
  • Disable a single panel by setting disabled on hy-folding-panel-item
html
<hy-folding-panel v-model="activeIndex" :disabled="true">
    <hy-folding-panel-item title="Fruits" index="fruits"></hy-folding-panel-item>
    <hy-folding-panel-item title="Beverages" index="beverage"></hy-folding-panel-item>
</hy-folding-panel>

Showing Borders

  • Set the border via border
html
<hy-folding-panel v-model="activeIndex" :border="true">
    <hy-folding-panel-item title="Fruits" index="fruits"></hy-folding-panel-item>
    <hy-folding-panel-item title="Beverages" index="beverage"></hy-folding-panel-item>
</hy-folding-panel>

Setting the Panel Size

  • Set the panel size via size
    • small - small panel
    • medium - medium panel (default)
    • large - large panel
html
<hy-folding-panel v-model="activeIndex" size="small">
    <hy-folding-panel-item title="Fruits" index="fruits"></hy-folding-panel-item>
    <hy-folding-panel-item title="Beverages" index="beverage"></hy-folding-panel-item>
</hy-folding-panel>

Custom Panel Header

html
<hy-folding-panel v-model="activeIndex" :disabled="true">
    <hy-folding-panel-item index="fruits">
        <template #header>
            <view class="hy-folding-panel-item__title">Custom Header</view>
        </template>
    </hy-folding-panel-item>
    <hy-folding-panel-item index="beverage">
        <template #title>
            <view class="hy-folding-panel-item__title">Custom Title</view>
        </template>
    </hy-folding-panel-item>
</hy-folding-panel>

API

FoldingPanel Props

ParameterDescriptionTypeDefault Value
modelValueThe currently active panel index, supports v-modelnumber|string-1
accordionWhether accordion mode is enabledbooleanfalse
disabledWhether the entire folding panel group is disabledbooleanfalse
borderWhether to show the borderbooleantrue
sizePanel header sizelarge|medium|smallmedium

FoldingPanelItem Props

ParameterDescriptionTypeDefault Value
indexPanel index (automatically set by the parent component)number|string-1
titlePanel titlestring-
valueValue displayed on the right sidestring-
iconLeft iconstring-
iconColorLeft icon colorstring-
iconSizeLeft icon size; numeric values default to pxstring|numner-
contentPanel contentstring-
contentHeightMaximum height of the content area; numeric values default to pxstring|numner150
disabledWhether this individual panel is disabledbooleanfalse
defaultOpenWhether expanded by defaultbooleanfalse
customStyleCustom external styles to be appliedCSSProperties-

Events

FoldingPanel Emits

Event NameDescriptionCallback Parameters
changeTriggered when the panel state changesexpanded: internal expanded state, index: index
openTriggered when a panel opensindex: index
closeTriggered when a panel closesindex: index

FoldingPanelItem Emits

Event NameDescriptionCallback Parameters
clickToggles the panel open/close stateindex: index
changeTriggered when the panel state changesexpanded: internal expanded state, index: index
openTriggered when the panel opensindex: index
closeTriggered when the panel closesindex: index
child-clickNotifies the parent when a child item is clickedindex: index

Methods

FoldingPanel Expose

NameDescriptionParameters
openOpens the panel at the specified indexindex: number|string
closeCloses the panel at the specified indexindex: number|string
toggleToggles the state of the panel at the specified indexindex: number|string
closeAllCloses all panels-

FoldingPanelItem Expose

NameDescriptionParameters
openOpens the panel-
closeCloses the panel-
toggleToggles the panel state-
getExpandedGets the current expanded state-

Slots

Slot NameDescriptionReceived Values
defaultContent of the main body-
headerPanel header-
titleContent on the left of the panel header-
03:29