Skip to content

Cell Component ​

The cell component is generally used for groups of list items, such as personal center pages, settings pages, etc.

📌 Platform Differences ​

APP(vue)H5WeChat Mini ProgramAlipay Mini Program
✔✔✔✔

🏯 Basic Usage ​

Tip

If you want to use click events on hy-cell, you must set a unique name value for each hy-cell-item to distinguish which child element is clicked

html
<template>
    <!-- Global usage -->
    <hy-cell @click="onClick">
        <hy-cell-item
            title="Toolbox"
            name="tools"
            :icon="{ name: IconConfig.SETTING, color: 'red' }"
        ></hy-cell-item>
        <hy-cell-item title="Mine" name="my" sub="I am a magical little box" value="Back"></hy-cell-item>
        <hy-cell-item title="Disabled" name="disabled" disabled></hy-cell-item>
    </hy-cell>
</template>

Setting the icon content ​

vue
<template>
    <hy-cell>
        <hy-cell-item
            title="Toolbox"
            :icon="{ name: IconConfig.SETTING, color: 'red' }"
        ></hy-cell-item>
    </hy-cell>

    <!-- Custom icon -->
    <hy-cell>
        <hy-cell-item title="Toolbox">
            <template #icon>
                <hy-icon name="tools" />
            </template>
        </hy-cell-item>
    </hy-cell>
</template>

Right-side content positioning ​

  • Change the position of the value by setting arrange
    • left: Left
    • center: Center
    • right: Right
html
<template>
    <hy-cell arrange="left"></hy-cell>
    <hy-cell arrange="center"></hy-cell>
    <hy-cell arrange="right"></hy-cell>
</template>

Cell size ​

  • Set the cell size via size
    • small: Small
    • medium: Default
    • large: Large
html
<template>
    <hy-cell size="small"></hy-cell>
    <hy-cell size="medium"></hy-cell>
    <hy-cell size="large"></hy-cell>
</template>

Rotating the right arrow ​

  • Set the arrow direction via arrow-direction
    • up: Up
    • right: Right
    • down: Down
    • left: Left
html
<template>
    <hy-cell arrow-direction="up"></hy-cell>
    <hy-cell arrow-direction="right"></hy-cell>
    <hy-cell arrow-direction="down"></hy-cell>
    <hy-cell arrow-direction="left"></hy-cell>
</template>
html
<template>
    <hy-cell>
        <hy-cell-item url="/page/index/tools"></hy-cell-item>
    </hy-cell>
</template>

API ​

Cell Props ​

ParameterDescriptionTypeDefault
borderWhether to show the cell's bottom borderbooleantrue
disabledWhether to disable the cellbooleanfalse
clickableWhether to enable click feedback (shown as a gray background on click)booleanfalse
sizeSize of the cell, numbers use px as the default unitstring|numbermedium
arrangeWhether the content is centered (mainly for the right-side value part)stringright
isRightIconWhether to show the right iconbooleantrue
arrowDirectionDirection of the right arrowstringright
customStyleDefine external styles to be appliedCSSProperties-
customClassCustom external class namestring-

CellItem Props ​

ParameterDescriptionTypeDefault
titleHeader titlestring-
subSmall hint below the titlestring-
disabledWhether to disable the cellbooleanfalse
valueRight-side contentstring|number-
iconLeft icon, see Icon APIHyIconProps-
rightIconRight icon, see Icon APIHyIconProps-
arrowDirectionDirection of the right arrowstringright
urlURL to navigate to after clickingstring-
stopWhether clicking the cell stops event propagationbooleantrue
nameIdentifier returned in the click eventstring|number-
customStyleDefine external styles to be appliedCSSProperties-
customClassCustom external class namestring-

Events ​

Cell Emits ​

Event NameDescriptionCallback Parameter
clickTriggered when the cell list is clickedname: unique identifier

CellItem Emits ​

Event NameDescriptionCallback Parameter
clickTriggered when the cell list is clickedname: unique identifier

Cell Slots ​

Slot NameDescriptionReceived Value
defaultDefault slot for CellItem componentstitle

CellItem Slots ​

Slot NameDescriptionReceived Value
titleCustom cell title contenttitle
iconCustom left iconicon
subCustom subtitle contentsub
valueCustom right-side value contentrecord
right-iconCustom right icon contenticon

CSS Variables ​

Variable NameDescriptionDefault Value
--hy-cell-item-icon-marginRight margin of the icon10px
--hy-cell-item-value-max-widthMax width of the right-side value90%
--hy-cell-item-font-size-largeTitle font size for largeFollows --hy-font-size-lg (36rpx)
--hy-cell-item-font-size-mediumTitle font size for mediumFollows --hy-font-size-base (28rpx)
--hy-cell-item-font-size-smallTitle font size for smallFollows --hy-font-size-sm (24rpx)
--hy-cell-item-sub-colorDescription text colorFollows --hy-text-color--grey
--hy-cell-item-sub-font-sizeDescription text font sizeFollows --hy-font-size-sm (24rpx)
--hy-cell-item-value-colorRight-side value text colorFollows --hy-text-color--grey
--hy-cell-item-arrow-colorRight arrow colorFollows --hy-text-color--3
--hy-cell-item-disabled-colorDisabled text colorFollows --hy-text-color--disabled
12:33
battery