Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsCommunityBlog
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

Back to skills

Component Container

ASecurity

HarmonyOS ArkTS 容器组件使用规范。包含 Column、Row、Stack、Flex、List、Grid、Scroll、Swiper、Tabs、Refresh、RelativeContainer 等布局容器组件。Use when: (1) 实现页面布局,(2) 实现列表滚动,(3) 实现层叠布局,(4) 实现网格布局,(5) 实现轮播切换,(6) 下拉刷新,(7) 上拉加载更多。Triggers: Column、Row、Stack、Flex、List、Grid、Scroll、Swiper、Tabs、Refresh、布局、容器、列表、网格、滚动、堆叠、轮播、标签页、下拉刷新、上拉加载。

2 stars
0 votes
0 copies
0 views
Added 9/22/2026
developmenttypescriptspring

Security Analysis

A100/100

Scanned 9/22/2026

Install to Claude Code

$npx -y skills add IsKenKenYa/skills --skill component_container --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Component Container?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Component Container
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/iskenkenya-component-container/badge)](https://www.skillsdirectory.com/skills/iskenkenya-component-container)

More formats (shields.io, HTML) on the badges page.

Download Zip
Files
SKILL.md
---
name: component_container
description: "HarmonyOS ArkTS 容器组件使用规范。包含 Column、Row、Stack、Flex、List、Grid、Scroll、Swiper、Tabs、Refresh、RelativeContainer 等布局容器组件。Use when: (1) 实现页面布局,(2) 实现列表滚动,(3) 实现层叠布局,(4) 实现网格布局,(5) 实现轮播切换,(6) 下拉刷新,(7) 上拉加载更多。Triggers: Column、Row、Stack、Flex、List、Grid、Scroll、Swiper、Tabs、Refresh、布局、容器、列表、网格、滚动、堆叠、轮播、标签页、下拉刷新、上拉加载。"
user-invocable: false
metadata:
  internal: true
---

# 容器组件 (component_container)

本 skill 覆盖 HarmonyOS ArkTS **容器组件**的使用规范。详细规范见各 `references/《组件名》组件使用规范.md`,按需加载。

## 本分组组件

| 组件 | 规范文件 | 用途 |
|------|----------|------|
| Column | references/column组件使用规范.md | 纵向布局 |
| Row | references/row组件使用规范.md | 横向布局 |
| Stack | references/stack组件使用规范.md | 层叠布局 |
| Flex | references/flex组件使用规范.md | 弹性布局 |
| List | references/list组件使用规范.md | 列表容器 |
| Grid | references/grid组件使用规范.md | 网格容器 |
| Scroll | references/scroll组件使用规范.md | 滚动容器 |
| Swiper | references/swiper组件使用规范.md | 轮播容器 |
| Tabs | references/tabs组件使用规范.md | 标签页容器 |
| Refresh | references/refresh组件使用规范.md | 下拉刷新容器 |

## 何时读哪个文件

- 纵向布局 / 垂直排列 → `references/column组件使用规范.md`
- 横向布局 / 水平排列 → `references/row组件使用规范.md`
- 层叠布局 / 堆叠 → `references/stack组件使用规范.md`
- 弹性布局 / Flex → `references/flex组件使用规范.md`
- 列表 / 长列表 / ListItem → `references/list组件使用规范.md`
- 网格 / GridItem → `references/grid组件使用规范.md`
- 滚动 / Scroll → `references/scroll组件使用规范.md`
- 下拉刷新 / Refresh / 上拉加载 → `references/refresh组件使用规范.md`

## 快速索引

### Column 组件(纵向布局)

```typescript
Column({ space: 10 }) {
  Text('第一行')
  Text('第二行')
  Text('第三行')
}
.width('100%')
.height(200)
.alignItems(HorizontalAlign.Center)      // 水平居中
.justifyContent(FlexAlign.SpaceBetween)  // 垂直两端分布
```

**对齐属性**:
- `alignItems(value: HorizontalAlign)` - 子组件水平对齐
- `justifyContent(value: FlexAlign)` - 子组件垂直分布

**HorizontalAlign 枚举**:
| 值 | 说明 |
|----|------|
| Start | 起始对齐 |
| Center | 居中对齐 |
| End | 结束对齐 |

### Row 组件(横向布局)

```typescript
Row({ space: 10 }) {
  Text('左侧')
  Text('中间')
  Text('右侧')
}
.width('100%')
.height(50)
.justifyContent(FlexAlign.SpaceBetween)   // 水平两端分布
.alignItems(VerticalAlign.Center)         // 垂直居中
```

**对齐属性**:
- `alignItems(value: VerticalAlign)` - 子组件垂直对齐
- `justifyContent(value: FlexAlign)` - 子组件水平分布

**VerticalAlign 枚举**:
| 值 | 说明 |
|----|------|
| Top | 顶部对齐 |
| Center | 居中对齐 |
| Bottom | 底部对齐 |

### Stack 组件(层叠布局)

```typescript
Stack({ alignContent: Alignment.Bottom }) {
  // 底层
  Image($r('app.media.background'))
    .width('100%')
    .height(200)
  // 中层
  Text('标题')
    .fontSize(20)
  // 顶层
  Badge({ count: 5 }) {
    // ...
  }
}
.width('100%')
.height(200)
```

**Alignment 枚举**:
| 值 | 说明 |
|----|------|
| TopStart | 左上 |
| Top | 上中 |
| TopEnd | 右上 |
| Start | 左中 |
| Center | 居中 |
| End | 右中 |
| BottomStart | 左下 |
| Bottom | 下中 |
| BottomEnd | 右下 |

### List 组件(列表容器)

```typescript
List({ space: 10 }) {
  ForEach(this.dataList, (item: DataItem) => {
    ListItem() {
      Row() {
        Text(item.title)
        Text(item.desc)
      }
    }
  })
}
.width('100%')
.height('100%')
.listDirection(Axis.Vertical)  // 列表方向
.divider({ strokeWidth: 1, color: '#EEEEEE' })  // 分割线
.onScroll(() => {
  // 滚动事件
})
```

**常用属性**:
- `listDirection(value: Axis)` - 列表方向
- `divider(value: DividerStyle)` - 分割线样式
- `scrollBar(value: BarState)` - 滚动条状态
- `edgeEffect(value: EdgeEffect)` - 边缘效果

### Scroll 组件(滚动容器)

```typescript
Scroll() {
  Column() {
    // 内容区域
    ForEach(this.items, (item: Item) => {
      Text(item.title)
    })
  }
}
.width('100%')
.height(300)
.scrollable(ScrollDirection.Vertical)  // 滚动方向
.scrollBar(BarState.Auto)              // 滚动条
.edgeEffect(EdgeEffect.Spring)         // 边缘弹簧效果
.onScroll((xOffset: number, yOffset: number) => {
  // 滚动回调
})
```

**ScrollDirection 枚举**:
| 值 | 说明 |
|----|------|
| Vertical | 垂直滚动 |
| Horizontal | 水平滚动 |
| None | 不可滚动 |
| Auto | 自动判断 |

### Flex 组件(弹性布局)

```typescript
Flex({
  direction: FlexDirection.Row,
  wrap: FlexWrap.Wrap,
  justifyContent: FlexAlign.SpaceBetween,
  alignItems: ItemAlign.Center
}) {
  Text('项目1')
  Text('项目2')
  Text('项目3')
}
.width('100%')
```

**FlexDirection 枚举**:
| 值 | 说明 |
|----|------|
| Row | 水平排列 |
| RowReverse | 水平反向排列 |
| Column | 垂直排列 |
| ColumnReverse | 垂直反向排列 |

**FlexWrap 枚举**:
| 值 | 说明 |
|----|------|
| NoWrap | 不换行 |
| Wrap | 换行 |
| WrapReverse | 反向换行 |

**FlexAlign 枚举**(justifyContent):
| 值 | 说明 |
|----|------|
| Start | 起始对齐 |
| Center | 居中 |
| End | 结束对齐 |
| SpaceBetween | 两端分布 |
| SpaceAround | 环绕分布 |
| SpaceEvenly | 均匀分布 |

## FlexAlign 对齐速查

```
Start:      |■■■■■■|······|
Center:     |···■■■■■■··|
End:        |······|■■■■■■|
SpaceBetween: |■■■|··|■■■|··|■■■|
SpaceAround:  |·■■■·|·■■■·|·■■■·|
SpaceEvenly:  |··■■■··|··■■■··|··■■■··|
```

## 通用约定

- 容器组件继承自 `CommonMethod`,支持通用属性
- 使用 `space` 参数设置子组件间距
- 使用 `alignItems` 设置交叉轴对齐
- 使用 `justifyContent` 设置主轴对齐
- 列表类组件优先使用 List + LazyForEach 实现性能优化

Attribution

IsKenKenYaIsKenKenYa
View sourceMore from IsKenKenYa →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Browser Extension Developer

Use this skill when developing or maintaining browser extension code in the `browser/` directory, including Chrome/Firefox/Edge compatibility, content scripts, background scripts, or i18n updates.

284072 votes

Seo Optimizer

SEO optimization with keyword analysis, readability assessment, technical validation, content quality. Use for search rankings, blog posts, content audits, or encountering keyword density, readability scores, meta tags, schema markup errors.

2192 votes

Google Official Seo Guide

Official Google SEO guide covering search optimization, best practices, Search Console, crawling, indexing, and improving website search visibility based on official Google documentation

1862 votes

Tanstack Start

Build a full-stack TanStack Start app on Cloudflare Workers from scratch — SSR, file-based routing, server functions, D1+Drizzle, better-auth, Tailwind v4+shadcn/ui. Use whenever the user mentions TanStack Start, asks to scaffold a full-stack Cloudflare app with SSR, wants an SSR dashboard, or asks for a React 19 + Cloudflare Workers app with file-based routing and server functions — even if they don't name TanStack Start specifically. No template repo — Claude generates every file fresh per ...

9881 votes

Pentest

PTES-aligned adversarial security audit for backend, frontend, and mobile applications. Produces a CVSS-scored Hacker Report with verified PoCs and phased remediation.

5491 votes
View all in development →