Skip to content

Cell - Vant 4

Cell

📱 Build beautiful list interfaces with flexible, customizable cell components that adapt to any content!

Intro 📋

The building block of great lists! Cell components provide a consistent, flexible way to display information in lists - perfect for settings pages, contact lists, menu items, and any structured content! 🎯✨

Install 📦

Start building amazing lists! Register both Cell and CellGroup components to create organized, beautiful interfaces! 🚀

js
import { createApp } from'vue'; import { Cell, CellGroup } from'vant'; const app = createApp(); app.use(Cell); app.use(CellGroup);

Usage 🎯

Basic Usage 🌟

Create your first cell list! Simple, clean, and perfect for displaying key-value information! 📝

html

Inset Grouped 📦

Create card-like grouped lists! Perfect for settings sections and organized content with beautiful rounded corners! 🎨

html

Size 📏

Choose your perfect size! Use large for important content or keep it normal for compact lists! 📐

html

Left Icon 🎨

Add visual context! Icons help users quickly identify content and make your lists more intuitive! 🌟

html

Make it clickable! Transform cells into interactive links that navigate users to external URLs! 🚀

html

Router 🧭

Navigate with Vue Router! Seamlessly integrate with your app's routing for smooth page transitions! ⚡

html

Group Title 📚

Organize with style! Add descriptive titles to group related cells together beautifully! 🏷️

html

Use Slots ✨

Customize everything! Use slots to add any content - from complex layouts to custom components! 🎭

html

Vertical Center 🎯

Perfect alignment every time! Center content vertically for a polished, professional look! 📐

html

API

CellGroup Props

AttributeDescriptionTypeDefault
titleGroup titlestring-
insetWhether to be inset groupedbooleanfalse
borderWhether to show outer borderbooleantrue

Cell Props

AttributeDescriptionTypeDefault
titleTitle*numberstring*
valueRight text*numberstring*
labelDescription below the title*numberstring*
sizeSize, can be set to large``normalstring-
iconLeft Iconstring-
icon-prefixIcon className prefixstringvan-icon
tagCustom element tagstringdiv
urlLink URLstring-
toThe target route should navigate to when clicked on, same as the to prop of Vue Router*stringobject*

| replace | If true, the navigation will not leave a history record | boolean | false | | border | Whether to show inner border | boolean | true | | center | Whether to center content vertically | boolean | false | | clickable | Whether to show click feedback when clicked | boolean | null | | is-link | Whether to show link icon | boolean | false | | required | Whether to show required mark | boolean | false | | arrow-direction | Can be set to left``up``down | string | right | | title-style | Title style | string | Array | object | - | | title-class | Title className | string | Array | object | - | | value-class | Value className | string | Array | object | - | | label-class | Label className | string | Array | object | - |

Cell Events

EventDescriptionArguments
clickEmitted when cell is clickedevent: MouseEvent

CellGroup Slots

NameDescription
defaultDefault slot
titleCustom title

Cell Slots

NameDescription
titleCustom title
valueCustom value
labelCustom label
iconCustom left icon
right-iconCustom right icon
extraCustom extra content on the right

Types

The component exports the following type definitions:

ts
importtype { 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-backgroundvar(--van-background-2)-
--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-value-font-sizeinherit-
--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-large-value-font-sizeinherit-
--van-cell-group-backgroundvar(--van-background-2)-
--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-radiusvar(--van-radius-lg)-
--van-cell-group-inset-title-paddingvar(--van-padding-md) var(--van-padding-md) var(--van-padding-xs) var(--van-padding-xl)-

## Related Docs 📚

- [List](./list) - Advanced list component with virtual scrolling
- [Icon](./icon) - Add icons to your cells
- [Badge](./badge) - Show notifications and counts
- [Switch](./switch) - Add toggle controls
- [Field](./field) - Input fields in cells
- [Button](./button) - Action buttons in cells
- [Divider](./divider) - Separate cell groups
- [ConfigProvider](./config-provider) - Global configuration
- [Advanced Usage](./advanced-usage) - Component registration guide

Enterprise-level mobile solution based on Vant