import{o as t,a,y as l}from"./vue-libs.b44bc779.js";const n={class:"van-doc-markdown-body"},e=l(`

Cell

Intro

The cell is a single display item in the list.

Install

Register component globally via app.use, refer to Component Registration for more registration ways.

import { createApp } from 'vue';
import { Cell, CellGroup } from 'vant';

const app = createApp();
app.use(Cell);
app.use(CellGroup);

Usage

Basic Usage

<van-cell-group>
  <van-cell title="Cell title" value="Content" />
  <van-cell title="Cell title" value="Content" label="Description" />
</van-cell-group>

Inset Grouped

<van-cell-group inset>
  <van-cell title="Cell title" value="Content" />
  <van-cell title="Cell title" value="Content" label="Description" />
</van-cell-group>

Size

<van-cell-group>
  <van-cell title="Cell title" value="Content" size="large" />
  <van-cell
    title="Cell title"
    value="Content"
    size="large"
    label="Description"
  />
</van-cell-group>

Left Icon

<van-cell-group>
  <van-cell title="Cell title" icon="location-o" />
</van-cell-group>

Value only

<van-cell-group>
  <van-cell value="Content" />
</van-cell-group>
<van-cell-group>
  <van-cell title="Cell title" is-link />
  <van-cell title="Cell title" is-link value="Content" />
  <van-cell title="Cell title" is-link arrow-direction="down" value="Content" />
</van-cell-group>

Router

<van-cell-group>
  <van-cell title="URL" is-link url="https://github.com" />
  <van-cell title="Vue Router" is-link to="index" />
</van-cell-group>

Group Title

<van-cell-group title="Group 1">
  <van-cell title="Cell title" value="Content" />
</van-cell-group>
<van-cell-group title="Group 2">
  <van-cell title="Cell title" value="Content" />
</van-cell-group>

Use Slots

<van-cell value="Content" is-link>
  <!-- Use the title slot to customize the title -->
  <template #title>
    <span class="custom-title">Title</span>
    <van-tag type="danger">Tag</van-tag>
  </template>
</van-cell>

<van-cell title="Title" icon="shop-o">
  <!-- Use the right-icon slot to customize the right icon -->
  <template #right-icon>
    <van-icon name="search" class="search-icon" />
  </template>
</van-cell>

<style>
  .custom-title {
    margin-right: 4px;
    vertical-align: middle;
  }

  .search-icon {
    font-size: 16px;
    line-height: inherit;
  }
</style>

Vertical Center

<van-cell center title="Cell title" value="Content" label="Description" />

API

CellGroup Props

AttributeDescriptionTypeDefault
titleGroup titlestring-
inset v3.1.0Whether to be inset groupedbooleanfalse
borderWhether to show outer borderbooleantrue

Cell Props

AttributeDescriptionTypeDefault
titleTitlenumber | string-
valueRight textnumber | string-
labelDescription below the titlestring-
sizeSize, can be set to largestring-
iconLeft Iconstring-
icon-prefixIcon className prefixstringvan-icon
borderWhether to show inner borderbooleantrue
centerWhether to center content verticallybooleanfalse
urlLink URLstring-
toTarget route of the link, same as to of vue-routerstring | object-
replaceIf true, the navigation will not leave a history recordbooleanfalse
clickableWhether to show click feedback when clickedbooleannull
is-linkWhether to show link iconbooleanfalse
requiredWhether to show required markbooleanfalse
arrow-directionCan be set to left up downstringright
title-styleTitle stylestring | Array | object-
title-classTitle classNamestring | Array | object-
value-classValue classNamestring | Array | object-
label-classLabel classNamestring | Array | object-

Cell Events

EventDescriptionArguments
clickEmitted when cell is clickedevent: MouseEvent

CellGroup Slots

NameDescription
defaultDefault slot
titleCustom title

Cell Slots

NameDescription
titleCustom title
value v3.1.1Custom value
labelCustom label
iconCustom left icon
right-iconCustom right icon
extraCustom extra content on the right

Types

The component exports the following type definitions:

import type {
  CellSize,
  CellProps,
  CellGroupProps,
  CellArrowDirection,
} from 'vant';

Theming

CSS Variables

The component provides the following CSS variables, which can be used to customize styles. Please refer to ConfigProvider component.

NameDefault ValueDescription
--van-cell-font-sizevar(--van-font-size-md)-
--van-cell-line-height24px-
--van-cell-vertical-padding10px-
--van-cell-horizontal-paddingvar(--van-padding-md)-
--van-cell-text-colorvar(--van-text-color)-
--van-cell-background-colorvar(--van-background-color-light)-
--van-cell-border-colorvar(--van-border-color)-
--van-cell-active-colorvar(--van-active-color)-
--van-cell-required-colorvar(--van-danger-color)-
--van-cell-label-colorvar(--van-text-color-2)-
--van-cell-label-font-sizevar(--van-font-size-sm)-
--van-cell-label-line-heightvar(--van-line-height-sm)-
--van-cell-label-margin-topvar(--van-padding-base)-
--van-cell-value-colorvar(--van-text-color-2)-
--van-cell-icon-size16px-
--van-cell-right-icon-colorvar(--van-gray-6)-
--van-cell-large-vertical-paddingvar(--van-padding-sm)-
--van-cell-large-title-font-sizevar(--van-font-size-lg)-
--van-cell-large-label-font-sizevar(--van-font-size-md)-
--van-cell-group-background-colorvar(--van-background-color-light)-
--van-cell-group-title-colorvar(--van-text-color-2)-
--van-cell-group-title-paddingvar(--van-padding-md) var(--van-padding-md) var(--van-padding-xs)-
--van-cell-group-title-font-sizevar(--van-font-size-md)-
--van-cell-group-title-line-height16px-
--van-cell-group-inset-padding0 var(--van-padding-md)-
--van-cell-group-inset-border-radiusvar(--van-border-radius-lg)-
--van-cell-group-inset-title-paddingvar(--van-padding-md) var(--van-padding-md) var(--van-padding-xs) var(--van-padding-xl)-
`,23),d=[e],h={__name:"README",setup(p,{expose:s}){return s({frontmatter:{}}),(r,o)=>(t(),a("div",n,d))}};export{h as default};